3 final class PhabricatorAuthManagementTrustOAuthClientWorkflow
4 extends PhabricatorAuthManagementWorkflow
{
6 protected function didConstruct() {
8 ->setName('trust-oauth-client')
9 ->setExamples('**trust-oauth-client** [--id client_id]')
12 'Mark an OAuth client as trusted. Trusted OAuth clients may be '.
13 'reauthorized without requiring users to manually confirm the '.
20 'help' => pht('The id of the OAuth client.'),
25 public function execute(PhutilArgumentParser
$args) {
26 $id = $args->getArg('id');
29 throw new PhutilArgumentUsageException(
31 'Specify an OAuth client id with "--id".'));
34 $client = id(new PhabricatorOAuthServerClientQuery())
35 ->setViewer($this->getViewer())
40 throw new PhutilArgumentUsageException(
42 'Failed to find an OAuth client with id %s.', $id));
45 if ($client->getIsTrusted()) {
46 throw new PhutilArgumentUsageException(
48 'OAuth client "%s" is already trusted.',
52 $client->setIsTrusted(1);
55 $console = PhutilConsole
::getConsole();
59 'OAuth client "%s" is now trusted.',