public function CasUserAccessCheck::access in CAS 8
Same name and namespace in other branches
- 2.x src/Access/CasUserAccessCheck.php \Drupal\cas\Access\CasUserAccessCheck::access()
Checks the access to routes tagged with '_cas_user_access'.
If the current user account is linked to a CAS account and the setting 'restrict_password_management' is TRUE, deny the access.
Parameters
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
Return value
\Drupal\Core\Access\AccessResultInterface The access result object.
File
- src/
Access/ CasUserAccessCheck.php, line 55
Class
- CasUserAccessCheck
- Defines an access checker that restricts CAS users for certain routes.
Namespace
Drupal\cas\AccessCode
public function access(AccountInterface $account) {
if (!$this->settings
->get('user_accounts.restrict_password_management') || $account
->isAnonymous() || !$this->casUserManager
->getCasUsernameForAccount($account
->id())) {
return AccessResult::allowed();
}
return AccessResult::forbidden("Is logged in CAS user and 'restrict_password_management' is TRUE");
}