You are here

function _pmpermission_migrate_get_all_roles_having_permission in Drupal PM (Project Management) 7.2

Gets a list of all roles which have been given a particular permission.

1 call to _pmpermission_migrate_get_all_roles_having_permission()
pmpermission_migrate_legacy_permissions in pmpermission/includes/pmpermission.migrate.inc
Handles migration of legacy permissions for a given sub-module.

File

pmpermission/includes/pmpermission.migrate.inc, line 241
Migration functions for the PM Permission module.

Code

function _pmpermission_migrate_get_all_roles_having_permission($name) {
  $rids = array();
  $roles = user_roles();
  $permissions = user_role_permissions($roles);
  foreach ($roles as $rid => $role_name) {
    if (isset($permissions[$rid][$name])) {
      $rids[$rid] = $role_name;
    }
  }
  return $rids;
}