function user_post_update_sort_permissions_again

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

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();
  });
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.