Go to the documentation of this file.
33 parent::__construct(
'Listgrouprights' );
45 $out->addModuleStyles(
'mediawiki.special' );
47 $out->wrapWikiMsg(
"<div class=\"mw-listgrouprights-key\">\n$1\n</div>",
'listgrouprights-key' );
50 Xml::openElement(
'table', [
'class' =>
'wikitable mw-listgrouprights-table' ] ) .
58 $groupPermissions = $config->get(
'GroupPermissions' );
59 $revokePermissions = $config->get(
'RevokePermissions' );
60 $addGroups = $config->get(
'AddGroups' );
61 $removeGroups = $config->get(
'RemoveGroups' );
62 $groupsAddToSelf = $config->get(
'GroupsAddToSelf' );
63 $groupsRemoveFromSelf = $config->get(
'GroupsRemoveFromSelf' );
64 $allGroups = array_unique( array_merge(
65 array_keys( $groupPermissions ),
66 array_keys( $revokePermissions ),
67 array_keys( $addGroups ),
68 array_keys( $removeGroups ),
69 array_keys( $groupsAddToSelf ),
70 array_keys( $groupsRemoveFromSelf )
76 foreach ( $allGroups
as $group ) {
77 $permissions = isset( $groupPermissions[$group] )
78 ? $groupPermissions[$group]
80 $groupname = ( $group ==
'*' )
84 $msg = $this->
msg(
'group-' . $groupname );
85 $groupnameLocalized = !$msg->isBlank() ? $msg->text() : $groupname;
87 $msg = $this->
msg(
'grouppage-' . $groupname )->inContentLanguage();
88 $grouppageLocalized = !$msg->isBlank() ?
93 if ( $group ==
'*' || !$grouppageLocalizedTitle ) {
95 $grouppage = htmlspecialchars( $groupnameLocalized );
98 $grouppageLocalizedTitle,
103 if ( $group ===
'user' ) {
107 $this->
msg(
'listgrouprights-members' )->
text()
109 } elseif ( !in_array( $group, $config->get(
'ImplicitGroups' ) ) ) {
112 $this->
msg(
'listgrouprights-members' )->
text(),
114 [
'group' => $group ]
121 $revoke = isset( $revokePermissions[$group] ) ? $revokePermissions[$group] : [];
122 $addgroups = isset( $addGroups[$group] ) ? $addGroups[$group] : [];
123 $removegroups = isset( $removeGroups[$group] ) ? $removeGroups[$group] : [];
124 $addgroupsSelf = isset( $groupsAddToSelf[$group] ) ? $groupsAddToSelf[$group] : [];
125 $removegroupsSelf = isset( $groupsRemoveFromSelf[$group] )
126 ? $groupsRemoveFromSelf[$group]
129 $id = $group ==
'*' ?
false : Sanitizer::escapeIdForAttribute( $group );
131 <td>$grouppage$grouplink</td>
134 $addgroupsSelf, $removegroupsSelf ) .
146 $namespaceProtection = $this->
getConfig()->get(
'NamespaceProtection' );
148 if (
count( $namespaceProtection ) == 0 ) {
152 $header = $this->
msg(
'listgrouprights-namespaceprotection-header' )->parse();
155 'class' =>
'mw-headline',
156 'id' => $wgParser->guessSectionNameFromWikiText(
$header )
162 $this->
msg(
'listgrouprights-namespaceprotection-namespace' )->
text()
167 $this->
msg(
'listgrouprights-namespaceprotection-restrictedto' )->
text()
171 ksort( $namespaceProtection );
172 foreach ( $namespaceProtection
as $namespace => $rights ) {
178 $namespaceText = $this->
msg(
'blanknamespace' )->text();
180 $namespaceText =
$wgContLang->convertNamespace( $namespace );
192 [
'namespace' => $namespace ]
198 if ( !is_array( $rights ) ) {
199 $rights = [ $rights ];
202 foreach ( $rights
as $right ) {
205 'listgrouprights-right-display',
209 [
'class' =>
'mw-listgrouprights-right-name' ],
236 private function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) {
238 foreach ( $permissions
as $permission => $granted ) {
240 if ( $granted && ( !isset( $revoke[$permission] ) || !$revoke[$permission] ) ) {
241 $r[] = $this->
msg(
'listgrouprights-right-display',
243 '<span class="mw-listgrouprights-right-name">' . $permission .
'</span>'
247 foreach ( $revoke
as $permission => $revoked ) {
249 $r[] = $this->
msg(
'listgrouprights-right-revoked',
251 '<span class="mw-listgrouprights-right-name">' . $permission .
'</span>'
263 'removegroup' => $remove,
264 'addgroup-self' => $addSelf,
265 'removegroup-self' => $removeSelf
268 foreach ( $changeGroups
as $messageKey => $changeGroup ) {
269 if ( $changeGroup ===
true ) {
272 $r[] = $this->
msg(
'listgrouprights-' . $messageKey .
'-all' )->escaped();
273 } elseif ( is_array( $changeGroup ) ) {
274 $changeGroup = array_intersect( array_values( array_unique( $changeGroup ) ), $allGroups );
275 if (
count( $changeGroup ) ) {
277 foreach ( $changeGroup
as $group ) {
282 $r[] = $this->
msg(
'listgrouprights-' . $messageKey,
283 $lang->listToText( $groupLinks ),
count( $changeGroup ) )->parse();
291 return '<ul><li>' . implode(
"</li>\n<li>", $r ) .
'</li></ul>';
execute( $par)
Show the special page.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
msg( $key)
Wrapper around wfMessage that sets the current context.
processing should stop and the error should be shown to the user * false
static getValidNamespaces()
Returns an array of the namespaces (by integer id) that exist on the wiki.
getOutput()
Get the OutputPage being used for this instance.
if(!isset( $args[0])) $lang
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
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,...
outputNamespaceProtectionInfo()
getLanguage()
Shortcut to get user's language.
static openElement( $element, $attribs=null)
This opens an XML element.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
getConfig()
Shortcut to get main config object.
formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf)
Create a user-readable list of permissions from the given array.
static getLink( $ugm, IContextSource $context, $format, $userName=null)
Gets a link for a user group, possibly including the expiry date if relevant.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
when a variable name is used in a it is silently declared as a new masking the global
getContext()
Gets the context this SpecialPage is executed in.
Parent class for all special pages.
static getAllGroups()
Return the set of defined explicit groups.
static closeElement( $element)
Shortcut to close an XML element.
static getRightDescription( $right)
Get the description of a given right.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
This special page lists all defined user groups and the associated rights.
MediaWiki Linker LinkRenderer null $linkRenderer
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out