X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%2C%22id_auteur=%24connecte%22%29%20.%20%22?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUserrights.php;h=8655b1c2e8ee067a15d20fdbeb7fd77cc372e1c0;hb=b942fc27c93e54868298608698fe6b965907d33e;hp=6e6d90595f5b433bc77475fba5082182a371bedd;hpb=dd35e1a469b96a787e015dce28adfb5a8b6daa62;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 6e6d90595f..8655b1c2e8 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -61,15 +61,23 @@ class UserrightsPage extends SpecialPage { $isself = $this->getUser()->equals( $targetUser ); $available = $this->changeableGroups(); - if ( $targetUser->getId() == 0 ) { + if ( $targetUser->getId() === 0 ) { return false; } - return !empty( $available['add'] ) - || !empty( $available['remove'] ) - || ( ( $isself || !$checkIfSelf ) && - ( !empty( $available['add-self'] ) - || !empty( $available['remove-self'] ) ) ); + if ( $available['add'] || $available['remove'] ) { + // can change some rights for any user + return true; + } + + if ( ( $available['add-self'] || $available['remove-self'] ) + && ( $isself || !$checkIfSelf ) + ) { + // can change some rights for self + return true; + } + + return false; } /** @@ -152,8 +160,13 @@ class UserrightsPage extends SpecialPage { * (e.g. they don't have the userrights permission), then don't * allow them to change any user rights. */ - if ( $user->isBlocked() && !$user->isAllowed( 'userrights' ) ) { - throw new UserBlockedError( $user->getBlock() ); + if ( !$user->isAllowed( 'userrights' ) ) { + // @TODO Should the user be blocked from changing user rights if they + // are partially blocked? + $block = $user->getBlock(); + if ( $block ) { + throw new UserBlockedError( $user->getBlock() ); + } } $this->checkReadOnly(); @@ -387,9 +400,6 @@ class UserrightsPage extends SpecialPage { // update groups in external authentication database Hooks::run( 'UserGroupsChanged', [ $user, $add, $remove, $this->getUser(), $reason, $oldUGMs, $newUGMs ] ); - MediaWiki\Auth\AuthManager::callLegacyAuthPlugin( - 'updateExternalDBGroups', [ $user, $add, $remove ] - ); wfDebug( 'oldGroups: ' . print_r( $oldGroups, true ) . "\n" ); wfDebug( 'newGroups: ' . print_r( $newGroups, true ) . "\n" );