MediaWiki REL1_34
MWGrants Class Reference

A collection of public static functions to deal with grants. More...

Static Public Member Functions

static getGrantGroups ( $grantsFilter=null)
 Divide the grants into groups.
 
static getGrantRights ( $grants)
 Fetch the rights allowed by a set of grants.
 
static getGrantsLink ( $grant, $lang=null)
 Generate a link to Special:ListGrants for a particular grant name.
 
static getGrantsWikiText ( $grantsFilter, $lang=null)
 Generate wikitext to display a list of grants.
 
static getHiddenGrants ()
 Get the list of grants that are hidden and should always be granted.
 
static getRightsByGrant ()
 Map all grants to corresponding user rights.
 
static getValidGrants ()
 List all known grants.
 
static grantName ( $grant, $lang=null)
 Fetch the display name of the grant.
 
static grantNames (array $grants, $lang=null)
 Fetch the display names for the grants.
 
static grantsAreValid (array $grants)
 Test that all grants in the list are known.
 

Detailed Description

A collection of public static functions to deal with grants.

Definition at line 25 of file MWGrants.php.

Member Function Documentation

◆ getGrantGroups()

static MWGrants::getGrantGroups ( $grantsFilter = null)
static

Divide the grants into groups.

Parameters
string[] | null$grantsFilter
Returns
array Map of (group => (grant list))

Definition at line 131 of file MWGrants.php.

References $wgGrantPermissionGroups, and $wgGrantPermissions.

◆ getGrantRights()

static MWGrants::getGrantRights ( $grants)
static

Fetch the rights allowed by a set of grants.

Parameters
string[] | string$grants
Returns
string[]

Definition at line 105 of file MWGrants.php.

References $wgGrantPermissions.

Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().

◆ getGrantsLink()

static MWGrants::getGrantsLink ( $grant,
$lang = null )
static

Generate a link to Special:ListGrants for a particular grant name.

This should be used to link end users to a full description of what rights they are giving when they authorize a grant.

Parameters
string$grantthe grant name
Language | string | null$lang
Returns
string (proto-relative) HTML link

Definition at line 179 of file MWGrants.php.

References $lang.

◆ getGrantsWikiText()

static MWGrants::getGrantsWikiText ( $grantsFilter,
$lang = null )
static

Generate wikitext to display a list of grants.

Parameters
string[] | null$grantsFilterIf non-null, only display these grants.
Language | string | null$lang
Returns
string Wikitext

Definition at line 193 of file MWGrants.php.

References $lang, $s, and wfMessage().

◆ getHiddenGrants()

static MWGrants::getHiddenGrants ( )
static

Get the list of grants that are hidden and should always be granted.

Returns
string[]

Definition at line 157 of file MWGrants.php.

References $wgGrantPermissionGroups.

Referenced by SpecialBotPasswords\getFormFields(), and SpecialBotPasswords\save().

◆ getRightsByGrant()

static MWGrants::getRightsByGrant ( )
static

Map all grants to corresponding user rights.

Returns
array grant => array of rights

Definition at line 41 of file MWGrants.php.

References $res, and $wgGrantPermissions.

Referenced by SpecialBotPasswords\getFormFields().

◆ getValidGrants()

static MWGrants::getValidGrants ( )
static

List all known grants.

Returns
array

Definition at line 31 of file MWGrants.php.

References $wgGrantPermissions.

Referenced by SpecialBotPasswords\getFormFields().

◆ grantName()

static MWGrants::grantName ( $grant,
$lang = null )
static

Fetch the display name of the grant.

Parameters
string$grant
Language | string | null$lang
Returns
string Grant description

Definition at line 57 of file MWGrants.php.

References $lang, and wfMessage().

Referenced by grantNames().

◆ grantNames()

static MWGrants::grantNames ( array $grants,
$lang = null )
static

Fetch the display names for the grants.

Parameters
string[]$grants
Language | string | null$lang
Returns
string[] Corresponding grant descriptions

Definition at line 88 of file MWGrants.php.

References $lang, and grantName().

◆ grantsAreValid()

static MWGrants::grantsAreValid ( array $grants)
static

Test that all grants in the list are known.

Parameters
string[]$grants
Returns
bool

Definition at line 122 of file MWGrants.php.


The documentation for this class was generated from the following file: