public function AppAccessCheckByAppName::access in Apigee Edge 8
Checks access to an app entity operation on the given route.
EntityAccessCheck only works if the route contains a parameter that matches the name of the entity type. Ex.: {developer_app} and not {app}.
pattern: '/user/{user}/{app}'
requirements:
_developer_app_access: 'view'
Parameters
\Symfony\Component\Routing\Route $route: The route to check against.
\Drupal\Core\Routing\RouteMatchInterface $route_match: The parametrized route.
\Drupal\Core\Session\AccountInterface $account: The currently logged in account.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
See also
\Drupal\Core\Entity\EntityAccessCheck
File
- src/
Access/ AppAccessCheckByAppName.php, line 59
Class
- AppAccessCheckByAppName
- Check access on app routes that contains {app} (app name) instead of app id.
Namespace
Drupal\apigee_edge\AccessCode
public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
$operation = $route
->getRequirement('_app_access_check_by_app_name');
// If $entity_type parameter is a valid entity, call its own access check.
$parameters = $route_match
->getParameters();
/** @var \Drupal\apigee_edge\Entity\AppInterface $entity */
$entity = $parameters
->get('app');
if ($entity) {
return $entity
->access($operation, $account, TRUE);
}
// No opinion, so other access checks should decide if access should be
// allowed or not.
return AccessResult::neutral();
}