X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fexception%2FPermissionsError.php;h=87a3dc2819cde136dbbe9d345cf54c734761d1d2;hb=529143e4aa1bf708bb749857c2e03358ee67fe65;hp=e31374c2c7e470bfa6be63f71546f7e242667b50;hpb=7874fc4bec845ad92960b07e969c65f3c3fe74f2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/exception/PermissionsError.php b/includes/exception/PermissionsError.php index e31374c2c7..87a3dc2819 100644 --- a/includes/exception/PermissionsError.php +++ b/includes/exception/PermissionsError.php @@ -18,6 +18,8 @@ * @file */ +use MediaWiki\MediaWikiServices; + /** * Show an error when a user tries to do something they do not have the necessary * permissions for. @@ -45,10 +47,12 @@ class PermissionsError extends ErrorPageError { $this->permission = $permission; if ( !count( $errors ) ) { - $groups = array_map( - [ 'User', 'makeGroupLinkWiki' ], - User::getGroupsWithPermission( $this->permission ) - ); + $groups = []; + foreach ( MediaWikiServices::getInstance() + ->getPermissionManager() + ->getGroupsWithPermission( $this->permission ) as $group ) { + $groups[] = UserGroupMembership::getLink( $group, RequestContext::getMain(), 'wiki' ); + } if ( $groups ) { $errors[] = [ 'badaccess-groups', $wgLang->commaList( $groups ), count( $groups ) ]; @@ -58,6 +62,9 @@ class PermissionsError extends ErrorPageError { } $this->errors = $errors; + + // Give the parent class something to work with + parent::__construct( 'permissionserrors', Message::newFromSpecifier( $errors[0] ) ); } public function report() {