From d40d4a9bc77d8dee1df62073038058f33d11cc39 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 5 Oct 2012 21:03:17 +0200 Subject: [PATCH] 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 --- includes/api/ApiQueryAllUsers.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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'] ) ) { -- 2.20.1