public function EntityRevisionRouteAccessChecker::access in Entity API 8.0
Same name and namespace in other branches
- 8 src/Access/EntityRevisionRouteAccessChecker.php \Drupal\entity\Access\EntityRevisionRouteAccessChecker::access()
File
- src/
Access/ EntityRevisionRouteAccessChecker.php, line 49 - Contains \Drupal\entity\Access\EntityRevisionRouteAccessChecker
Class
- EntityRevisionRouteAccessChecker
- Checks access to a entity revision.
Namespace
Drupal\entity\AccessCode
public function access(Route $route, AccountInterface $account, Request $request) {
$operation = $route
->getRequirement('_entity_access_revision');
list(, $operation) = explode('.', $operation, 2);
if ($operation === 'list') {
$_entity = $request->attributes
->get('_entity', $request->attributes
->get($route
->getOption('entity_type_id')));
return AccessResult::allowedIf($this
->checkAccess($_entity, $account, $operation))
->cachePerPermissions();
}
else {
$_entity_revision = $request->attributes
->get('_entity_revision');
return AccessResult::allowedIf($_entity_revision && $this
->checkAccess($_entity_revision, $account, $operation))
->cachePerPermissions();
}
}