1.20.x file.install | file_update_1002() |
Switch the 'edit files' permission to 'manage files'.
File
- modules/
file/ file.install, line 749 - Install, update and uninstall functions for File module.
Code
function file_update_1002() {
$roles = user_roles(FALSE, 'edit files');
foreach ($roles as $role_name => $role_label) {
$config = config('user.role.' . $role_name);
$permissions = $config->get('permissions');
if ($key = array_search('edit files', $permissions)) {
// Add the new permission.
$permissions[] = 'manage files';
// Remove the old permission.
unset($permissions[$key]);
// Save the role.
$config->set('permissions', $permissions);
$config->save();
}
}
}