function user_role_permissions
Same name in other branches
- 7.x modules/user/user.module \user_role_permissions()
- 8.9.x core/modules/user/user.module \user_role_permissions()
- 10 core/modules/user/user.module \user_role_permissions()
Determine the permissions for one or more roles.
Parameters
array $roles: An array of role IDs.
Return value
array An array indexed by role ID. Each value is an array of permission strings for the given role.
1 call to user_role_permissions()
- PermissionsHashGenerator::doGenerate in core/
lib/ Drupal/ Core/ Session/ PermissionsHashGenerator.php - Generates a hash that uniquely identifies the user's permissions.
1 string reference to 'user_role_permissions'
- PermissionsHashGeneratorTest.php in core/
tests/ Drupal/ Tests/ Core/ Session/ PermissionsHashGeneratorTest.php
File
-
core/
modules/ user/ user.module, line 250
Code
function user_role_permissions(array $roles) {
if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
return _user_role_permissions_update($roles);
}
$entities = Role::loadMultiple($roles);
$role_permissions = [];
foreach ($roles as $rid) {
$role_permissions[$rid] = isset($entities[$rid]) ? $entities[$rid]->getPermissions() : [];
}
return $role_permissions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.