user_role_permissions

user_role_permissions(array $roles)

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.

File

core/modules/user/user.module, line 319
Enables the user registration and login system.

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 = array();
  foreach ($roles as $rid) {
    $role_permissions[$rid] = isset($entities[$rid]) ? $entities[$rid]->getPermissions() : array();
  }
  return $role_permissions;
}
doc_Drupal
2016-10-29 09:53:20
Comments
Leave a Comment

Please login to continue.