jenkins-bot has submitted this change and it was merged.

Change subject: Disable checkbox for implicit grants hidden on the 
Special:MWOAuthManageMyGrants form
......................................................................


Disable checkbox for implicit grants hidden on the 
Special:MWOAuthManageMyGrants form

Change-Id: If9c00b75469c71d24dfea2f26e3d38bf4e59bd5b
---
M backend/MWOAuthUtils.php
M frontend/specialpages/SpecialMWOAuth.php
M frontend/specialpages/SpecialMWOAuthManageMyGrants.php
3 files changed, 22 insertions(+), 1 deletion(-)

Approvals:
  CSteipp: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/backend/MWOAuthUtils.php b/backend/MWOAuthUtils.php
index 0e75e7b..441d60f 100644
--- a/backend/MWOAuthUtils.php
+++ b/backend/MWOAuthUtils.php
@@ -220,6 +220,23 @@
        }
 
        /**
+        * Get the list of grants that are hidden and should always be granted
+        *
+        * @return array
+        */
+       public static function getHiddenGrants() {
+               global $wgMWOAuthGrantPermissionGroups;
+
+               $grants = array();
+               foreach ( $wgMWOAuthGrantPermissionGroups as $grant => $group ) 
{
+                       if ( $group === 'hidden' ) {
+                               $grants[] = $grant;
+                       }
+               }
+               return $grants;
+       }
+
+       /**
         * @param array $restrictions
         * @return bool
         */
diff --git a/frontend/specialpages/SpecialMWOAuth.php 
b/frontend/specialpages/SpecialMWOAuth.php
index 8c67e7e..222a435 100644
--- a/frontend/specialpages/SpecialMWOAuth.php
+++ b/frontend/specialpages/SpecialMWOAuth.php
@@ -223,7 +223,7 @@
                $s = '';
                foreach ( MWOAuthUtils::getGrantGroups( $grants ) as $group => 
$grants ) {
                        if ( $group === 'hidden' ) {
-                               continue;
+                               continue; // implicitly granted
                        }
                        $s .= "*<strong>" . wfMessage( 
"mwoauth-grant-group-$group" )->text() . "</strong>\n";
                        $s .= ":" . $this->getLanguage()->semicolonList(
diff --git a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php 
b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
index c403cf1..7b1da0f 100644
--- a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
+++ b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
@@ -187,6 +187,10 @@
                                                        
MWOAuthUtils::getRightsByGrant()
                                                )
                                        ),
+                                       'force-options-on' => array_map(
+                                               function( $g ) { return 
"grant-$g"; },
+                                               MWOAuthUtils::getHiddenGrants()
+                                       ),
                                        'validation-callback' => null // 
different format
                                ),
                                'acceptanceId' => array(

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If9c00b75469c71d24dfea2f26e3d38bf4e59bd5b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to