You are here

protected function GroupAccessControlHandler::checkAccess in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/AccessControl/GroupAccessControlHandler.php \Drupal\rng\AccessControl\GroupAccessControlHandler::checkAccess()
  2. 3.x src/AccessControl/GroupAccessControlHandler.php \Drupal\rng\AccessControl\GroupAccessControlHandler::checkAccess()

Parameters

\Drupal\rng\GroupInterface $entity: A group entity.

Overrides EntityAccessControlHandler::checkAccess

File

src/AccessControl/GroupAccessControlHandler.php, line 21

Class

GroupAccessControlHandler
Access controller for groups.

Namespace

Drupal\rng\AccessControl

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
  $account = $this
    ->prepareUser($account);
  $event = $entity
    ->getEvent();
  if (!$entity
    ->isUserGenerated() && $operation == 'delete') {
    return AccessResult::forbidden();
  }
  if ($event) {
    return $event
      ->access('manage event', $account, TRUE);
  }
  return AccessResult::neutral();
}