46 $res[$grant] = array_keys( array_filter( $rights ) );
67 if (
$lang !==
null ) {
68 if ( is_string(
$lang ) ) {
71 $msg->inLanguage(
$lang );
73 if ( !$msg->exists() ) {
74 $msg =
wfMessage(
'grant-generic', $grant );
76 $msg->inLanguage(
$lang );
94 foreach ( $grants as $grant ) {
109 foreach ( (array)$grants as $grant ) {
111 $rights = array_merge( $rights, array_keys( array_filter(
$wgGrantPermissions[$grant] ) ) );
114 return array_unique( $rights );
123 return array_diff( $grants, self::getValidGrants() ) === [];
134 if ( is_array( $grantsFilter ) ) {
135 $grantsFilter = array_flip( $grantsFilter );
140 if ( $grantsFilter !==
null && !isset( $grantsFilter[$grant] ) ) {
146 $groups[
'other'][] = $grant;
162 if ( $group ===
'hidden' ) {
180 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
181 return $linkRenderer->makeKnownLink(
182 \SpecialPage::getTitleFor(
'Listgrants',
false, $grant ),
183 self::grantName( $grant,
$lang )
194 if ( is_string(
$lang ) ) {
196 } elseif (
$lang ===
null ) {
197 $lang = MediaWikiServices::getInstance()->getContentLanguage();
201 foreach ( self::getGrantGroups( $grantsFilter ) as $group => $grants ) {
202 if ( $group ===
'hidden' ) {
205 $s .=
"*<span class=\"mw-grantgroup\">" .
206 wfMessage(
"grant-group-$group" )->inLanguage(
$lang )->text() .
"</span>\n";
207 $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.
if(!isset( $args[0])) $lang