X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fapi%2FApiUnblock.php;h=15c25644887051efb66a09cac89c2c6f979047ad;hb=a5230acd936b5b9270037c35b9d2d419f4c8d9a6;hp=5cef194f363c902a93f64241c26091ff279fe1e0;hpb=20d290b883bc79c975a852670a6ed10d8406896e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php index 5cef194f36..15c2564488 100644 --- a/includes/api/ApiUnblock.php +++ b/includes/api/ApiUnblock.php @@ -41,7 +41,7 @@ class ApiUnblock extends ApiBase { $this->requireOnlyOneParameter( $params, 'id', 'user', 'userid' ); - if ( !$user->isAllowed( 'block' ) ) { + if ( !$this->getPermissionManager()->userHasRight( $user, 'block' ) ) { $this->dieWithError( 'apierror-permissiondenied-unblock', 'permissiondenied' ); } # T17810: blocked admins should have limited access here @@ -86,11 +86,13 @@ class ApiUnblock extends ApiBase { $this->dieStatus( $this->errorArrayToStatus( $retval ) ); } - $res['id'] = $block->getId(); $target = $block->getType() == DatabaseBlock::TYPE_AUTO ? '' : $block->getTarget(); - $res['user'] = $target instanceof User ? $target->getName() : $target; - $res['userid'] = $target instanceof User ? $target->getId() : 0; - $res['reason'] = $params['reason']; + $res = [ + 'id' => $block->getId(), + 'user' => $target instanceof User ? $target->getName() : $target, + 'userid' => $target instanceof User ? $target->getId() : 0, + 'reason' => $params['reason'] + ]; $this->getResult()->addValue( null, $this->getModuleName(), $res ); }