public function ConnectionAccessCheck::access in RedHen CRM 8
Checks access to the RedHen operation on the given route.
The route's '_redhen_connection_access' requirement should specify an operation as a string, where available operations are: 'view', 'view label', 'update', and 'delete'.
For example, this route configuration invokes a permissions check for 'update' access to entities of type 'redhen_org':
pattern: '/foo/{redhen_org}/bar'
requirements:
_redhen_connection_access: 'update'
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The parameterized route.
\Drupal\Core\Session\AccountInterface $account: The user account.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
File
- modules/
redhen_connection/ src/ Access/ ConnectionAccessCheck.php, line 41
Class
Namespace
Drupal\redhen_connection\AccessCode
public function access(RouteMatchInterface $route_match, AccountInterface $account) {
$route = $route_match
->getRouteObject();
$operation = $route
->getRequirement('_redhen_connection_access');
$entity = $this
->getEntity($route_match);
if ($entity) {
return $entity
->access($operation, $account, TRUE);
}
return AccessResult::neutral();
}