Mattflaschen has uploaded a new change for review.

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

Change subject: Add OAuth support to Flow
......................................................................

Add OAuth support to Flow

Bug: T74998
Change-Id: Ie942c8f25f8b66755c9c77dc2cd1a2d11c042488
---
M Flow.php
M Hooks.php
2 files changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/10/213310/1

diff --git a/Flow.php b/Flow.php
index 88917f4..3038e1e 100644
--- a/Flow.php
+++ b/Flow.php
@@ -176,6 +176,7 @@
 $wgFlowGroupPermissions['flow-bot']['flow-create-board'] = true;
 $wgGroupPermissions = array_merge_recursive( $wgGroupPermissions, 
$wgFlowGroupPermissions );
 
+// Make sure all of these are granted via OAuth in Hooks.php
 $wgAvailableRights[] = 'flow-hide';
 $wgAvailableRights[] = 'flow-lock';
 $wgAvailableRights[] = 'flow-delete';
diff --git a/Hooks.php b/Hooks.php
index 245bca3..173c820 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -99,6 +99,27 @@
                if ( defined( 'MW_PHPUNIT_TEST' ) && file_exists( __DIR__ . 
'/vendor/autoload.php' ) ) {
                        require_once __DIR__ . '/vendor/autoload.php';
                }
+
+               if ( class_exists( 'MediaWiki\Extensions\OAuth\MWOAuthUtils' ) 
) {
+                       global $wgMWOAuthGrantPermissions;
+
+                       // This is semantically equivalent to editing a talk 
page and
+                       // blanking an offending post or topic.
+                       $wgMWOAuthGrantPermissions['editpage']['flow-hide'] = 
true;
+
+                       // We might want to make a separate grant for this, so 
it can be
+                       // given out without giving out core 'protect'.
+                       $wgMWOAuthGrantPermissions['protect']['flow-lock'] = 
true;
+
+                       $wgMWOAuthGrantPermissions['delete']['flow-delete'] = 
true;
+                       $wgMWOAuthGrantPermissions['delete']['flow-suppress'] = 
true;
+                       
$wgMWOAuthGrantPermissions['editpage']['flow-edit-post'] = true;
+
+                       // Creating a board somewhere it normally can't be 
created is sort
+                       // of like creating a page that can't normally be 
edited.  But
+                       // maybe make a grant.
+                       
$wgMWOAuthGrantPermissions['editprotected']['flow-create-board'] = true;
+               }
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie942c8f25f8b66755c9c77dc2cd1a2d11c042488
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to