From 99464419036da1a9e660efab483d52aa517f294f Mon Sep 17 00:00:00 2001 From: David Barratt Date: Fri, 19 Jul 2019 13:37:27 -0400 Subject: [PATCH] Users with partial access to user rights should not be blocked If a user has partial access to modify user rights, their partial access should not be blocked because of a partial block. Bug: T228534 Change-Id: I7479953f1ef99d437184e5cbbe06adedf5b7a47b --- includes/api/ApiUserrights.php | 4 +--- includes/specials/SpecialUserrights.php | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php index acb3da8fb1..8f3c404116 100644 --- a/includes/api/ApiUserrights.php +++ b/includes/api/ApiUserrights.php @@ -52,10 +52,8 @@ class ApiUserrights extends ApiBase { // Deny if the user is blocked and doesn't have the full 'userrights' permission. // This matches what Special:UserRights does for the web UI. if ( !$pUser->isAllowed( 'userrights' ) ) { - // @TODO Should the user be blocked from changing user rights if they - // are partially blocked? $block = $pUser->getBlock(); - if ( $block ) { + if ( $block && $block->isSitewide() ) { $this->dieBlocked( $block ); } } diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index a8ff32fa90..87534eb885 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -161,11 +161,9 @@ class UserrightsPage extends SpecialPage { * allow them to change any user rights. */ 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() ); + if ( $block && $block->isSitewide() ) { + throw new UserBlockedError( $block ); } } -- 2.20.1