From 51ed2b35c14b5fa080e5415c25d046e7ea45cbe4 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 9 Mar 2013 23:01:45 +0100 Subject: [PATCH] Use User::groupHasPermission Instead of getting the rights of group '*' and searching for 'read', there is a method to do a direct lookup for group '*' and right 'read', makes the code easier to read. Change-Id: I1d5d6e1f4a94ded2b3f87144e031d0c2aac62020 --- includes/api/ApiMain.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 2bd01e029b..0450b37cc4 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -274,7 +274,7 @@ class ApiMain extends ApiBase { return; } - if ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) { + if ( !User::groupHasPermission( '*', 'read' ) ) { // Private wiki, only private headers if ( $mode !== 'private' ) { wfDebug( __METHOD__ . ": ignoring request for $mode cache mode, private wiki\n" ); @@ -769,7 +769,7 @@ class ApiMain extends ApiBase { */ protected function checkExecutePermissions( $module ) { $user = $this->getUser(); - if ( $module->isReadMode() && !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) && + if ( $module->isReadMode() && !User::groupHasPermission( '*', 'read' ) && !$user->isAllowed( 'read' ) ) { $this->dieUsageMsg( 'readrequired' ); -- 2.20.1