public function OpenIDConnect::hasSetPasswordAccess in OpenID Connect / OAuth client 2.x
Same name and namespace in other branches
- 8 src/OpenIDConnect.php \Drupal\openid_connect\OpenIDConnect::hasSetPasswordAccess()
Find whether a user is allowed to change the own password.
Parameters
\Drupal\Core\Session\AccountInterface|null $account: Optional: Account to check the access for. Defaults to the currently logged-in user.
Return value
bool TRUE if access is granted, FALSE otherwise.
File
- src/
OpenIDConnect.php, line 491
Class
- OpenIDConnect
- Main service of the OpenID Connect module.
Namespace
Drupal\openid_connectCode
public function hasSetPasswordAccess(AccountInterface $account = NULL) : bool {
if (empty($account)) {
$account = $this->currentUser;
}
if ($account
->hasPermission('openid connect set own password')) {
return TRUE;
}
$connected_accounts = $this->authmap
->getAll($account
->id());
return empty($connected_accounts);
}