public function AppsPageAccessCheck::access in Apigee Edge 8
Grant access to the Apps page if user has any of the required permissions.
Parameters
\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.
File
- src/
Access/ AppsPageAccessCheck.php, line 44
Class
- AppsPageAccessCheck
- Custom access handler to Apps page.
Namespace
Drupal\apigee_edge\AccessCode
public function access(RouteMatchInterface $route_match, AccountInterface $account) {
/** @var \Drupal\user\UserInterface $user */
$user = $route_match
->getParameter('user');
if ($user === NULL) {
return AccessResult::forbidden('User is missing from route.');
}
return AccessResultAllowed::allowedIf($account
->id() === $user
->id() && $account
->hasPermission('view own developer_app') || $account
->hasPermission('administer developer_app'));
}