Same name and namespace in other branches
  1. 9 core/modules/user/user.post_update.php \user_post_update_sort_permissions_again()

Ensure permissions stored in role configuration are sorted using the schema.

File

core/modules/user/user.post_update.php, line 30
Post update functions for User module.

Code

function user_post_update_sort_permissions_again(&$sandbox = NULL) {
  \Drupal::classResolver(ConfigEntityUpdater::class)
    ->update($sandbox, 'user_role', function (Role $role) {
    $permissions = $role
      ->getPermissions();
    sort($permissions);
    return $permissions !== $role
      ->getPermissions();
  });
}