3 final class PhabricatorAuthManagementUntrustOAuthClientWorkflow
4 extends PhabricatorAuthManagementWorkflow
{
6 protected function didConstruct() {
8 ->setName('untrust-oauth-client')
9 ->setExamples('**untrust-oauth-client** [--id client_id]')
12 'Remove trust from an OAuth client. Users must manually confirm '.
13 'reauthorization of untrusted OAuth clients.'))
19 'help' => pht('The id of the OAuth client.'),
24 public function execute(PhutilArgumentParser
$args) {
25 $id = $args->getArg('id');
28 throw new PhutilArgumentUsageException(
30 'Specify an OAuth client ID with %s.',
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 untrusted.',
52 $client->setIsTrusted(0);
55 $console = PhutilConsole
::getConsole();
59 'OAuth client "%s" is now trusted.',