X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fapi%2FApiUserrights.php;h=e32b61236988f891f43ccfa774a14a3820c11b21;hb=c567baf7e41f4771c300b982f6308733f4f00a2c;hp=cf8ed5ab4e104915cc719880aad677b8f53178b0;hpb=4d78d40d821227a9368e87306f447ffd3be5db88;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php index cf8ed5ab4e..e32b612369 100644 --- a/includes/api/ApiUserrights.php +++ b/includes/api/ApiUserrights.php @@ -49,6 +49,14 @@ class ApiUserrights extends ApiBase { } public function execute() { + $pUser = $this->getUser(); + + // Deny if the user is blocked and doesn't have the full 'userrights' permission. + // This matches what Special:UserRights does for the web UI. + if ( $pUser->isBlocked() && !$pUser->isAllowed( 'userrights' ) ) { + $this->dieBlocked( $pUser->getBlock() ); + } + $params = $this->extractRequestParams(); $user = $this->getUrUser( $params ); @@ -63,8 +71,8 @@ class ApiUserrights extends ApiBase { ); $result = $this->getResult(); - $result->setIndexedTagName( $r['added'], 'group' ); - $result->setIndexedTagName( $r['removed'], 'group' ); + ApiResult::setIndexedTagName( $r['added'], 'group' ); + ApiResult::setIndexedTagName( $r['removed'], 'group' ); $result->addValue( null, $this->getModuleName(), $r ); }