Merge "deferred: make DeferredUpdates::attemptUpdate() use callback owners for $fname...
[lhc/web/wiklou.git] / includes / api / ApiBlock.php
index c71de40..2c1564e 100644 (file)
@@ -98,7 +98,8 @@ class ApiBlock extends ApiBase {
                        }
                }
 
-               if ( $params['hidename'] && !$user->isAllowed( 'hideuser' ) ) {
+               if ( $params['hidename'] &&
+                        !$this->getPermissionManager()->userHasRight( $user, 'hideuser' ) ) {
                        $this->dieWithError( 'apierror-canthide' );
                }
                if ( $params['noemail'] && !SpecialBlock::canBlockEmail( $user ) ) {
@@ -129,6 +130,11 @@ class ApiBlock extends ApiBase {
                        'NamespaceRestrictions' => $namespaceRestrictions,
                ];
 
+               $status = SpecialBlock::validateTarget( $params['user'], $user );
+               if ( !$status->isOK() ) {
+                       $this->dieStatus( $status );
+               }
+
                $retval = SpecialBlock::processForm( $data, $this->getContext() );
                if ( $retval !== true ) {
                        $this->dieStatus( $this->errorArrayToStatus( $retval ) );