function user_permission_configuration_rebuild in Configuration Management 7
Implements hook_configuration_rebuild(). Iterate through default permissions and update the permissions map.
Parameters
$module: The module whose default user permissions should be rebuilt.
1 call to user_permission_configuration_rebuild()
- user_permission_configuration_revert in includes/
configuration.user.inc - Implements hook_configuration_revert().
File
- includes/
configuration.user.inc, line 116
Code
function user_permission_configuration_rebuild($identifiers, $module_name = 'configuration') {
if ($defaults = configuration_get_default('user_permission', $module_name)) {
// Make sure the list of available node types is up to date, especially when
// installing multiple configuration at once, for example from an install profile
// or via drush.
node_types_rebuild();
$roles = _user_configuration_get_roles();
$permissions_by_role = _user_configuration_get_permissions(FALSE);
foreach ($defaults as $permission) {
$perm = $permission['name'];
if (in_array($perm, $identifiers)) {
foreach ($roles as $role) {
if (in_array($role, $permission['roles']) || !empty($identifiers) && $identifiers[0] == '#import_all') {
$permissions_by_role[$role][$perm] = TRUE;
}
else {
$permissions_by_role[$role][$perm] = FALSE;
}
}
}
}
// Write the updated permissions.
foreach ($roles as $rid => $role) {
if (isset($permissions_by_role[$role])) {
user_role_change_permissions($rid, $permissions_by_role[$role]);
}
}
foreach ($identifiers as $identifier) {
configuration_check_user_permission($identifier);
}
cache_clear_all('config_export', 'cache');
}
}