public function AccessManager::access in Administer Users by Role 8.3
Check access for the specified roles.
Parameters
array $roles: Roles of the user object to check access for.
string $operation: The operation that is to be performed on the user.
\Drupal\Core\Session\AccountInterface $account: The account trying to access the entity.
Return value
\Drupal\Core\Access\AccessResultInterface The access result. hook_entity_access() has detailed documentation.
Overrides AccessManagerInterface::access
File
- src/
Services/ AccessManager.php, line 107
Class
- AccessManager
- Access Manager.
Namespace
Drupal\administerusersbyrole\ServicesCode
public function access(array $roles, $operation, AccountInterface $account) {
if (!$this
->preAccess($operation, $account)) {
return AccessResult::neutral();
}
foreach ($roles as $rid) {
if (!$this
->roleAccess($operation, $account, $rid)) {
return AccessResult::neutral();
}
}
return AccessResult::allowed();
}