From: umherirrender Date: Fri, 5 Oct 2012 19:03:17 +0000 (+0200) Subject: list=allusers&aurights=[unusedright] returns all users of the wiki X-Git-Tag: 1.31.0-rc.0~21813^2 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=d40d4a9bc77d8dee1df62073038058f33d11cc39;p=lhc%2Fweb%2Fwiklou.git list=allusers&aurights=[unusedright] returns all users of the wiki Filter for an unused right gives an empty group array, which is not added to the query and than all users (with limit) are selected. Change-Id: I57c3c4d2b49653d71391b0d7755fdc0ad1d3a7d0 --- diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 7f50cbad2e..79f6469442 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -81,12 +81,18 @@ class ApiQueryAllUsers extends ApiQueryBase { $db->buildLike( $this->getCanonicalUserName( $params['prefix'] ), $db->anyString() ) ); } - if ( !is_null( $params['rights'] ) ) { + if ( !is_null( $params['rights'] ) && count( $params['rights'] ) ) { $groups = array(); foreach( $params['rights'] as $r ) { $groups = array_merge( $groups, User::getGroupsWithPermission( $r ) ); } + // no group with the given right(s) exists, no need for a query + if( !count( $groups ) ) { + $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), '' ); + return; + } + $groups = array_unique( $groups ); if ( is_null( $params['group'] ) ) {