function help_post_update_add_permissions_to_roles

Grant all admin roles the 'access help pages' permission.

File

core/modules/help/help.post_update.php, line 104

Code

function help_post_update_add_permissions_to_roles(?array &$sandbox = []) : void {
  \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'user_role', function (RoleInterface $role) : bool {
    if ($role->isAdmin() || !$role->hasPermission('access administration pages')) {
      return FALSE;
    }
    $role->grantPermission('access help pages');
    return TRUE;
  });
}

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