You are here

protected function CivicrmEntityAccessHandler::checkEntityPermissions in CiviCRM Entity 8.3

Checks the entity operation and bundle permissions.

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.

1 call to CivicrmEntityAccessHandler::checkEntityPermissions()
CivicrmEntityAccessHandler::checkAccess in src/CivicrmEntityAccessHandler.php
Performs access checks.

File

src/CivicrmEntityAccessHandler.php, line 70

Class

CivicrmEntityAccessHandler
Entity access handler for CiviCRM entities.

Namespace

Drupal\civicrm_entity

Code

protected function checkEntityPermissions(EntityInterface $entity, $operation, AccountInterface $account) {
  $permissions = [];
  if (!empty($this->civicrmEntityInfo[$this->entityTypeId]['permissions'][$operation])) {
    $permissions = $this->civicrmEntityInfo[$this->entityTypeId]['permissions'][$operation];
  }
  return AccessResult::allowedIfHasPermissions($account, $permissions, 'OR');
}