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

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(-)

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



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: merged
Gerrit-Change-Id: I0212234d10243cc39a2cb18eb8d1e0f620e3123b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to