-
Notifications
You must be signed in to change notification settings - Fork 1
DGI9-628: Attempt to avoid making assertions on unpublished content. #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdded a published-status pre-check in EntityAccessHandler::check to return a neutral AccessResult for unpublished entities; several constructors and a hook signature received trailing-comma formatting edits; LUTGenerator and its interface now accept a nullable EntityInterface parameter. Changes
Sequence DiagramsequenceDiagram
participant Caller as Caller
participant Handler as EntityAccessHandler
participant Entity as Entity
Caller->>Handler: check(entity, ...)
Handler->>Entity: implements EntityPublishedInterface?
alt implements
Entity-->>Handler: yes
Handler->>Entity: isPublished()?
alt not published
Entity-->>Handler: no
Handler-->>Caller: neutral AccessResult (published check)
else published
Entity-->>Handler: yes
Handler->>Handler: continue existing access logic
Handler-->>Caller: AccessResult (allow/deny/neutral)
end
else does not implement
Entity-->>Handler: no
Handler->>Handler: run existing access logic
Handler-->>Caller: AccessResult (allow/deny/neutral)
end
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (6)
🧰 Additional context used🧬 Code graph analysis (2)src/LUTGenerator.php (1)
src/LUTGeneratorInterface.php (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (8)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/EntityAccessHandler.php (1)
104-111: Fix the linting error to unblock the pipeline.The pipeline is failing due to a missing trailing comma in the multi-line function declaration. Although this line wasn't changed in this PR, the linting error must be resolved to merge.
Apply this diff to fix the linting error:
public function __construct( Connection $database, $ops, EntityStorageInterface $storage, $column, $target_column, - array $op_map + array $op_map, ) {
🧹 Nitpick comments (1)
src/EntityAccessHandler.php (1)
144-146: Approve the early return for unpublished entities; consider adding cache dependency.The logic correctly short-circuits hierarchical access checks for unpublished content, allowing Drupal's standard access control to handle unpublished entities. The
instanceofcheck is appropriate since not all entities implementEntityPublishedInterface.However, consider adding the entity as a cacheable dependency since the access result depends on the entity's published status:
if ($entity instanceof EntityPublishedInterface && !$entity->isPublished()) { - return AccessResult::neutral("Hierarchical access is only concerned with published content."); + return AccessResult::neutral("Hierarchical access is only concerned with published content.") + ->addCacheableDependency($entity); }This ensures that if the entity's published status changes, the cached access result will be invalidated appropriately.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/EntityAccessHandler.php(2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Code Linting
src/EntityAccessHandler.php
[error] 110-110: Multi-line function declarations must have a trailing comma after the last parameter (Drupal.Functions.MultiLineFunctionDeclaration.MissingTrailingComma).
Summary by CodeRabbit