@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 recaptime-dev/main 63 lines 1.6 kB view raw
1<?php 2 3final class PhabricatorAuthManagementTrustOAuthClientWorkflow 4 extends PhabricatorAuthManagementWorkflow { 5 6 protected function didConstruct() { 7 $this 8 ->setName('trust-oauth-client') 9 ->setExamples('**trust-oauth-client** [--id client_id]') 10 ->setSynopsis( 11 pht( 12 'Mark an OAuth client as trusted. Trusted OAuth clients may be '. 13 'reauthorized without requiring users to manually confirm the '. 14 'action.')) 15 ->setArguments( 16 array( 17 array( 18 'name' => 'id', 19 'param' => 'id', 20 'help' => pht('The id of the OAuth client.'), 21 ), 22 )); 23 } 24 25 public function execute(PhutilArgumentParser $args) { 26 $id = $args->getArg('id'); 27 28 if (!$id) { 29 throw new PhutilArgumentUsageException( 30 pht( 31 'Specify an OAuth client id with "--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 trusted.', 49 $client->getName())); 50 } 51 52 $client->setIsTrusted(1); 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}