r33067 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33066‎ | r33067 | r33068 >
Date:10:10, 10 April 2008
Author:raymond
Status:old
Tags:
Comment:
* (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
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/SpecialListgrouprights.php (added) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)
  • /trunk/phase3/skins/common/shared.css (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1208,6 +1208,13 @@
12091209 'listusers-submit',
12101210 'listusers-noresult',
12111211 ),
 1212+ 'listgrouprights' => array(
 1213+ 'listgrouprights',
 1214+ 'listgrouprights-summary',
 1215+ 'listgrouprights-group',
 1216+ 'listgrouprights-rights',
 1217+ 'listgrouprights-link',
 1218+ ),
12121219 'emailuser' => array(
12131220 'mailnologin',
12141221 'mailnologintext',
@@ -2513,6 +2520,7 @@
25142521 'logpages' => 'Special:Log',
25152522 'allpages' => 'Special:Allpages',
25162523 'listusers' => 'Special:Listusers',
 2524+ 'listgrouprights' => 'Special:Listgrouprights',
25172525 'emailuser' => 'E-mail user',
25182526 'watchlist' => 'Watchlist',
25192527 'watching' => 'Displayed when you click the "watch" button and it is in the process of watching',
Index: trunk/phase3/skins/common/shared.css
@@ -122,3 +122,17 @@
123123 background-color: #f9f9f9;
124124 border: 1px dashed #aaa;
125125 }
 126+
 127+table.mw-listgrouprights-table {
 128+ border: 1px solid #ccc;
 129+ border-collapse: collapse;
 130+}
 131+
 132+table.mw-listgrouprights-table tr {
 133+ vertical-align: top;
 134+}
 135+
 136+table.mw-listgrouprights-table td, table.mw-listgrouprights-table th {
 137+ padding: 0.5em 0.2em 0.5em 0.2em;
 138+ border: 1px solid #ccc;
 139+}
Index: trunk/phase3/includes/SpecialListgrouprights.php
@@ -0,0 +1,83 @@
 2+<?php
 3+
 4+/**
 5+ * This special page lists all defined user groups and the associated rights.
 6+ * See also @ref $wgGroupPermissions.
 7+ *
 8+ * @addtogroup SpecialPage
 9+ * @author Petr Kadlec <mormegil@centrum.cz>
 10+ */
 11+class SpecialListGroupRights extends SpecialPage {
 12+
 13+ var $skin;
 14+
 15+ /**
 16+ * Constructor
 17+ */
 18+ function __construct() {
 19+ global $wgUser;
 20+ parent::__construct( 'Listgrouprights' );
 21+ $this->skin = $wgUser->getSkin();
 22+ }
 23+
 24+ /**
 25+ * Show the special page
 26+ */
 27+ public function execute( $par ) {
 28+ global $wgOut, $wgGroupPermissions, $wgImplicitGroups;
 29+
 30+ $this->setHeaders();
 31+ $this->outputHeader();
 32+
 33+ $wgOut->addHTML(
 34+ Xml::openElement( 'table', array( 'class' => 'mw-listgrouprights-table' ) ) .
 35+ '<tr>' .
 36+ Xml::element( 'th', null, wfMsg( 'listgrouprights-group' ) ) .
 37+ Xml::element( 'th', null, wfMsg( 'listgrouprights-rights' ) ) .
 38+ '</tr>'
 39+ );
 40+
 41+ foreach( $wgGroupPermissions as $group => $permissions ) {
 42+ $groupname = htmlspecialchars( $group );
 43+ if ( in_array( $group, $wgImplicitGroups ) )
 44+ $grouplink = $groupname;
 45+ else
 46+ $grouplink = $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Listusers' ), $groupname, 'group=' . $group );
 47+
 48+ $wgOut->addHTML(
 49+ '<tr>
 50+ <td>' .
 51+ $grouplink .
 52+ '</td>
 53+ <td>' .
 54+ SpecialListGroupRights::formatPermissions( $permissions ) .
 55+ '</td>
 56+ </tr>'
 57+ );
 58+ }
 59+ $wgOut->addHTML(
 60+ Xml::closeElement( 'table' ) . "\n"
 61+ );
 62+ }
 63+
 64+ /**
 65+ * Create a user-readable list of permissions from the given array.
 66+ *
 67+ * @param $permissions Array of permission => bool (from $wgGroupPermissions items)
 68+ * @return string List of all granted permissions, separated by comma separator
 69+ */
 70+ private static function formatPermissions( $permissions ) {
 71+ global $wgUser;
 72+ $r = array();
 73+ foreach( $permissions as $permission => $granted ) {
 74+ if ( $granted ) {
 75+ $permission = htmlspecialchars( $permission );
 76+ $r[] = wfMsgExt( 'listgrouprights-link', array( 'parseinline' ), $permission );
 77+ }
 78+ }
 79+ sort( $r );
 80+ $r = implode( wfMsg( 'comma-separator' ), $r );
 81+
 82+ return $r;
 83+ }
 84+}
Property changes on: trunk/phase3/includes/SpecialListgrouprights.php
___________________________________________________________________
Name: svn:eol-style
185 + native
Index: trunk/phase3/includes/AutoLoader.php
@@ -234,6 +234,7 @@
235235 'SkinTemplate' => 'includes/SkinTemplate.php',
236236 'SpecialAllpages' => 'includes/SpecialAllpages.php',
237237 'SpecialBookSources' => 'includes/SpecialBooksources.php',
 238+ 'SpecialListGroupRights' => 'includes/SpecialListgrouprights.php',
238239 'SpecialMostlinkedtemplates' => 'includes/SpecialMostlinkedtemplates.php',
239240 'SpecialPage' => 'includes/SpecialPage.php',
240241 'SpecialPrefixindex' => 'includes/SpecialPrefixindex.php',
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1342,7 +1342,7 @@
13431343 * to ensure that client-side caches don't keep obsolete copies of global
13441344 * styles.
13451345 */
1346 -$wgStyleVersion = '132';
 1346+$wgStyleVersion = '133';
13471347
13481348
13491349 # Server-side caching:
Index: trunk/phase3/includes/SpecialPage.php
@@ -85,6 +85,7 @@
8686 'Imagelist' => array( 'SpecialPage', 'Imagelist' ),
8787 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ),
8888 'Listusers' => array( 'SpecialPage', 'Listusers' ),
 89+ 'Listgrouprights' => 'SpecialListGroupRights',
8990 'Statistics' => array( 'SpecialPage', 'Statistics' ),
9091 'Randompage' => 'Randompage',
9192 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -363,6 +363,7 @@
364364 'Imagelist' => array( 'ImageList' ),
365365 'Newimages' => array( 'NewImages' ),
366366 'Listusers' => array( 'ListUsers', 'UserList' ),
 367+ 'Listgrouprights' => array( 'ListGroupRights' ),
367368 'Statistics' => array( 'Statistics' ),
368369 'Randompage' => array( 'Random', 'RandomPage' ),
369370 'Lonelypages' => array( 'LonelyPages', 'OrphanedPages' ),
@@ -1876,6 +1877,13 @@
18771878 'listusers-submit' => 'Show',
18781879 'listusers-noresult' => 'No user found.',
18791880
 1881+# Special:Listgrouprights
 1882+'listgrouprights' => 'User group rights',
 1883+'listgrouprights-summary' => 'The following is a list of user groups defined on this wiki, with their associated access rights.',
 1884+'listgrouprights-group' => 'Group',
 1885+'listgrouprights-rights' => 'Rights',
 1886+'listgrouprights-link' => "[[{{ns:help}}:Group rights#$1|$1]]",
 1887+
18801888 # E-mail user
18811889 'mailnologin' => 'No send address',
18821890 '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.',
Index: trunk/phase3/RELEASE-NOTES
@@ -64,8 +64,8 @@
6565 * Redesign of Special:Userrights
6666 * Make rev_deleted log entries more intelligible.
6767 * (bug 6943) Added PAGESINCATEGORY: magic word
 68+* (bug 13604) Added Special:ListGroupRights
6869
69 -
7070 === Bug fixes in 1.13 ===
7171
7272 * (bug 10677) Add link to the file description page on the shared repository

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r32740(bug 13603) Added siprop=usergroups to meta=siteinfo. Patch by Mormegilcatrope14:33, 3 April 2008

Status & tagging log