From: Andrew H Date: Sun, 20 Dec 2015 23:49:10 +0000 (+0000) Subject: Prevent blocked users from performing revision deletion X-Git-Tag: 1.31.0-rc.0~8599^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=9505548258d01e5e8e4cce07b3c6f1c5088777d1;p=lhc%2Fweb%2Fwiklou.git Prevent blocked users from performing revision deletion Also fixed messege -> message in a comment. Change-Id: Icee9a5816dae51a23c333ae49f47d14f5e08cb03 --- diff --git a/includes/api/ApiRevisionDelete.php b/includes/api/ApiRevisionDelete.php index 7d89b690b9..b70b536286 100644 --- a/includes/api/ApiRevisionDelete.php +++ b/includes/api/ApiRevisionDelete.php @@ -41,6 +41,27 @@ class ApiRevisionDelete extends ApiBase { $this->dieUsageMsg( 'badaccess-group0' ); } + if ( $user->isBlocked() ) { + $block = $user->getBlock(); + + // Die using the appropriate message depending on block type + if ( $block->getType() == TYPE_AUTO ) { + $this->dieUsage( + 'Your IP address has been blocked automatically, because it was used by a blocked user', + 'autoblocked', + 0, + array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ) + ); + } else { + $this->dieUsage( + 'You have been blocked from editing', + 'blocked', + 0, + array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ) + ); + } + } + if ( !$params['ids'] ) { $this->dieUsage( "At least one value is required for 'ids'", 'badparams' ); } diff --git a/includes/api/ApiTag.php b/includes/api/ApiTag.php index 2bba0e221f..4157de0f37 100644 --- a/includes/api/ApiTag.php +++ b/includes/api/ApiTag.php @@ -42,7 +42,7 @@ class ApiTag extends ApiBase { if ( $user->isBlocked() ) { $block = $user->getBlock(); - // Die using the appropriate messege depending on block type + // Die using the appropriate message depending on block type if ( $block->getType() == TYPE_AUTO ) { $this->dieUsage( 'Your IP address has been blocked automatically, because it was used by a blocked user', diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 5ed0483db9..6dcbcb1912 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -118,6 +118,11 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $output = $this->getOutput(); $user = $this->getUser(); + // Check blocks + if ( $user->isBlocked() ) { + throw new UserBlockedError( $user->getBlock() ); + } + $this->setHeaders(); $this->outputHeader(); $request = $this->getRequest();