r50197 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50196‎ | r50197 | r50198 >
Date:19:16, 4 May 2009
Author:robin
Status:ok
Tags:
Comment:
Add $wgGroupsAddToSelf and $wgGroupsRemoveFromSelf in Special:ListGroupRights (bug 15061), the same way as $wgAddGroups and $wgRemoveGroups
Modified paths:
  • /trunk/phase3/includes/specials/SpecialListgrouprights.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1535,6 +1535,11 @@
15361536 'listgrouprights-removegroup',
15371537 'listgrouprights-addgroup-all',
15381538 'listgrouprights-removegroup-all',
 1539+ 'listgrouprights-addgroup-self',
 1540+ 'listgrouprights-removegroup-self',
 1541+ 'listgrouprights-addgroup-self-all',
 1542+ 'listgrouprights-removegroup-self-all',
 1543+
15391544 ),
15401545 'emailuser' => array(
15411546 'mailnologin',
Index: trunk/phase3/includes/specials/SpecialListgrouprights.php
@@ -26,6 +26,7 @@
2727 public function execute( $par ) {
2828 global $wgOut, $wgImplicitGroups, $wgMessageCache;
2929 global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups;
 30+ global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
3031 $wgMessageCache->loadAllMessages();
3132
3233 $this->setHeaders();
@@ -76,13 +77,16 @@
7778 $addgroups = isset( $wgAddGroups[$group] ) ? $wgAddGroups[$group] : array();
7879 $removegroups = isset( $wgRemoveGroups[$group] ) ? $wgRemoveGroups[$group] : array();
7980
 81+ $addgroupsSelf = isset( $wgGroupsAddToSelf[$group] ) ? $wgGroupsAddToSelf[$group] : array();
 82+ $removegroupsSelf = isset( $wgGroupsRemoveFromSelf[$group] ) ? $wgGroupsRemoveFromSelf[$group] : array();
 83+
8084 $wgOut->addHTML(
8185 '<tr>
8286 <td>' .
8387 $grouppage . $grouplink .
8488 '</td>
8589 <td>' .
86 - self::formatPermissions( $permissions, $addgroups, $removegroups ) .
 90+ self::formatPermissions( $permissions, $addgroups, $removegroups, $addgroupsSelf, $removegroupsSelf ) .
8791 '</td>
8892 </tr>'
8993 );
@@ -98,7 +102,7 @@
99103 * @param $permissions Array of permission => bool (from $wgGroupPermissions items)
100104 * @return string List of all granted permissions, separated by comma separator
101105 */
102 - private static function formatPermissions( $permissions, $add, $remove ) {
 106+ private static function formatPermissions( $permissions, $add, $remove, $addSelf, $removeSelf ) {
103107 global $wgLang;
104108 $r = array();
105109 foreach( $permissions as $permission => $granted ) {
@@ -121,6 +125,16 @@
122126 } else if( is_array( $remove ) && count( $remove ) ) {
123127 $r[] = wfMsgExt( 'listgrouprights-removegroup', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $remove ) ), count( $remove ) );
124128 }
 129+ if( $addSelf === true ){
 130+ $r[] = wfMsgExt( 'listgrouprights-addgroup-self-all', array( 'escape' ) );
 131+ } else if( is_array( $addSelf ) && count( $addSelf ) ) {
 132+ $r[] = wfMsgExt( 'listgrouprights-addgroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $addSelf ) ), count( $addSelf ) );
 133+ }
 134+ if( $removeSelf === true ){
 135+ $r[] = wfMsgExt( 'listgrouprights-removegroup-self-all', array( 'escape' ) );
 136+ } else if( is_array( $removeSelf ) && count( $removeSelf ) ) {
 137+ $r[] = wfMsgExt( 'listgrouprights-removegroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $removeSelf ) ), count( $removeSelf ) );
 138+ }
125139 if( empty( $r ) ) {
126140 return '';
127141 } else {
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2286,6 +2286,10 @@
22872287 'listgrouprights-removegroup' => 'Can remove {{PLURAL:$2|group|groups}}: $1',
22882288 'listgrouprights-addgroup-all' => 'Can add all groups',
22892289 'listgrouprights-removegroup-all' => 'Can remove all groups',
 2290+'listgrouprights-addgroup-self' => 'Can add {{PLURAL:$2|group|groups}} to own account: $1',
 2291+'listgrouprights-removegroup-self' => 'Can remove {{PLURAL:$2|group|groups}} to own account: $1',
 2292+'listgrouprights-addgroup-self-all' => 'Can add all groups to own account',
 2293+'listgrouprights-removegroup-self-all' => 'Can remove all groups to own account',
22902294
22912295 # E-mail user
22922296 'mailnologin' => 'No send address',

Status & tagging log