You are here

protected function RngEntityAccess::templateCollectionTemplateAccess in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/RngEntityAccess.php \Drupal\rng\RngEntityAccess::templateCollectionTemplateAccess()
  2. 8 src/RngEntityAccess.php \Drupal\rng\RngEntityAccess::templateCollectionTemplateAccess()

Determine whether the account can edit templates for a template collection.

Parameters

\Drupal\courier\TemplateCollectionInterface $entity: A Courier template collection entity.

\Drupal\Core\Session\AccountInterface $account: The account trying to access the entity.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 call to RngEntityAccess::templateCollectionTemplateAccess()
RngEntityAccess::hook_entity_access in src/RngEntityAccess.php
Control entity operation access.

File

src/RngEntityAccess.php, line 129

Class

RngEntityAccess
RNG entity access.

Namespace

Drupal\rng

Code

protected function templateCollectionTemplateAccess(TemplateCollectionInterface $entity, AccountInterface $account) {
  $owner = $entity
    ->getOwner();
  if ($owner && $this->eventManager
    ->isEvent($owner)) {
    return AccessResult::allowedIf($owner
      ->access('manage event', $account))
      ->addCacheableDependency($owner);
  }
  return AccessResult::neutral();
}