Index: trunk/phase3/includes/User.php |
— | — | @@ -166,7 +166,6 @@ |
167 | 167 | 'upload', |
168 | 168 | 'upload_by_url', |
169 | 169 | 'userrights', |
170 | | - 'userrights-interwiki', |
171 | 170 | ); |
172 | 171 | /** |
173 | 172 | * \type{\string} Cached results of getAllRights() |
Index: trunk/phase3/includes/specials/SpecialUserrights.php |
— | — | @@ -57,8 +57,7 @@ |
58 | 58 | * edit their own groups, automatically set them as the |
59 | 59 | * target. |
60 | 60 | */ |
61 | | - global $wgUser; |
62 | | - $available = $this->changeableGroups($wgUser); |
| 61 | + $available = $this->changeableGroups(); |
63 | 62 | if (empty($available['add']) && empty($available['remove'])) |
64 | 63 | $this->mTarget = $wgUser->getName(); |
65 | 64 | } |
— | — | @@ -124,7 +123,7 @@ |
125 | 124 | return; |
126 | 125 | } |
127 | 126 | |
128 | | - $allgroups = $this->getAllGroups($user); |
| 127 | + $allgroups = $this->getAllGroups(); |
129 | 128 | $addgroup = array(); |
130 | 129 | $removegroup = array(); |
131 | 130 | |
— | — | @@ -141,7 +140,7 @@ |
142 | 141 | } |
143 | 142 | |
144 | 143 | // Validate input set... |
145 | | - $changeable = $this->changeableGroups($user); |
| 144 | + $changeable = $this->changeableGroups(); |
146 | 145 | $addable = array_merge( $changeable['add'], $this->isself ? $changeable['add-self'] : array() ); |
147 | 146 | $removable = array_merge( $changeable['remove'], $this->isself ? $changeable['remove-self'] : array() ); |
148 | 147 | |
— | — | @@ -322,12 +321,10 @@ |
323 | 322 | * permissions. |
324 | 323 | * |
325 | 324 | * @param $groups Array: list of groups the given user is in |
326 | | - * @param $user User object to edit. |
327 | 325 | * @return Array: Tuple of addable, then removable groups |
328 | 326 | */ |
329 | | - protected function splitGroups( $groups, $user = null ) { |
330 | | - global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf; |
331 | | - list($addable, $removable, $addself, $removeself) = array_values( $this->changeableGroups( $user ) ); |
| 327 | + protected function splitGroups( $groups ) { |
| 328 | + list($addable, $removable, $addself, $removeself) = array_values( $this->changeableGroups() ); |
332 | 329 | |
333 | 330 | $removable = array_intersect( |
334 | 331 | array_merge( $this->isself ? $removeself : array(), $removable ), |
— | — | @@ -348,7 +345,7 @@ |
349 | 346 | protected function showEditUserGroupsForm( $user, $groups ) { |
350 | 347 | global $wgOut, $wgUser, $wgLang; |
351 | 348 | |
352 | | - list( $addable, $removable ) = $this->splitGroups( $groups, $user ); |
| 349 | + list( $addable, $removable ) = $this->splitGroups( $groups ); |
353 | 350 | |
354 | 351 | $list = array(); |
355 | 352 | foreach( $user->getGroups() as $group ) |
— | — | @@ -368,7 +365,7 @@ |
369 | 366 | wfMsgExt( 'editinguser', array( 'parse' ), wfEscapeWikiText( $user->getName() ) ) . |
370 | 367 | wfMsgExt( 'userrights-groups-help', array( 'parse' ) ) . |
371 | 368 | $grouplist . |
372 | | - Xml::tags( 'p', null, $this->groupCheckboxes( $groups, $user ) ) . |
| 369 | + Xml::tags( 'p', null, $this->groupCheckboxes( $groups ) ) . |
373 | 370 | Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-userrights-table-outer' ) ) . |
374 | 371 | "<tr> |
375 | 372 | <td class='mw-label'>" . |
— | — | @@ -405,62 +402,20 @@ |
406 | 403 | |
407 | 404 | /** |
408 | 405 | * Returns an array of all groups that may be edited |
409 | | - * @param $user User object of the user whose groups are being edited. Optional. |
410 | 406 | * @return array Array of groups that may be edited. |
411 | 407 | */ |
412 | | - protected static function getAllGroups($user=null) { |
413 | | - if ($user instanceof UserRightsProxy) { |
414 | | - // Remote user object. |
415 | | - return self::getRemoteGroups( $user->database ); |
416 | | - } |
417 | | - |
418 | | - // Regular user object |
| 408 | + protected static function getAllGroups() { |
419 | 409 | return User::getAllGroups(); |
420 | 410 | } |
421 | | - |
422 | | - /** |
423 | | - * Returns all groups which can be set on a remote wiki. |
424 | | - * @param $db String - database name of the foreign wiki. |
425 | | - * @return array Array of groups that may be edited. |
426 | | - */ |
427 | | - static function getRemoteGroups( $wiki ) { |
428 | | - // Stolen from CentralAuth - a dirty hack indeed. |
429 | | - global $wgConf, $IP; |
430 | | - static $initialiseSettingsDone = false; |
431 | 411 | |
432 | | - // This is a damn dirty hack |
433 | | - if ( !$initialiseSettingsDone ) { |
434 | | - $initialiseSettingsDone = true; |
435 | | - if( file_exists( "$IP/InitialiseSettings.php" ) ) { |
436 | | - require_once "$IP/InitialiseSettings.php"; |
437 | | - } |
438 | | - } |
439 | | - |
440 | | - list( $major, $minor ) = $wgConf->siteFromDB( $wiki ); |
441 | | - if( isset( $major ) ) { |
442 | | - $groupperms = $wgConf->get( 'wgGroupPermissions', $wiki, $major, |
443 | | - array( 'lang' => $minor, 'site' => $major ) ); |
444 | | - |
445 | | - $groups = array_keys($groupperms); |
446 | | - |
447 | | - if (count($groups)==0) { |
448 | | - // Fallback |
449 | | - return User::getAllGroups(); |
450 | | - } |
451 | | - |
452 | | - return $groups; |
453 | | - } |
454 | | - } |
455 | | - |
456 | 412 | /** |
457 | 413 | * Adds a table with checkboxes where you can select what groups to add/remove |
458 | 414 | * |
459 | 415 | * @param $usergroups Array: groups the user belongs to |
460 | | - * @param $user User object: the user to build checkboxes for. |
461 | 416 | * @return string XHTML table element with checkboxes |
462 | 417 | */ |
463 | | - private function groupCheckboxes( $usergroups, $user ) { |
464 | | - $allgroups = $this->getAllGroups( $user ); |
| 418 | + private function groupCheckboxes( $usergroups ) { |
| 419 | + $allgroups = $this->getAllGroups(); |
465 | 420 | $ret = ''; |
466 | 421 | |
467 | 422 | $column = 1; |
— | — | @@ -471,12 +426,12 @@ |
472 | 427 | $set = in_array( $group, $usergroups ); |
473 | 428 | # Should the checkbox be disabled? |
474 | 429 | $disabled = !( |
475 | | - ( $set && $this->canRemove( $group, $user ) ) || |
476 | | - ( !$set && $this->canAdd( $group, $user ) ) ); |
| 430 | + ( $set && $this->canRemove( $group ) ) || |
| 431 | + ( !$set && $this->canAdd( $group ) ) ); |
477 | 432 | # Do we need to point out that this action is irreversible? |
478 | 433 | $irreversible = !$disabled && ( |
479 | | - ($set && !$this->canAdd( $group, $user )) || |
480 | | - (!$set && !$this->canRemove( $group, $user ) ) ); |
| 434 | + ($set && !$this->canAdd( $group )) || |
| 435 | + (!$set && !$this->canRemove( $group ) ) ); |
481 | 436 | |
482 | 437 | $attr = $disabled ? array( 'disabled' => 'disabled' ) : array(); |
483 | 438 | $text = $irreversible |
— | — | @@ -528,54 +483,44 @@ |
529 | 484 | |
530 | 485 | /** |
531 | 486 | * @param $group String: the name of the group to check |
532 | | - * @param $user User object: The user in question. |
533 | 487 | * @return bool Can we remove the group? |
534 | 488 | */ |
535 | | - private function canRemove( $group, $user=null ) { |
| 489 | + private function canRemove( $group ) { |
536 | 490 | // $this->changeableGroups()['remove'] doesn't work, of course. Thanks, |
537 | 491 | // PHP. |
538 | | - $groups = $this->changeableGroups($user); |
| 492 | + $groups = $this->changeableGroups(); |
539 | 493 | return in_array( $group, $groups['remove'] ) || ($this->isself && in_array( $group, $groups['remove-self'] )); |
540 | 494 | } |
541 | 495 | |
542 | 496 | /** |
543 | 497 | * @param $group string: the name of the group to check |
544 | | - * @param $user User object: The user in question. |
545 | 498 | * @return bool Can we add the group? |
546 | 499 | */ |
547 | | - private function canAdd( $group, $user=null ) { |
548 | | - $groups = $this->changeableGroups($user); |
| 500 | + private function canAdd( $group ) { |
| 501 | + $groups = $this->changeableGroups(); |
549 | 502 | return in_array( $group, $groups['add'] ) || ($this->isself && in_array( $group, $groups['add-self'] )); |
550 | 503 | } |
551 | 504 | |
552 | 505 | /** |
553 | 506 | * Returns an array of the groups that the user can add/remove. |
554 | 507 | * |
555 | | - * @param $user User object to check groups for. |
556 | 508 | * @return Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ) , 'add-self' => array( addablegroups to self), 'remove-self' => array( removable groups from self) ) |
557 | 509 | */ |
558 | | - function changeableGroups( $user=null ) { |
| 510 | + function changeableGroups() { |
559 | 511 | global $wgUser; |
560 | | - |
561 | | - if ($user == null) |
562 | | - $user = $wgUser; // Doesn't make a difference which user, so long as it's a local one. |
563 | 512 | |
564 | | - if( $wgUser->isAllowed( 'userrights' ) || |
565 | | - $wgUser->isAllowed( 'userrights-interwiki' ) && $user instanceof UserRightsProxy ) { |
| 513 | + if( $wgUser->isAllowed( 'userrights' ) ) { |
566 | 514 | // This group gives the right to modify everything (reverse- |
567 | 515 | // compatibility with old "userrights lets you change |
568 | 516 | // everything") |
569 | 517 | // Using array_merge to make the groups reindexed |
570 | | - $all = array_merge( $this->getAllGroups( $user ) ); |
| 518 | + $all = array_merge( User::getAllGroups() ); |
571 | 519 | return array( |
572 | 520 | 'add' => $all, |
573 | 521 | 'remove' => $all, |
574 | 522 | 'add-self' => array(), |
575 | 523 | 'remove-self' => array() |
576 | 524 | ); |
577 | | - } elseif ( $user instanceof UserRightsProxy ) { |
578 | | - // Userrightsproxy without userrights-interwiki rights. Should have already been rejected. |
579 | | - return array( 'add' => array(), 'remove' => array(), 'add-self' => array(), 'remove-self' => array() ); |
580 | 525 | } |
581 | 526 | |
582 | 527 | // Okay, it's not so simple, we will have to go through the arrays |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -134,9 +134,7 @@ |
135 | 135 | * Avoid recursive crazy expansions in section edit comments for pages which |
136 | 136 | contain '/*' in the title |
137 | 137 | * Fix excessive memory usage when parsing pages with lots of links |
138 | | -* (bug 12518) Interwiki userrights now reflects remote groups, not local groups |
139 | 138 | |
140 | | - |
141 | 139 | === API changes in 1.14 === |
142 | 140 | |
143 | 141 | * Registration time of users registered before the DB field was created is now |