diff --git a/maintenance/createOAuthConsumer.php b/maintenance/createOAuthConsumer.php index 7ce0814e..de70ec94 100644 --- a/maintenance/createOAuthConsumer.php +++ b/maintenance/createOAuthConsumer.php @@ -56,6 +56,11 @@ public function __construct() { $this->addOption( 'grants', 'Grants', true, true, false, true ); $this->addOption( 'jsonOnSuccess', 'Output successful results as JSON' ); $this->addOption( 'approve', 'Accept the consumer' ); + $this->addOption( + 'ownerOnly', + 'Make the consumer only usable by the given user; see ' . + 'https://www.mediawiki.org/wiki/OAuth/Owner-only_consumers.' + ); $this->requireExtension( "OAuth" ); } @@ -78,7 +83,7 @@ public function execute() { 'callbackIsPrefix' => $this->hasOption( 'callbackIsPrefix' ), 'grants' => '["' . implode( '","', $this->getOption( 'grants' ) ) . '"]', 'granttype' => 'normal', - 'ownerOnly' => false, + 'ownerOnly' => $this->hasOption( 'ownerOnly' ), // Only support OAuth 1 for now, but that requires valid values for OAuth 2 fields 'oauth2IsConfidential' => true, 'oauth2GrantTypes' => [ 'authorization_code', 'refresh_token' ],