You are here

protected function FieldCollectionItemAccessControlHandler::checkAccess in Field collection 8

Same name and namespace in other branches
  1. 8.3 src/FieldCollectionItemAccessControlHandler.php \Drupal\field_collection\FieldCollectionItemAccessControlHandler::checkAccess()

Performs access checks.

Uses permissions from host entity.

Parameters

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

string $operation: The entity operation. Usually one of 'view', 'update', 'create' 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

src/FieldCollectionItemAccessControlHandler.php, line 27

Class

FieldCollectionItemAccessControlHandler

Namespace

Drupal\field_collection

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
  $result = parent::checkAccess($entity, $operation, $account);
  if ($result
    ->isForbidden()) {
    return $result;
  }
  return $entity
    ->getHost()
    ->access($operation, $account, TRUE);
}