Index: trunk/extensions/BatchUserRights/BatchUserRights.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | $wgExtensionCredits['specialpage'][] = array( |
19 | 19 | 'path' => __FILE__, |
20 | 20 | 'name' => 'BatchUserRights', |
21 | | - 'version' => '1.1.1', |
| 21 | + 'version' => '1.1.2', |
22 | 22 | 'author' => '[http://www.seancolombo.com Sean Colombo]', |
23 | 23 | 'descriptionmsg' => 'batchuserrights-desc', |
24 | 24 | 'url' => 'https://www.mediawiki.org/wiki/Extension:BatchUserRights', |
— | — | @@ -28,9 +28,12 @@ |
29 | 29 | $wgAvailableRights[] = 'batchuserrights'; |
30 | 30 | $wgGroupPermissions['bureaucrat']['batchuserrights'] = true; |
31 | 31 | |
| 32 | +// User groups which can be added through Special:BatchUserRights |
| 33 | +$wgBatchUserRightsGrantableGroups = array(); |
| 34 | + |
32 | 35 | // Set up the new special page |
33 | 36 | $dir = dirname( __FILE__ ) . '/'; |
34 | 37 | $wgExtensionMessagesFiles['BatchUserRights'] = $dir . 'BatchUserRights.i18n.php'; |
35 | 38 | $wgExtensionMessagesFiles['BatchUserRightsAliases'] = $dir . 'BatchUserRights.alias.php'; |
36 | 39 | $wgAutoloadClasses['SpecialBatchUserRights'] = $dir . 'SpecialBatchUserRights.php'; |
37 | | -$wgSpecialPages['BatchUserRights'] = 'SpecialBatchUserRights'; |
\ No newline at end of file |
| 40 | +$wgSpecialPages['BatchUserRights'] = 'SpecialBatchUserRights'; |
Index: trunk/extensions/BatchUserRights/SpecialBatchUserRights.php |
— | — | @@ -8,13 +8,6 @@ |
9 | 9 | class SpecialBatchUserRights extends SpecialPage { |
10 | 10 | protected $isself = false; |
11 | 11 | |
12 | | - // For added security, this array will be the only groups we'll allow to be batch-added to users. |
13 | | - // FIXME: Don't use private function to define addable groups, switch to global variable |
14 | | - private static $grantableUserGroups = array( |
15 | | - 'beta', |
16 | | - 'rollback', |
17 | | - ); |
18 | | - |
19 | 12 | /** |
20 | 13 | * Constructor -- set up the new (restricted) special page |
21 | 14 | */ |
— | — | @@ -38,7 +31,7 @@ |
39 | 32 | * @param $par Mixed: string if any subpage provided, else null |
40 | 33 | */ |
41 | 34 | public function execute( $par ) { |
42 | | - global $wgUser, $wgRequest, $wgOut; |
| 35 | + global $wgUser, $wgRequest, $wgOut, $wgBatchUserRightsGrantableGroups; |
43 | 36 | |
44 | 37 | // If the visitor doesn't have permissions to assign or remove |
45 | 38 | // any groups, it's a bit silly to give them the user search prompt. |
— | — | @@ -71,7 +64,7 @@ |
72 | 65 | $reason = $wgRequest->getVal( 'user-reason' ); |
73 | 66 | $tok = $wgRequest->getVal( 'wpEditToken' ); |
74 | 67 | if ( $wgUser->matchEditToken( $tok ) ) { |
75 | | - $allgroups = self::$grantableUserGroups; |
| 68 | + $allgroups = $wgBatchUserRightsGrantableGroups; |
76 | 69 | $addgroup = array(); |
77 | 70 | foreach ( $allgroups as $group ) { |
78 | 71 | // This batch form is only for adding user groups, we don't remove any. |
— | — | @@ -350,9 +343,10 @@ |
351 | 344 | * @return string XHTML table element with checkboxes |
352 | 345 | */ |
353 | 346 | private function groupCheckboxes() { |
| 347 | + global $wgBatchUserRightsGrantableGroups; |
354 | 348 | $usergroups = array(); // kinda a hack... this array holds "selected" groups... of which there shouldn't be any for this SpecialPage |
355 | 349 | |
356 | | - $allgroups = self::$grantableUserGroups; |
| 350 | + $allgroups = $wgBatchUserRightsGrantableGroups; |
357 | 351 | $ret = ''; |
358 | 352 | |
359 | 353 | $column = 1; |