Go to the documentation of this file.
35 parent::__construct(
'Listgrouprights' );
47 $out->addModuleStyles(
'mediawiki.special' );
49 $out->wrapWikiMsg(
"<div class=\"mw-listgrouprights-key\">\n$1\n</div>",
'listgrouprights-key' );
52 Xml::openElement(
'table', [
'class' =>
'wikitable mw-listgrouprights-table' ] ) .
60 $groupPermissions = $config->get(
'GroupPermissions' );
61 $revokePermissions = $config->get(
'RevokePermissions' );
62 $addGroups = $config->get(
'AddGroups' );
63 $removeGroups = $config->get(
'RemoveGroups' );
64 $groupsAddToSelf = $config->get(
'GroupsAddToSelf' );
65 $groupsRemoveFromSelf = $config->get(
'GroupsRemoveFromSelf' );
66 $allGroups = array_unique( array_merge(
67 array_keys( $groupPermissions ),
68 array_keys( $revokePermissions ),
69 array_keys( $addGroups ),
70 array_keys( $removeGroups ),
71 array_keys( $groupsAddToSelf ),
72 array_keys( $groupsRemoveFromSelf )
78 foreach ( $allGroups
as $group ) {
79 $permissions = $groupPermissions[$group] ?? [];
80 $groupname = ( $group ==
'*' )
89 if ( $group ==
'*' || !$grouppageLocalizedTitle ) {
91 $grouppage = htmlspecialchars( $groupnameLocalized );
94 $grouppageLocalizedTitle,
99 if ( $group ===
'user' ) {
103 $this->
msg(
'listgrouprights-members' )->
text()
105 } elseif ( !in_array( $group, $config->get(
'ImplicitGroups' ) ) ) {
108 $this->
msg(
'listgrouprights-members' )->
text(),
110 [
'group' => $group ]
117 $revoke = $revokePermissions[$group] ?? [];
118 $addgroups = $addGroups[$group] ?? [];
119 $removegroups = $removeGroups[$group] ?? [];
120 $addgroupsSelf = $groupsAddToSelf[$group] ?? [];
121 $removegroupsSelf = $groupsRemoveFromSelf[$group] ?? [];
123 $id = $group ==
'*' ?
false : Sanitizer::escapeIdForAttribute( $group );
125 <td>$grouppage$grouplink</td>
128 $addgroupsSelf, $removegroupsSelf ) .
139 $namespaceProtection = $this->
getConfig()->get(
'NamespaceProtection' );
141 if (
count( $namespaceProtection ) == 0 ) {
145 $header = $this->
msg(
'listgrouprights-namespaceprotection-header' )->text();
148 'class' =>
'mw-headline',
149 'id' => substr( Parser::guessSectionNameFromStrippedText(
$header ), 1 )
155 $this->
msg(
'listgrouprights-namespaceprotection-namespace' )->
text()
160 $this->
msg(
'listgrouprights-namespaceprotection-restrictedto' )->
text()
164 ksort( $namespaceProtection );
166 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
167 foreach ( $namespaceProtection
as $namespace => $rights ) {
168 if ( !in_array( $namespace, $validNamespaces ) ) {
173 $namespaceText = $this->
msg(
'blanknamespace' )->text();
175 $namespaceText = $contLang->convertNamespace( $namespace );
187 [
'namespace' => $namespace ]
193 if ( !is_array( $rights ) ) {
194 $rights = [ $rights ];
197 foreach ( $rights
as $right ) {
200 'listgrouprights-right-display',
204 [
'class' =>
'mw-listgrouprights-right-name' ],
231 private function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) {
233 foreach ( $permissions
as $permission => $granted ) {
235 if ( $granted && ( !isset( $revoke[$permission] ) || !$revoke[$permission] ) ) {
236 $r[] = $this->
msg(
'listgrouprights-right-display',
238 '<span class="mw-listgrouprights-right-name">' . $permission .
'</span>'
242 foreach ( $revoke
as $permission => $revoked ) {
244 $r[] = $this->
msg(
'listgrouprights-right-revoked',
246 '<span class="mw-listgrouprights-right-name">' . $permission .
'</span>'
258 'removegroup' => $remove,
259 'addgroup-self' => $addSelf,
260 'removegroup-self' => $removeSelf
263 foreach ( $changeGroups
as $messageKey => $changeGroup ) {
264 if ( $changeGroup ===
true ) {
267 $r[] = $this->
msg(
'listgrouprights-' . $messageKey .
'-all' )->escaped();
268 } elseif ( is_array( $changeGroup ) ) {
269 $changeGroup = array_intersect( array_values( array_unique( $changeGroup ) ), $allGroups );
270 if (
count( $changeGroup ) ) {
272 foreach ( $changeGroup
as $group ) {
277 $r[] = $this->
msg(
'listgrouprights-' . $messageKey,
278 $lang->listToText( $groupLinks ),
count( $changeGroup ) )->parse();
286 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
static getGroupName( $group)
Gets the localized friendly name for a group, if it exists.
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 getGroupPage( $group)
Gets the title of a page describing a particular user group.
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.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getContext()
Gets the context this SpecialPage is executed in.
Parent class for all special pages.
static getAllGroups()
Return the set of defined explicit groups.
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
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()).
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 MediaWikiServices
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 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