You are here

function _user_configuration_get_permissions in Configuration Management 7

Represent the current state of permissions as a perm to role name array map.

2 calls to _user_configuration_get_permissions()
user_permission_configuration_export_render in includes/configuration.user.inc
Implements hook_configuration_export_render().
user_permission_configuration_rebuild in includes/configuration.user.inc
Implements hook_configuration_rebuild(). Iterate through default permissions and update the permissions map.

File

includes/configuration.user.inc, line 256

Code

function _user_configuration_get_permissions($by_role = TRUE) {
  $map = user_permission_get_modules();
  $roles = _user_configuration_get_roles();
  $permissions = array();
  foreach (user_role_permissions($roles) as $rid => $role_permissions) {
    if ($by_role) {
      foreach (array_keys(array_filter($role_permissions)) as $permission) {
        if (isset($map[$permission])) {
          $permissions[$permission][] = $roles[$rid];
        }
      }
    }
    else {
      $permissions[$roles[$rid]] = array();
      foreach ($role_permissions as $permission => $status) {
        if (isset($map[$permission])) {
          $permissions[$roles[$rid]][$permission] = $status;
        }
      }
    }
  }
  return $permissions;
}