From f02557a42436b00bf3731dbcf9d9db3883c6cfbb Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 15 Feb 2010 20:42:43 +0000 Subject: [PATCH] API: Redo r62540 for all modules, easier than I first imagined --- includes/api/ApiMain.php | 4 ++-- includes/api/ApiOpenSearch.php | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 55de405066..ac782b34b5 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -432,8 +432,8 @@ class ApiMain extends ApiBase { } } - global $wgUser; - if ( $module->isReadMode() && !$wgUser->isAllowed( 'read' ) ) + global $wgUser, $wgGroupPermissions; + if ( $module->isReadMode() && !$wgGroupPermissions['*']['read'] && !$wgUser->isAllowed( 'read' ) ) $this->dieUsageMsg( array( 'readrequired' ) ); if ( $module->isWriteMode() ) { if ( !$this->mEnableWrite ) diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index e11d7e65bb..567f36bc0f 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -42,15 +42,15 @@ class ApiOpenSearch extends ApiBase { } public function execute() { - global $wgEnableOpenSearchSuggest, $wgSearchSuggestCacheExpiry, $wgGroupPermissions, $wgUser; + global $wgEnableOpenSearchSuggest, $wgSearchSuggestCacheExpiry; $params = $this->extractRequestParams(); $search = $params['search']; $limit = $params['limit']; $namespaces = $params['namespace']; $suggest = $params['suggest']; - // MWSuggest or similar hit, or hit without read rights - if ( ( $suggest && !$wgEnableOpenSearchSuggest ) || ( !$wgGroupPermissions['*']['read'] && !$wgUser->isAllowed( 'read' ) ) ) + // MWSuggest or similar hit + if ( $suggest && !$wgEnableOpenSearchSuggest ) $srchres = array(); else { // Open search results may be stored for a very long @@ -108,8 +108,4 @@ class ApiOpenSearch extends ApiBase { public function getVersion() { return __CLASS__ . ': $Id$'; } - - public function isReadMode() { - return false; - } } -- 2.20.1