Index: trunk/phase3/includes/api/ApiUnblock.php |
— | — | @@ -62,6 +62,21 @@ |
63 | 63 | if ( !$wgUser->isAllowed( 'block' ) ) { |
64 | 64 | $this->dieUsageMsg( array( 'cantunblock' ) ); |
65 | 65 | } |
| 66 | + # bug 15810: blocked admins should have limited access here |
| 67 | + if( $wgUser->isBlocked() ){ |
| 68 | + $user = User::newFromName( $params['user'] ); |
| 69 | + if( $user instanceof User |
| 70 | + && $user->getId() == $wgUser->getId() ) |
| 71 | + { |
| 72 | + # User is trying to unblock themselves |
| 73 | + if( !$wgUser->isAllowed( 'unblockself' ) ){ |
| 74 | + $this->dieUsageMsg( array( 'ipbnounblockself' ) ); |
| 75 | + } |
| 76 | + } else { |
| 77 | + # User is trying to block/unblock someone else |
| 78 | + $this->dieUsageMsg( array( 'ipbblocked' ) ); |
| 79 | + } |
| 80 | + } |
66 | 81 | |
67 | 82 | $id = $params['id']; |
68 | 83 | $user = $params['user']; |
— | — | @@ -116,6 +131,8 @@ |
117 | 132 | array( 'unblock-notarget' ), |
118 | 133 | array( 'unblock-idanduser' ), |
119 | 134 | array( 'cantunblock' ), |
| 135 | + array( 'ipbblocked' ), |
| 136 | + array( 'ipbnounblockself' ), |
120 | 137 | ) ); |
121 | 138 | } |
122 | 139 | |
Index: trunk/phase3/includes/api/ApiBlock.php |
— | — | @@ -64,6 +64,21 @@ |
65 | 65 | if ( !$wgUser->isAllowed( 'block' ) ) { |
66 | 66 | $this->dieUsageMsg( array( 'cantblock' ) ); |
67 | 67 | } |
| 68 | + # bug 15810: blocked admins should have limited access here |
| 69 | + if( $wgUser->isBlocked() ){ |
| 70 | + $user = User::newFromName( $params['user'] ); |
| 71 | + if( $user instanceof User |
| 72 | + && $user->getId() == $wgUser->getId() ) |
| 73 | + { |
| 74 | + # User is trying to unblock themselves |
| 75 | + if( !$wgUser->isAllowed( 'unblockself' ) ){ |
| 76 | + $this->dieUsageMsg( array( 'ipbnounblockself' ) ); |
| 77 | + } |
| 78 | + } else { |
| 79 | + # User is trying to block/unblock someone else |
| 80 | + $this->dieUsageMsg( array( 'ipbblocked' ) ); |
| 81 | + } |
| 82 | + } |
68 | 83 | if ( $params['hidename'] && !$wgUser->isAllowed( 'hideuser' ) ) { |
69 | 84 | $this->dieUsageMsg( array( 'canthide' ) ); |
70 | 85 | } |
— | — | @@ -172,6 +187,8 @@ |
173 | 188 | array( 'cantblock' ), |
174 | 189 | array( 'canthide' ), |
175 | 190 | array( 'cantblock-email' ), |
| 191 | + array( 'ipbblocked' ), |
| 192 | + array( 'ipbnounblockself' ), |
176 | 193 | ) ); |
177 | 194 | } |
178 | 195 | |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -873,6 +873,8 @@ |
874 | 874 | 'ipb_blocked_as_range' => array( 'code' => 'blockedasrange', 'info' => "IP address ``\$1'' was blocked as part of range ``\$2''. You can't unblock the IP invidually, but you can unblock the range as a whole." ), |
875 | 875 | 'ipb_cant_unblock' => array( 'code' => 'cantunblock', 'info' => "The block you specified was not found. It may have been unblocked already" ), |
876 | 876 | 'mailnologin' => array( 'code' => 'cantsend', 'info' => "You are not logged in, you do not have a confirmed e-mail address, or you are not allowed to send e-mail to other users, so you cannot send e-mail" ), |
| 877 | + 'ipbblocked' => array( 'code' => 'ipbblocked', 'info' => 'You cannot block or unblock users while you are yourself blocked' ), |
| 878 | + 'ipbnounblockself' => array( 'code' => 'ipbnounblockself', 'info' => 'You are not allowed to unblock yourself' ), |
877 | 879 | 'usermaildisabled' => array( 'code' => 'usermaildisabled', 'info' => "User email has been disabled" ), |
878 | 880 | 'blockedemailuser' => array( 'code' => 'blockedfrommail', 'info' => "You have been blocked from sending e-mail" ), |
879 | 881 | 'notarget' => array( 'code' => 'notarget', 'info' => "You have not specified a valid target for this action" ), |