From ab66b66c25cc2ffdbc29495adc1d49a491225387 Mon Sep 17 00:00:00 2001 From: Dayllan Maza Date: Fri, 29 Mar 2019 13:13:22 -0400 Subject: [PATCH] Fix partially blocked admin undelete permissions If an admin is partially blocked they should be able to restore/undelete any given page. Bug: T219305 Change-Id: I404730273c33d72d7552cd69e93ccec78c5fad5a --- includes/api/ApiUndelete.php | 3 ++- includes/specials/SpecialUndelete.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index 07a6aae9eb..5f9b97c457 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -31,7 +31,8 @@ class ApiUndelete extends ApiBase { $params = $this->extractRequestParams(); $user = $this->getUser(); - if ( $user->isBlocked() ) { + $block = $user->getBlock(); + if ( $block && $block->isSitewide() ) { $this->dieBlocked( $user->getBlock() ); } diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 529c33185e..7d6c41ab2d 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -95,7 +95,8 @@ class SpecialUndelete extends SpecialPage { $this->mUnsuppress = $request->getVal( 'wpUnsuppress' ) && $user->isAllowed( 'suppressrevision' ); $this->mToken = $request->getVal( 'token' ); - if ( $this->isAllowed( 'undelete' ) && !$user->isBlocked() ) { + $block = $user->getBlock(); + if ( $this->isAllowed( 'undelete' ) && !( $block && $block->isSitewide() ) ) { $this->mAllowed = true; // user can restore $this->mCanView = true; // user can view content } elseif ( $this->isAllowed( 'deletedtext' ) ) { -- 2.20.1