Show $wgAddGroups and $wgRemoveGroups on Special:ListGroupRights
authorVictor Vasiliev <vasilievvv@users.mediawiki.org>
Sat, 2 Aug 2008 11:29:27 +0000 (11:29 +0000)
committerVictor Vasiliev <vasilievvv@users.mediawiki.org>
Sat, 2 Aug 2008 11:29:27 +0000 (11:29 +0000)
includes/specials/SpecialListgrouprights.php
languages/messages/MessagesEn.php

index 131c060..077c09e 100644 (file)
@@ -24,7 +24,8 @@ class SpecialListGroupRights extends SpecialPage {
         * Show the special page
         */
        public function execute( $par ) {
-               global $wgOut, $wgGroupPermissions, $wgImplicitGroups, $wgMessageCache;
+               global $wgOut, $wgImplicitGroups, $wgMessageCache;
+               global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups;
                $wgMessageCache->loadAllMessages();
 
                $this->setHeaders();
@@ -69,13 +70,16 @@ class SpecialListGroupRights extends SpecialPage {
                                $grouplink = '';
                        }
 
+                       $addgroups = isset( $wgAddGroups[$group] ) ? $wgAddGroups[$group] : array();
+                       $removegroups = isset( $wgRemoveGroups[$group] ) ? $wgRemoveGroups[$group] : array();
+
                        $wgOut->addHTML(
                                '<tr>
                                        <td>' .
                                                $grouppage . $grouplink .
                                        '</td>
                                        <td>' .
-                                               self::formatPermissions( $permissions ) .
+                                               self::formatPermissions( $permissions, $addgroups, $removegroups ) .
                                        '</td>
                                </tr>'
                        );
@@ -91,7 +95,8 @@ class SpecialListGroupRights extends SpecialPage {
         * @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 ) {
+        private static function formatPermissions( $permissions, $add, $remove ) {
+               global $wgLang;
                $r = array();
                foreach( $permissions as $permission => $granted ) {
                        if ( $granted ) {
@@ -103,6 +108,12 @@ class SpecialListGroupRights extends SpecialPage {
                        }
                }
                sort( $r );
+               if( $add ) {
+                       $r[] = wfMsgHTML( 'listgrouprights-addgroup', $wgLang->listToText( $add ) );
+               }
+               if( $remove ) {
+                       $r[] = wfMsgHTML( 'listgrouprights-removegroup', $wgLang->listToText( $remove ) );
+               }
                if( empty( $r ) ) {
                        return '';
                } else {
index e70e9a5..19ca283 100644 (file)
@@ -2029,6 +2029,8 @@ There may be [[{{MediaWiki:Listgrouprights-helppage}}|additional information]] a
 'listgrouprights-helppage'      => 'Help:Group rights',
 'listgrouprights-members'       => '(list of members)',
 'listgrouprights-right-display' => '$1 ($2)', # only translate this message to other languages if you have to change it
+'listgrouprights-addgroup'      => 'Can add groups: $1',
+'listgrouprights-removegroup'   => 'Can remove groups: $1',
 
 # E-mail user
 'mailnologin'     => 'No send address',