1 user.install user_update_1013()

Grant accounts with 'administer permissions' the new 'assign roles' permission.

Related topics

File

core/modules/user/user.install, line 1146
Install, update and uninstall functions for the user module.

Code

function user_update_1013() {
  $names = config_get_names_with_prefix('user.role.');
  foreach ($names as $config_name) {
    $config = config($config_name);
    $permissions = $config->get('permissions');
    if (in_array('administer permissions', $permissions)) {
      $permissions[] = 'assign roles';
      $config->set('permissions', $permissions);
      $config->save();
    }
  }
}