function _pm_permission_migrate_get_all_roles_having_permission in Drupal PM (Project Management) 7.3
Same name and namespace in other branches
- 8 includes/pm.permission.migrate.inc \_pm_permission_migrate_get_all_roles_having_permission()
Gets a list of all roles which have been given a particular permission.
1 call to _pm_permission_migrate_get_all_roles_having_permission()
- pm_permission_migrate_legacy_permissions in includes/
pm.permission.migrate.inc - Handles migration of legacy permissions for a given sub-module.
File
- includes/
pm.permission.migrate.inc, line 241 - Migration functions for the PM Permission module.
Code
function _pm_permission_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;
}