46 $res[$grant] = array_keys( array_filter( $rights ) );
67 if (
$lang !==
null ) {
68 if ( is_string(
$lang ) ) {
69 $lang = MediaWikiServices::getInstance()->getLanguageFactory()
70 ->getLanguage(
$lang );
72 $msg->inLanguage(
$lang );
74 if ( !$msg->exists() ) {
75 $msg =
wfMessage(
'grant-generic', $grant );
77 $msg->inLanguage(
$lang );
91 $lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage(
$lang );
95 foreach ( $grants as $grant ) {
110 foreach ( (array)$grants as $grant ) {
112 $rights = array_merge( $rights, array_keys( array_filter(
$wgGrantPermissions[$grant] ) ) );
115 return array_unique( $rights );
124 return array_diff( $grants, self::getValidGrants() ) === [];
135 if ( is_array( $grantsFilter ) ) {
136 $grantsFilter = array_flip( $grantsFilter );
141 if ( $grantsFilter !==
null && !isset( $grantsFilter[$grant] ) ) {
147 $groups[
'other'][] = $grant;
163 if ( $group ===
'hidden' ) {
181 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
182 return $linkRenderer->makeKnownLink(
184 self::grantName( $grant,
$lang )
195 if ( is_string(
$lang ) ) {
196 $lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage(
$lang );
197 } elseif (
$lang ===
null ) {
198 $lang = MediaWikiServices::getInstance()->getContentLanguage();
202 foreach ( self::getGrantGroups( $grantsFilter ) as $group => $grants ) {
203 if ( $group ===
'hidden' ) {
206 $s .=
"*<span class=\"mw-grantgroup\">" .
207 wfMessage(
"grant-group-$group" )->inLanguage(
$lang )->text() .
"</span>\n";
208 $s .=
":" .
$lang->semicolonList( self::grantNames( $grants,
$lang ) ) .
"\n";
array $wgGrantPermissions
Map of (grant => right => boolean) Users authorize consumers (like Apps) to act on their behalf but o...
array $wgGrantPermissionGroups
Map of grants to their UI grouping.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
A collection of public static functions to deal with grants.
static getGrantsWikiText( $grantsFilter, $lang=null)
Generate wikitext to display a list of grants.
static grantName( $grant, $lang=null)
Fetch the display name of the grant.
static getHiddenGrants()
Get the list of grants that are hidden and should always be granted.
static grantNames(array $grants, $lang=null)
Fetch the display names for the grants.
static getGrantsLink( $grant, $lang=null)
Generate a link to Special:ListGrants for a particular grant name.
static getRightsByGrant()
Map all grants to corresponding user rights.
static grantsAreValid(array $grants)
Test that all grants in the list are known.
static getGrantRights( $grants)
Fetch the rights allowed by a set of grants.
static getGrantGroups( $grantsFilter=null)
Divide the grants into groups.
static getValidGrants()
List all known grants.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
if(!isset( $args[0])) $lang