Checks access to an operation on a given entity or entity translation.
\Drupal\Core\Entity\EntityInterface $entity: The entity for which to check access.
string $operation: The operation access should be checked for. Usually one of "view", "create", "update" or "delete".
string $langcode: (optional) The language code for which to check access. Defaults to Language::LANGCODE_DEFAULT.
\Drupal\Core\Session\AccountInterface $account: (optional) The user session for which to check access, or NULL to check access for the current user. Defaults to NULL.
bool TRUE if access was granted, FALSE otherwise.
Overrides EntityAccessController::access
public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL) {
if (user_access('bypass node access', $account)) {
return TRUE;
}
if (!user_access('access content', $account)) {
return FALSE;
}
return parent::access($entity, $operation, $langcode, $account);
}