Unicornisaurous has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260322

Change subject: Prevent blocked users from performing revision deletion
......................................................................

Prevent blocked users from performing revision deletion

Change-Id: Icee9a5816dae51a23c333ae49f47d14f5e08cb03
---
M includes/api/ApiRevisionDelete.php
M includes/specials/SpecialRevisiondelete.php
2 files changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/22/260322/1

diff --git a/includes/api/ApiRevisionDelete.php 
b/includes/api/ApiRevisionDelete.php
index 7d89b69..b5a1758 100644
--- a/includes/api/ApiRevisionDelete.php
+++ b/includes/api/ApiRevisionDelete.php
@@ -41,6 +41,27 @@
                        $this->dieUsageMsg( 'badaccess-group0' );
                }
 
+               if ( $user->isBlocked() ) {
+                       $block = $user->getBlock();
+
+                       // Die using the appropriate messege 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/specials/SpecialRevisiondelete.php 
b/includes/specials/SpecialRevisiondelete.php
index 5ed0483..6dcbcb1 100644
--- a/includes/specials/SpecialRevisiondelete.php
+++ b/includes/specials/SpecialRevisiondelete.php
@@ -118,6 +118,11 @@
                $output = $this->getOutput();
                $user = $this->getUser();
 
+               // Check blocks
+               if ( $user->isBlocked() ) {
+                       throw new UserBlockedError( $user->getBlock() );
+               }
+
                $this->setHeaders();
                $this->outputHeader();
                $request = $this->getRequest();

-- 
To view, visit https://gerrit.wikimedia.org/r/260322
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icee9a5816dae51a23c333ae49f47d14f5e08cb03
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Unicornisaurous <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to