Skip to content

Commit

Permalink
Account for bypass on individual entities.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey committed Jun 24, 2024
1 parent 7f30f6f commit ab79f89
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Access/EmbargoAccessCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public function access(EntityInterface $entity, AccountInterface $user) {
->addCacheTags($type->getListCacheTags())
->addCacheContexts($type->getListCacheContexts());

if ($user->hasPermission('bypass embargo access')) {
return $state->setReason('User has embargo bypass permission.')
->addCacheContexts(['user.permissions']);
}

/** @var \Drupal\embargo\EmbargoStorage $storage */
$storage = $this->entityTypeManager->getStorage('embargo');
$related_embargoes = $storage->getApplicableEmbargoes($entity);
Expand Down

0 comments on commit ab79f89

Please sign in to comment.