You are here

protected function QueueStorageEntityAccessControlHandler::checkAccess in Open Social 8.9

Same name and namespace in other branches
  1. 8.8 modules/custom/social_queue_storage/src/QueueStorageEntityAccessControlHandler.php \Drupal\social_queue_storage\QueueStorageEntityAccessControlHandler::checkAccess()
  2. 10.3.x modules/custom/social_queue_storage/src/QueueStorageEntityAccessControlHandler.php \Drupal\social_queue_storage\QueueStorageEntityAccessControlHandler::checkAccess()
  3. 10.0.x modules/custom/social_queue_storage/src/QueueStorageEntityAccessControlHandler.php \Drupal\social_queue_storage\QueueStorageEntityAccessControlHandler::checkAccess()
  4. 10.1.x modules/custom/social_queue_storage/src/QueueStorageEntityAccessControlHandler.php \Drupal\social_queue_storage\QueueStorageEntityAccessControlHandler::checkAccess()
  5. 10.2.x modules/custom/social_queue_storage/src/QueueStorageEntityAccessControlHandler.php \Drupal\social_queue_storage\QueueStorageEntityAccessControlHandler::checkAccess()

Performs access checks.

This method is supposed to be overwritten by extending classes that do their own custom access checking.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for which to check access.

string $operation: The entity operation. Usually one of 'view', 'view label', 'update' or 'delete'.

\Drupal\Core\Session\AccountInterface $account: The user for which to check access.

Return value

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

Overrides EntityAccessControlHandler::checkAccess

File

modules/custom/social_queue_storage/src/QueueStorageEntityAccessControlHandler.php, line 20

Class

QueueStorageEntityAccessControlHandler
Access controller for the Queue storage entity entity.

Namespace

Drupal\social_queue_storage

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {

  /** @var \Drupal\social_queue_storage\Entity\QueueStorageEntityInterface $entity */
  switch ($operation) {
    case 'view':
      return AccessResult::allowedIfHasPermission($account, 'view published queue storage entity entities');
    case 'update':
      return AccessResult::allowedIfHasPermission($account, 'edit queue storage entity entities');
    case 'delete':
      return AccessResult::allowedIfHasPermission($account, 'delete queue storage entity entities');
  }

  // Unknown operation, no opinion.
  return AccessResult::neutral();
}