Page MenuHomePhabricator

SpecialListGroupRights-v2.diff

Authored By
bzimport
Nov 21 2014, 10:04 PM
Size
8 KB
Referenced Files
None
Subscribers
None

SpecialListGroupRights-v2.diff

Index: includes/AutoLoader.php
===================================================================
--- includes/AutoLoader.php (revision 32768)
+++ includes/AutoLoader.php (working copy)
@@ -234,6 +234,7 @@
'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',
Index: includes/DefaultSettings.php
===================================================================
--- includes/DefaultSettings.php (revision 32768)
+++ includes/DefaultSettings.php (working copy)
@@ -1331,7 +1331,7 @@
* to ensure that client-side caches don't keep obsolete copies of global
* styles.
*/
-$wgStyleVersion = '129';
+$wgStyleVersion = '130';
# Server-side caching:
Index: includes/SpecialListgrouprights.php
===================================================================
--- includes/SpecialListgrouprights.php (revision 0)
+++ includes/SpecialListgrouprights.php (revision 0)
@@ -0,0 +1,84 @@
+<?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;
+ $sep = wfMsg( 'comma-separator' );
+ $r = array();
+ foreach( $permissions as $permission => $granted ) {
+ if ( $granted ) {
+ $permission = htmlspecialchars( $permission );
+ $r[] = $wgUser->getSkin()->makeLink( wfMsg( 'listgrouprights-link', $permission ), $permission );
+ }
+ }
+ sort( $r );
+ $r = implode( $sep, $r );
+
+ return $r;
+ }
+}
Property changes on: includes\SpecialListgrouprights.php
___________________________________________________________________
Name: svn:eol-style
+ native
Index: includes/SpecialPage.php
===================================================================
--- includes/SpecialPage.php (revision 32768)
+++ includes/SpecialPage.php (working copy)
@@ -85,6 +85,7 @@
'Imagelist' => array( 'SpecialPage', 'Imagelist' ),
'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ),
'Listusers' => array( 'SpecialPage', 'Listusers' ),
+ 'Listgrouprights' => 'SpecialListGroupRights',
'Statistics' => array( 'SpecialPage', 'Statistics' ),
'Randompage' => 'Randompage',
'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 32768)
+++ languages/messages/MessagesEn.php (working copy)
@@ -362,6 +362,7 @@
'Imagelist' => array( 'ImageList' ),
'Newimages' => array( 'NewImages' ),
'Listusers' => array( 'ListUsers', 'UserList' ),
+ 'Listgrouprights' => array( 'ListGroupRights' ),
'Statistics' => array( 'Statistics' ),
'Randompage' => array( 'Random', 'RandomPage' ),
'Lonelypages' => array( 'LonelyPages', 'OrphanedPages' ),
@@ -1862,6 +1863,14 @@
'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}}:$1', # only translate this message to other languages if you have to change it
+
+
# 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.',
Index: maintenance/language/messages.inc
===================================================================
--- maintenance/language/messages.inc (revision 32768)
+++ maintenance/language/messages.inc (working copy)
@@ -1196,6 +1196,13 @@
'listusers-submit',
'listusers-noresult',
),
+ 'listgrouprights' => array(
+ 'listgrouprights',
+ 'listgrouprights-summary',
+ 'listgrouprights-group',
+ 'listgrouprights-rights',
+ 'listgrouprights-link',
+ ),
'emailuser' => array(
'mailnologin',
'mailnologintext',
@@ -2501,6 +2508,7 @@
'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',
Index: maintenance/language/messageTypes.inc
===================================================================
--- maintenance/language/messageTypes.inc (revision 32768)
+++ maintenance/language/messageTypes.inc (working copy)
@@ -280,6 +280,7 @@
'comma-separator',
'colon-separator',
'autocomment-prefix',
+ 'listgrouprights-link',
);
/** EXIF messages, which may be set as optional in several checks, but are generally mandatory */
Index: RELEASE-NOTES
===================================================================
--- RELEASE-NOTES (revision 32768)
+++ RELEASE-NOTES (working copy)
@@ -62,6 +62,7 @@
* (bug 13450) Email confirmation can now be canceled before the expiration
* (bug 13490) Show upload/file size limit on upload form
* Redesign of Special:Userrights
+* (bug 13604) Special page to list the grouprights
=== Bug fixes in 1.13 ===
Index: skins/common/shared.css
===================================================================
--- skins/common/shared.css (revision 32768)
+++ skins/common/shared.css (working copy)
@@ -105,7 +105,21 @@
color: #888;
}
+table.mw-listgrouprights-table {
+ border:1px solid #ccc;
+ border-collapse:collapse;
+}
+
table.mw-userrights-groups * td,table.mw-userrights-groups * th {
padding-right: 1.5em;
}
+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;
+}
+

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4242
Default Alt Text
SpecialListGroupRights-v2.diff (8 KB)

Event Timeline