protected function EntityAccessController::setCache

Statically caches whether the given user has access.

Parameters

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

string $operation: The entity operation. Usually one of 'view', 'edit', 'create' or 'delete'.

string $langcode: The language code for which to check access.

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

Return value

bool TRUE if access was granted, FALSE otherwise.

1 call to EntityAccessController::setCache()
EntityAccessController::access in drupal/core/lib/Drupal/Core/Entity/EntityAccessController.php
Checks access to an operation on a given entity or entity translation.

File

drupal/core/lib/Drupal/Core/Entity/EntityAccessController.php, line 129
Contains \Drupal\Core\Entity\EntityAccessController.

Class

EntityAccessController
Defines a default implementation for entity access controllers.

Namespace

Drupal\Core\Entity

Code

protected function setCache($access, EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
  $uid = $account ? $account
    ->id() : 0;
  $uuid = $entity
    ->uuid();

  // Save the given value in the static cache and directly return it.
  return $this->accessCache[$uid][$uuid][$langcode][$operation] = (bool) $access;
}