@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 63 lines 1.6 kB view raw
1<?php 2 3final class PhabricatorAuthManagementUntrustOAuthClientWorkflow 4 extends PhabricatorAuthManagementWorkflow { 5 6 protected function didConstruct() { 7 $this 8 ->setName('untrust-oauth-client') 9 ->setExamples('**untrust-oauth-client** [--id client_id]') 10 ->setSynopsis( 11 pht( 12 'Remove trust from an OAuth client. Users must manually confirm '. 13 'reauthorization of untrusted OAuth clients.')) 14 ->setArguments( 15 array( 16 array( 17 'name' => 'id', 18 'param' => 'id', 19 'help' => pht('The id of the OAuth client.'), 20 ), 21 )); 22 } 23 24 public function execute(PhutilArgumentParser $args) { 25 $id = $args->getArg('id'); 26 27 if (!$id) { 28 throw new PhutilArgumentUsageException( 29 pht( 30 'Specify an OAuth client ID with %s.', 31 '--id')); 32 } 33 34 $client = id(new PhabricatorOAuthServerClientQuery()) 35 ->setViewer($this->getViewer()) 36 ->withIDs(array($id)) 37 ->executeOne(); 38 39 if (!$client) { 40 throw new PhutilArgumentUsageException( 41 pht( 42 'Failed to find an OAuth client with ID %s.', $id)); 43 } 44 45 if (!$client->getIsTrusted()) { 46 throw new PhutilArgumentUsageException( 47 pht( 48 'OAuth client "%s" is already untrusted.', 49 $client->getName())); 50 } 51 52 $client->setIsTrusted(0); 53 $client->save(); 54 55 $console = PhutilConsole::getConsole(); 56 $console->writeOut( 57 "%s\n", 58 pht( 59 'OAuth client "%s" is now trusted.', 60 $client->getName())); 61 } 62 63}