public function UserProtectRoleAccessCheck::access in User protect 8
Custom access check for the /user/%/roles.
This check will only occur when role_delegation is enabled.
Parameters
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
\Drupal\user\UserInterface $user: The user we are editing.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
File
- src/
Access/ UserProtectRoleAccessCheck.php, line 30
Class
- UserProtectRoleAccessCheck
- Class UserProtectRoleAccessCheck.
Namespace
Drupal\userprotect\AccessCode
public function access(AccountInterface $account, UserInterface $user) {
$access_result = $user
->access('user_roles', $account) ? AccessResult::allowed() : AccessResult::forbidden();
return $access_result
->cachePerUser()
->addCacheableDependency($user);
}