Gergő Tisza has uploaded a new change for review.

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

Change subject: Handle error message in SpecialMWOAuthManageConsumers
......................................................................

Handle error message in SpecialMWOAuthManageConsumers

DAO objects, when wrapped in MWOAuthDAOAccessControl, can return
a Message explaining that the user lacks permissions, instead of
the real value. SpecialMWOAuthManageConsumers expected the
'restrictions' field of MWOAuthConsumer to always be an MWRestrictions
object, which caused problems when trying to manage another user's
consumer without the mwoauthviewprivate right.

Bug: T125939
Change-Id: I0212234d10243cc39a2cb18eb8d1e0f620e3123b
---
M frontend/specialpages/SpecialMWOAuthManageConsumers.php
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/frontend/specialpages/SpecialMWOAuthManageConsumers.php 
b/frontend/specialpages/SpecialMWOAuthManageConsumers.php
index a074d78..da75e68 100755
--- a/frontend/specialpages/SpecialMWOAuthManageConsumers.php
+++ b/frontend/specialpages/SpecialMWOAuthManageConsumers.php
@@ -259,6 +259,7 @@
 
                $dbw = MWOAuthUtils::getCentralDB( DB_MASTER ); // @TODO: lazy 
handle
                $control = new MWOAuthConsumerSubmitControl( 
$this->getContext(), array(), $dbw );
+               $restrictions = $cmr->get( 'restrictions' );
                $form = new \HTMLForm(
                        $control->registerValidators( array(
                                'consumerKeyShown' => array(
@@ -334,7 +335,8 @@
                                'restrictions' => array(
                                        'type' => 'info',
                                        'label-message' => 
'mwoauth-consumer-restrictions-json',
-                                       'default' => $cmr->get( 'restrictions' 
)->toJson( true ),
+                                       'default' => $restrictions instanceof 
\MWRestrictions ?
+                                               $restrictions->toJson( true ) : 
$restrictions,
                                        'rows' => 5
                                ),
                                'rsaKey' => array(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0212234d10243cc39a2cb18eb8d1e0f620e3123b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

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

Reply via email to