* (bug 13604) Add Special:ListGroupRights to show a list of defined usergroups and the rights for these groups.
See bug 13603 for the same function added to the API last week Patch by Mormegil
This commit is contained in:
parent
7f52b43aa8
commit
6d1f1f8d70
8 changed files with 117 additions and 2 deletions
|
|
@ -64,7 +64,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
|||
* Redesign of Special:Userrights
|
||||
* Make rev_deleted log entries more intelligible.
|
||||
* (bug 6943) Added PAGESINCATEGORY: magic word
|
||||
|
||||
* (bug 13604) Added Special:ListGroupRights
|
||||
|
||||
=== Bug fixes in 1.13 ===
|
||||
|
||||
|
|
|
|||
|
|
@ -234,6 +234,7 @@ function __autoload($className) {
|
|||
'SkinTemplate' => 'includes/SkinTemplate.php',
|
||||
'SpecialAllpages' => 'includes/SpecialAllpages.php',
|
||||
'SpecialBookSources' => 'includes/SpecialBooksources.php',
|
||||
'SpecialListGroupRights' => 'includes/SpecialListgrouprights.php',
|
||||
'SpecialMostlinkedtemplates' => 'includes/SpecialMostlinkedtemplates.php',
|
||||
'SpecialPage' => 'includes/SpecialPage.php',
|
||||
'SpecialPrefixindex' => 'includes/SpecialPrefixindex.php',
|
||||
|
|
|
|||
|
|
@ -1342,7 +1342,7 @@ $wgCacheEpoch = '20030516000000';
|
|||
* to ensure that client-side caches don't keep obsolete copies of global
|
||||
* styles.
|
||||
*/
|
||||
$wgStyleVersion = '132';
|
||||
$wgStyleVersion = '133';
|
||||
|
||||
|
||||
# Server-side caching:
|
||||
|
|
|
|||
83
includes/SpecialListgrouprights.php
Normal file
83
includes/SpecialListgrouprights.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This special page lists all defined user groups and the associated rights.
|
||||
* See also @ref $wgGroupPermissions.
|
||||
*
|
||||
* @addtogroup SpecialPage
|
||||
* @author Petr Kadlec <mormegil@centrum.cz>
|
||||
*/
|
||||
class SpecialListGroupRights extends SpecialPage {
|
||||
|
||||
var $skin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct() {
|
||||
global $wgUser;
|
||||
parent::__construct( 'Listgrouprights' );
|
||||
$this->skin = $wgUser->getSkin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the special page
|
||||
*/
|
||||
public function execute( $par ) {
|
||||
global $wgOut, $wgGroupPermissions, $wgImplicitGroups;
|
||||
|
||||
$this->setHeaders();
|
||||
$this->outputHeader();
|
||||
|
||||
$wgOut->addHTML(
|
||||
Xml::openElement( 'table', array( 'class' => 'mw-listgrouprights-table' ) ) .
|
||||
'<tr>' .
|
||||
Xml::element( 'th', null, wfMsg( 'listgrouprights-group' ) ) .
|
||||
Xml::element( 'th', null, wfMsg( 'listgrouprights-rights' ) ) .
|
||||
'</tr>'
|
||||
);
|
||||
|
||||
foreach( $wgGroupPermissions as $group => $permissions ) {
|
||||
$groupname = htmlspecialchars( $group );
|
||||
if ( in_array( $group, $wgImplicitGroups ) )
|
||||
$grouplink = $groupname;
|
||||
else
|
||||
$grouplink = $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Listusers' ), $groupname, 'group=' . $group );
|
||||
|
||||
$wgOut->addHTML(
|
||||
'<tr>
|
||||
<td>' .
|
||||
$grouplink .
|
||||
'</td>
|
||||
<td>' .
|
||||
SpecialListGroupRights::formatPermissions( $permissions ) .
|
||||
'</td>
|
||||
</tr>'
|
||||
);
|
||||
}
|
||||
$wgOut->addHTML(
|
||||
Xml::closeElement( 'table' ) . "\n"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a user-readable list of permissions from the given array.
|
||||
*
|
||||
* @param $permissions Array of permission => bool (from $wgGroupPermissions items)
|
||||
* @return string List of all granted permissions, separated by comma separator
|
||||
*/
|
||||
private static function formatPermissions( $permissions ) {
|
||||
global $wgUser;
|
||||
$r = array();
|
||||
foreach( $permissions as $permission => $granted ) {
|
||||
if ( $granted ) {
|
||||
$permission = htmlspecialchars( $permission );
|
||||
$r[] = wfMsgExt( 'listgrouprights-link', array( 'parseinline' ), $permission );
|
||||
}
|
||||
}
|
||||
sort( $r );
|
||||
$r = implode( wfMsg( 'comma-separator' ), $r );
|
||||
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
|
@ -85,6 +85,7 @@ class SpecialPage
|
|||
'Imagelist' => array( 'SpecialPage', 'Imagelist' ),
|
||||
'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ),
|
||||
'Listusers' => array( 'SpecialPage', 'Listusers' ),
|
||||
'Listgrouprights' => 'SpecialListGroupRights',
|
||||
'Statistics' => array( 'SpecialPage', 'Statistics' ),
|
||||
'Randompage' => 'Randompage',
|
||||
'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
|
||||
|
|
|
|||
|
|
@ -363,6 +363,7 @@ $specialPageAliases = array(
|
|||
'Imagelist' => array( 'ImageList' ),
|
||||
'Newimages' => array( 'NewImages' ),
|
||||
'Listusers' => array( 'ListUsers', 'UserList' ),
|
||||
'Listgrouprights' => array( 'ListGroupRights' ),
|
||||
'Statistics' => array( 'Statistics' ),
|
||||
'Randompage' => array( 'Random', 'RandomPage' ),
|
||||
'Lonelypages' => array( 'LonelyPages', 'OrphanedPages' ),
|
||||
|
|
@ -1876,6 +1877,13 @@ It may contain one or more characters which cannot be used in titles.',
|
|||
'listusers-submit' => 'Show',
|
||||
'listusers-noresult' => 'No user found.',
|
||||
|
||||
# Special:Listgrouprights
|
||||
'listgrouprights' => 'User group rights',
|
||||
'listgrouprights-summary' => 'The following is a list of user groups defined on this wiki, with their associated access rights.',
|
||||
'listgrouprights-group' => 'Group',
|
||||
'listgrouprights-rights' => 'Rights',
|
||||
'listgrouprights-link' => "[[{{ns:help}}:Group rights#$1|$1]]",
|
||||
|
||||
# E-mail user
|
||||
'mailnologin' => 'No send address',
|
||||
'mailnologintext' => 'You must be [[Special:Userlogin|logged in]] and have a valid e-mail address in your [[Special:Preferences|preferences]] to send e-mail to other users.',
|
||||
|
|
|
|||
|
|
@ -1208,6 +1208,13 @@ $wgMessageStructure = array(
|
|||
'listusers-submit',
|
||||
'listusers-noresult',
|
||||
),
|
||||
'listgrouprights' => array(
|
||||
'listgrouprights',
|
||||
'listgrouprights-summary',
|
||||
'listgrouprights-group',
|
||||
'listgrouprights-rights',
|
||||
'listgrouprights-link',
|
||||
),
|
||||
'emailuser' => array(
|
||||
'mailnologin',
|
||||
'mailnologintext',
|
||||
|
|
@ -2513,6 +2520,7 @@ XHTML id names.",
|
|||
'logpages' => 'Special:Log',
|
||||
'allpages' => 'Special:Allpages',
|
||||
'listusers' => 'Special:Listusers',
|
||||
'listgrouprights' => 'Special:Listgrouprights',
|
||||
'emailuser' => 'E-mail user',
|
||||
'watchlist' => 'Watchlist',
|
||||
'watching' => 'Displayed when you click the "watch" button and it is in the process of watching',
|
||||
|
|
|
|||
|
|
@ -122,3 +122,17 @@ table.mw-userrights-groups * td,table.mw-userrights-groups * th {
|
|||
background-color: #f9f9f9;
|
||||
border: 1px dashed #aaa;
|
||||
}
|
||||
|
||||
table.mw-listgrouprights-table {
|
||||
border: 1px solid #ccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.mw-listgrouprights-table tr {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.mw-listgrouprights-table td, table.mw-listgrouprights-table th {
|
||||
padding: 0.5em 0.2em 0.5em 0.2em;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue