protected function EntityAccessControlHandlerBase::checkEntityPermissions in Entity API 8
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', 'duplicate' 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 EntityAccessControlHandlerBase::checkEntityPermissions()
- EntityAccessControlHandlerBase::checkAccess in src/
EntityAccessControlHandlerBase.php - Performs access checks.
File
- src/
EntityAccessControlHandlerBase.php, line 51
Class
- EntityAccessControlHandlerBase
- @internal
Namespace
Drupal\entityCode
protected function checkEntityPermissions(EntityInterface $entity, $operation, AccountInterface $account) {
$permissions = [
"{$operation} {$entity->getEntityTypeId()}",
"{$operation} {$entity->bundle()} {$entity->getEntityTypeId()}",
];
return AccessResult::allowedIfHasPermissions($account, $permissions, 'OR');
}