@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 74 lines 2.3 kB view raw
1<?php 2 3final class PassphraseCredentialLockController 4 extends PassphraseController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $request->getViewer(); 8 $id = $request->getURIData('id'); 9 10 $credential = id(new PassphraseCredentialQuery()) 11 ->setViewer($viewer) 12 ->withIDs(array($id)) 13 ->requireCapabilities( 14 array( 15 PhabricatorPolicyCapability::CAN_VIEW, 16 PhabricatorPolicyCapability::CAN_EDIT, 17 )) 18 ->executeOne(); 19 if (!$credential) { 20 return new Aphront404Response(); 21 } 22 23 $type = PassphraseCredentialType::getTypeByConstant( 24 $credential->getCredentialType()); 25 if (!$type) { 26 throw new Exception(pht('Credential has invalid type "%s"!', $type)); 27 } 28 29 $view_uri = '/K'.$credential->getID(); 30 31 if ($credential->getIsLocked()) { 32 return $this->newDialog() 33 ->setTitle(pht('Credential Already Locked')) 34 ->appendChild( 35 pht('This credential is already locked.')) 36 ->addCancelButton($view_uri, pht('Close')); 37 } 38 39 if ($request->isFormPost()) { 40 $xactions = array(); 41 42 $xactions[] = id(new PassphraseCredentialTransaction()) 43 ->setTransactionType( 44 PassphraseCredentialConduitTransaction::TRANSACTIONTYPE) 45 ->setNewValue(0); 46 47 $xactions[] = id(new PassphraseCredentialTransaction()) 48 ->setTransactionType( 49 PassphraseCredentialLockTransaction::TRANSACTIONTYPE) 50 ->setNewValue(1); 51 52 $editor = id(new PassphraseCredentialTransactionEditor()) 53 ->setActor($viewer) 54 ->setContinueOnMissingFields(true) 55 ->setContinueOnNoEffect(true) 56 ->setContentSourceFromRequest($request) 57 ->applyTransactions($credential, $xactions); 58 59 return id(new AphrontRedirectResponse())->setURI($view_uri); 60 } 61 62 return $this->newDialog() 63 ->setTitle(pht('Lock Credential')) 64 ->appendChild( 65 pht( 66 'This credential will be locked and the secret will be hidden '. 67 'forever. If Conduit access is enabled, it will be revoked. '. 68 'Anything relying on this credential will still function. This '. 69 'operation can not be undone.')) 70 ->addSubmitButton(pht('Lock Credential')) 71 ->addCancelButton($view_uri); 72 } 73 74}