function administerusersbyrole_user_role_access in Administer Users by Role 8.2
Same name and namespace in other branches
- 8.3 administerusersbyrole.module \administerusersbyrole_user_role_access()
Implements hook_ENTITY_TYPE_access() for entity type "user_role".
Parameters
\Drupal\User\RoleInterface $role: The role object to check access for.
string $operation: The operation that is to be performed on $entity.:
\Drupal\Core\Session\AccountInterface $account: The account trying to access the entity.:
File
- ./
administerusersbyrole.module, line 31
Code
function administerusersbyrole_user_role_access(RoleInterface $role, $operation, AccountInterface $account) {
// Allow users without the permission "administer permissions" to view the
// role names in the /admin/people view.
if ($operation == 'view') {
return AccessResult::allowedIfHasPermission($account, 'access users overview');
}
return AccessResult::neutral();
}