Fix partially blocked admin undelete permissions
authorDayllan Maza <dmaza@wikimedia.org>
Fri, 29 Mar 2019 17:13:22 +0000 (13:13 -0400)
committerDmaza <dmaza@wikimedia.org>
Fri, 29 Mar 2019 21:00:27 +0000 (21:00 +0000)
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
includes/specials/SpecialUndelete.php

index 07a6aae..5f9b97c 100644 (file)
@@ -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() );
                }
 
index 529c331..7d6c41a 100644 (file)
@@ -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' ) ) {