* Remove the two hooks introduced in r52082
* Remove the unused UserrightsChangeableGroups hook introduced in r39368 (1.14) * Fix typo in Special:ListGroupRights introduced in r52083 * Prevent duplicate key display in Special:ListGroupRights (new behavior: if a permission is both assigned and revoked from a group, it only displays as revoked). * Fix $wgRevokePermissions handling, it now runs after every group permission has been assigned in order to revoke the permission properly.
This commit is contained in:
parent
634ec8e93e
commit
2da101ba2c
5 changed files with 9 additions and 47 deletions
|
|
@ -40,6 +40,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
||||||
* Oracle: maintenance/ora/user.sql script for creating DB user on oracle with
|
* Oracle: maintenance/ora/user.sql script for creating DB user on oracle with
|
||||||
appropriate privileges. Creating this user with web-install page requires
|
appropriate privileges. Creating this user with web-install page requires
|
||||||
oci8.privileged_connect set to On in php.ini.
|
oci8.privileged_connect set to On in php.ini.
|
||||||
|
* Removed UserrightsChangeableGroups hook introduced in 1.14
|
||||||
|
|
||||||
=== New features in 1.16 ===
|
=== New features in 1.16 ===
|
||||||
|
|
||||||
|
|
@ -83,10 +84,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
||||||
* DISPLAYTITLE now accepts a limited amount of wiki markup (the single-quote items)
|
* DISPLAYTITLE now accepts a limited amount of wiki markup (the single-quote items)
|
||||||
* Special:Search now could search terms in all variant-forms. ONLY apply on
|
* Special:Search now could search terms in all variant-forms. ONLY apply on
|
||||||
wikis with LanguageConverter
|
wikis with LanguageConverter
|
||||||
* Add hook 'UserrightsGetCheckboxes' to give extensions the ability to modify
|
|
||||||
the arrangement of checkboxes on the Special:UserRights form
|
|
||||||
* Add hook 'UserrightsSaveUserGroups' to give extensions the ability to modify
|
|
||||||
the groups being added and removed last-minute.
|
|
||||||
* Add autopromote condition APCOND_BLOCKED to autopromote blocked users to various
|
* Add autopromote condition APCOND_BLOCKED to autopromote blocked users to various
|
||||||
user groups.
|
user groups.
|
||||||
* Add $wgRevokePermissions as a means of restricting a group's rights. The syntax is
|
* Add $wgRevokePermissions as a means of restricting a group's rights. The syntax is
|
||||||
|
|
|
||||||
|
|
@ -1538,36 +1538,6 @@ $user : User object that was changed
|
||||||
$add : Array of strings corresponding to groups added
|
$add : Array of strings corresponding to groups added
|
||||||
$remove: Array of strings corresponding to groups removed
|
$remove: Array of strings corresponding to groups removed
|
||||||
|
|
||||||
'UserrightsChangeableGroups': allows modification of the groups a user
|
|
||||||
may add or remove via Special:UserRights
|
|
||||||
$userrights : UserrightsPage object
|
|
||||||
$user : User object of the current user
|
|
||||||
$addergroups : Array of groups that the user is in
|
|
||||||
&$groups : Array of groups that can be added or removed. In format of
|
|
||||||
array(
|
|
||||||
'add' => array( addablegroups ),
|
|
||||||
'remove' => array( removablegroups ),
|
|
||||||
'add-self' => array( addablegroups to self ),
|
|
||||||
'remove-self' => array( removable groups from self )
|
|
||||||
)
|
|
||||||
|
|
||||||
'UserrightsGroupCheckboxes': allows modification of the display of
|
|
||||||
checkboxes in the Special:UserRights interface.
|
|
||||||
$usergroups : Array of groups that the target user belongs to
|
|
||||||
&$columns : Array of checkboxes, in the form of
|
|
||||||
$columns['column name']['group name'] = array(
|
|
||||||
'set' => is this checkbox checked by default?
|
|
||||||
'disabled' => is this checkbox disabled?
|
|
||||||
'irreversible' => can this action not be reversed?
|
|
||||||
);
|
|
||||||
|
|
||||||
'UserrightsSaveUserGroups': allow extensions to modify the added/removed groups
|
|
||||||
&$user : User object of the user being altered
|
|
||||||
$oldGroups : Array of groups that the user is currently in
|
|
||||||
&$add : Array of groups to add
|
|
||||||
&$remove : Array of groups to remove
|
|
||||||
$reason : Summary provided by user on the form
|
|
||||||
|
|
||||||
'UserRetrieveNewTalks': called when retrieving "You have new messages!"
|
'UserRetrieveNewTalks': called when retrieving "You have new messages!"
|
||||||
message(s)
|
message(s)
|
||||||
$user: user retrieving new talks messages
|
$user: user retrieving new talks messages
|
||||||
|
|
|
||||||
|
|
@ -3067,12 +3067,16 @@ class User {
|
||||||
static function getGroupPermissions( $groups ) {
|
static function getGroupPermissions( $groups ) {
|
||||||
global $wgGroupPermissions, $wgRevokePermissions;
|
global $wgGroupPermissions, $wgRevokePermissions;
|
||||||
$rights = array();
|
$rights = array();
|
||||||
|
// grant every granted permission first
|
||||||
foreach( $groups as $group ) {
|
foreach( $groups as $group ) {
|
||||||
if( isset( $wgGroupPermissions[$group] ) ) {
|
if( isset( $wgGroupPermissions[$group] ) ) {
|
||||||
$rights = array_merge( $rights,
|
$rights = array_merge( $rights,
|
||||||
// array_filter removes empty items
|
// array_filter removes empty items
|
||||||
array_keys( array_filter( $wgGroupPermissions[$group] ) ) );
|
array_keys( array_filter( $wgGroupPermissions[$group] ) ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// now revoke the revoked permissions
|
||||||
|
foreach( $groups as $group ) {
|
||||||
if( isset( $wgRevokePermissions[$group] ) ) {
|
if( isset( $wgRevokePermissions[$group] ) ) {
|
||||||
$rights = array_diff( $rights,
|
$rights = array_diff( $rights,
|
||||||
array_keys( array_filter( $wgRevokePermissions[$group] ) ) );
|
array_keys( array_filter( $wgRevokePermissions[$group] ) ) );
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,8 @@ class SpecialListGroupRights extends SpecialPage {
|
||||||
global $wgLang;
|
global $wgLang;
|
||||||
$r = array();
|
$r = array();
|
||||||
foreach( $permissions as $permission => $granted ) {
|
foreach( $permissions as $permission => $granted ) {
|
||||||
if( $granted ) {
|
//show as granted only if it isn't revoked to prevent duplicate display of permissions
|
||||||
|
if( $granted && ( !isset( $revoke[$permission] ) || !$revoke[$permission] ) ) {
|
||||||
$description = wfMsgExt( 'listgrouprights-right-display', array( 'parseinline' ),
|
$description = wfMsgExt( 'listgrouprights-right-display', array( 'parseinline' ),
|
||||||
User::getRightDescription( $permission ),
|
User::getRightDescription( $permission ),
|
||||||
$permission
|
$permission
|
||||||
|
|
@ -137,7 +138,7 @@ class SpecialListGroupRights extends SpecialPage {
|
||||||
}
|
}
|
||||||
foreach( $revoke as $permission => $revoked ) {
|
foreach( $revoke as $permission => $revoked ) {
|
||||||
if( $revoked ) {
|
if( $revoked ) {
|
||||||
$description = wfMsgExt( 'lisgrouprights-right-revoked', array( 'parseinline' ),
|
$description = wfMsgExt( 'listgrouprights-right-revoked', array( 'parseinline' ),
|
||||||
User::getRightDescription( $permission ),
|
User::getRightDescription( $permission ),
|
||||||
$permission
|
$permission
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -196,9 +196,6 @@ class UserrightsPage extends SpecialPage {
|
||||||
$oldGroups = $user->getGroups();
|
$oldGroups = $user->getGroups();
|
||||||
$newGroups = $oldGroups;
|
$newGroups = $oldGroups;
|
||||||
|
|
||||||
// Run a hook beforehand to allow extensions to modify the added/removed groups
|
|
||||||
wfRunHooks( 'UserrightsSaveUserGroups', array( &$user, $oldGroups, &$add, &$remove, $reason ) );
|
|
||||||
|
|
||||||
// remove then add groups
|
// remove then add groups
|
||||||
if( $remove ) {
|
if( $remove ) {
|
||||||
$newGroups = array_diff($newGroups, $remove);
|
$newGroups = array_diff($newGroups, $remove);
|
||||||
|
|
@ -486,9 +483,6 @@ class UserrightsPage extends SpecialPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run a hook to allow extensions to modify the column listing
|
|
||||||
wfRunHooks( 'UserrightsGroupCheckboxes', array( $usergroups, &$columns ) );
|
|
||||||
|
|
||||||
# Build the HTML table
|
# Build the HTML table
|
||||||
$ret .= Xml::openElement( 'table', array( 'border' => '0', 'class' => 'mw-userrights-groups' ) ) .
|
$ret .= Xml::openElement( 'table', array( 'border' => '0', 'class' => 'mw-userrights-groups' ) ) .
|
||||||
"<tr>\n";
|
"<tr>\n";
|
||||||
|
|
@ -548,11 +542,7 @@ class UserrightsPage extends SpecialPage {
|
||||||
*/
|
*/
|
||||||
function changeableGroups() {
|
function changeableGroups() {
|
||||||
global $wgUser;
|
global $wgUser;
|
||||||
$groups = $wgUser->changeableGroups();
|
return $wgUser->changeableGroups();
|
||||||
// Run a hook because we can
|
|
||||||
wfRunHooks( 'UserrightsChangeableGroups', array( $this,
|
|
||||||
$wgUser, $wgUser->getEffectiveGroups(), &$groups ) );
|
|
||||||
return $groups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue