Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -1538,36 +1538,6 @@ |
1539 | 1539 | $add : Array of strings corresponding to groups added |
1540 | 1540 | $remove: Array of strings corresponding to groups removed |
1541 | 1541 | |
1542 | | -'UserrightsChangeableGroups': allows modification of the groups a user |
1543 | | -may add or remove via Special:UserRights |
1544 | | -$userrights : UserrightsPage object |
1545 | | -$user : User object of the current user |
1546 | | -$addergroups : Array of groups that the user is in |
1547 | | -&$groups : Array of groups that can be added or removed. In format of |
1548 | | - array( |
1549 | | - 'add' => array( addablegroups ), |
1550 | | - 'remove' => array( removablegroups ), |
1551 | | - 'add-self' => array( addablegroups to self ), |
1552 | | - 'remove-self' => array( removable groups from self ) |
1553 | | - ) |
1554 | | - |
1555 | | -'UserrightsGroupCheckboxes': allows modification of the display of |
1556 | | -checkboxes in the Special:UserRights interface. |
1557 | | -$usergroups : Array of groups that the target user belongs to |
1558 | | -&$columns : Array of checkboxes, in the form of |
1559 | | - $columns['column name']['group name'] = array( |
1560 | | - 'set' => is this checkbox checked by default? |
1561 | | - 'disabled' => is this checkbox disabled? |
1562 | | - 'irreversible' => can this action not be reversed? |
1563 | | - ); |
1564 | | - |
1565 | | -'UserrightsSaveUserGroups': allow extensions to modify the added/removed groups |
1566 | | -&$user : User object of the user being altered |
1567 | | -$oldGroups : Array of groups that the user is currently in |
1568 | | -&$add : Array of groups to add |
1569 | | -&$remove : Array of groups to remove |
1570 | | -$reason : Summary provided by user on the form |
1571 | | - |
1572 | 1542 | 'UserRetrieveNewTalks': called when retrieving "You have new messages!" |
1573 | 1543 | message(s) |
1574 | 1544 | $user: user retrieving new talks messages |
Index: trunk/phase3/includes/User.php |
— | — | @@ -3067,12 +3067,16 @@ |
3068 | 3068 | static function getGroupPermissions( $groups ) { |
3069 | 3069 | global $wgGroupPermissions, $wgRevokePermissions; |
3070 | 3070 | $rights = array(); |
| 3071 | + // grant every granted permission first |
3071 | 3072 | foreach( $groups as $group ) { |
3072 | 3073 | if( isset( $wgGroupPermissions[$group] ) ) { |
3073 | 3074 | $rights = array_merge( $rights, |
3074 | 3075 | // array_filter removes empty items |
3075 | 3076 | array_keys( array_filter( $wgGroupPermissions[$group] ) ) ); |
3076 | 3077 | } |
| 3078 | + } |
| 3079 | + // now revoke the revoked permissions |
| 3080 | + foreach( $groups as $group ) { |
3077 | 3081 | if( isset( $wgRevokePermissions[$group] ) ) { |
3078 | 3082 | $rights = array_diff( $rights, |
3079 | 3083 | array_keys( array_filter( $wgRevokePermissions[$group] ) ) ); |
Index: trunk/phase3/includes/specials/SpecialUserrights.php |
— | — | @@ -196,9 +196,6 @@ |
197 | 197 | $oldGroups = $user->getGroups(); |
198 | 198 | $newGroups = $oldGroups; |
199 | 199 | |
200 | | - // Run a hook beforehand to allow extensions to modify the added/removed groups |
201 | | - wfRunHooks( 'UserrightsSaveUserGroups', array( &$user, $oldGroups, &$add, &$remove, $reason ) ); |
202 | | - |
203 | 200 | // remove then add groups |
204 | 201 | if( $remove ) { |
205 | 202 | $newGroups = array_diff($newGroups, $remove); |
— | — | @@ -486,9 +483,6 @@ |
487 | 484 | } |
488 | 485 | } |
489 | 486 | |
490 | | - # Run a hook to allow extensions to modify the column listing |
491 | | - wfRunHooks( 'UserrightsGroupCheckboxes', array( $usergroups, &$columns ) ); |
492 | | - |
493 | 487 | # Build the HTML table |
494 | 488 | $ret .= Xml::openElement( 'table', array( 'border' => '0', 'class' => 'mw-userrights-groups' ) ) . |
495 | 489 | "<tr>\n"; |
— | — | @@ -548,11 +542,7 @@ |
549 | 543 | */ |
550 | 544 | function changeableGroups() { |
551 | 545 | global $wgUser; |
552 | | - $groups = $wgUser->changeableGroups(); |
553 | | - // Run a hook because we can |
554 | | - wfRunHooks( 'UserrightsChangeableGroups', array( $this, |
555 | | - $wgUser, $wgUser->getEffectiveGroups(), &$groups ) ); |
556 | | - return $groups; |
| 546 | + return $wgUser->changeableGroups(); |
557 | 547 | } |
558 | 548 | |
559 | 549 | /** |
Index: trunk/phase3/includes/specials/SpecialListgrouprights.php |
— | — | @@ -127,7 +127,8 @@ |
128 | 128 | global $wgLang; |
129 | 129 | $r = array(); |
130 | 130 | foreach( $permissions as $permission => $granted ) { |
131 | | - if( $granted ) { |
| 131 | + //show as granted only if it isn't revoked to prevent duplicate display of permissions |
| 132 | + if( $granted && ( !isset( $revoke[$permission] ) || !$revoke[$permission] ) ) { |
132 | 133 | $description = wfMsgExt( 'listgrouprights-right-display', array( 'parseinline' ), |
133 | 134 | User::getRightDescription( $permission ), |
134 | 135 | $permission |
— | — | @@ -137,7 +138,7 @@ |
138 | 139 | } |
139 | 140 | foreach( $revoke as $permission => $revoked ) { |
140 | 141 | if( $revoked ) { |
141 | | - $description = wfMsgExt( 'lisgrouprights-right-revoked', array( 'parseinline' ), |
| 142 | + $description = wfMsgExt( 'listgrouprights-right-revoked', array( 'parseinline' ), |
142 | 143 | User::getRightDescription( $permission ), |
143 | 144 | $permission |
144 | 145 | ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -40,6 +40,7 @@ |
41 | 41 | * Oracle: maintenance/ora/user.sql script for creating DB user on oracle with |
42 | 42 | appropriate privileges. Creating this user with web-install page requires |
43 | 43 | oci8.privileged_connect set to On in php.ini. |
| 44 | +* Removed UserrightsChangeableGroups hook introduced in 1.14 |
44 | 45 | |
45 | 46 | === New features in 1.16 === |
46 | 47 | |
— | — | @@ -83,10 +84,6 @@ |
84 | 85 | * DISPLAYTITLE now accepts a limited amount of wiki markup (the single-quote items) |
85 | 86 | * Special:Search now could search terms in all variant-forms. ONLY apply on |
86 | 87 | wikis with LanguageConverter |
87 | | -* Add hook 'UserrightsGetCheckboxes' to give extensions the ability to modify |
88 | | - the arrangement of checkboxes on the Special:UserRights form |
89 | | -* Add hook 'UserrightsSaveUserGroups' to give extensions the ability to modify |
90 | | - the groups being added and removed last-minute. |
91 | 88 | * Add autopromote condition APCOND_BLOCKED to autopromote blocked users to various |
92 | 89 | user groups. |
93 | 90 | * Add $wgRevokePermissions as a means of restricting a group's rights. The syntax is |