CSteipp has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95701


Change subject: Include useoauth in UserIsEveryoneAllowed rights
......................................................................

Include useoauth in UserIsEveryoneAllowed rights

Return true for UserIsEveryoneAllowed, if the right is included in
useoauth, since all non-demo apps should include that right.

Not allowing read in UserIsEveryoneAllowed hook will have serious
performance impact on the wiki.

Bug: 56975
Change-Id: If4ff036f88fe822ee79672a04ca9dd90788deea4
---
M api/MWOAuthAPI.setup.php
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth 
refs/changes/01/95701/1

diff --git a/api/MWOAuthAPI.setup.php b/api/MWOAuthAPI.setup.php
index f4fda05..93541ef 100644
--- a/api/MWOAuthAPI.setup.php
+++ b/api/MWOAuthAPI.setup.php
@@ -201,13 +201,18 @@
        }
 
        /**
-        * Called to check if everyone has a particular user right
-        *
+        * Called to check if everyone has a particular user right. This hook 
is only reached
+        * if the right is assigned to '*' on the wiki, so we can safely return 
true for
+        * everything in $wgMWOAuthGrantPermissions['useoauth'], since most 
Consumers should
+        * include that grant.
         * @param string $right
         * @return boolean
         */
        public static function onUserIsEveryoneAllowed( $right ) {
-               /** @todo: If we implement a "default" grant, return true for 
rights granted there. */
+               global $wgMWOAuthGrantPermissions;
+               if ( array_key_exists( $right, 
$wgMWOAuthGrantPermissions['useoauth'] ) ) {
+                       return $wgMWOAuthGrantPermissions['useoauth'][$right];
+               }
                return false;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/95701
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4ff036f88fe822ee79672a04ca9dd90788deea4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: CSteipp <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to