Path: blob/master/src/applications/auth/controller/PhabricatorAuthSSHKeyRevokeController.php
12256 views
<?php12final class PhabricatorAuthSSHKeyRevokeController3extends PhabricatorAuthSSHKeyController {45public function handleRequest(AphrontRequest $request) {6$viewer = $this->getViewer();78$key = id(new PhabricatorAuthSSHKeyQuery())9->setViewer($viewer)10->withIDs(array($request->getURIData('id')))11->requireCapabilities(12array(13PhabricatorPolicyCapability::CAN_VIEW,14PhabricatorPolicyCapability::CAN_EDIT,15))16->executeOne();17if (!$key) {18return new Aphront404Response();19}2021$cancel_uri = $key->getURI();2223$token = id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(24$viewer,25$request,26$cancel_uri);2728if ($request->isFormPost()) {29$xactions = array();3031$xactions[] = id(new PhabricatorAuthSSHKeyTransaction())32->setTransactionType(PhabricatorAuthSSHKeyTransaction::TYPE_DEACTIVATE)33->setNewValue(true);3435id(new PhabricatorAuthSSHKeyEditor())36->setActor($viewer)37->setContentSourceFromRequest($request)38->setContinueOnNoEffect(true)39->setContinueOnMissingFields(true)40->applyTransactions($key, $xactions);4142return id(new AphrontRedirectResponse())->setURI($cancel_uri);43}4445$name = phutil_tag('strong', array(), $key->getName());4647return $this->newDialog()48->setTitle(pht('Revoke SSH Public Key'))49->appendParagraph(50pht(51'The key "%s" will be permanently revoked, and you will no '.52'longer be able to use the corresponding private key to '.53'authenticate.',54$name))55->addSubmitButton(pht('Revoke Public Key'))56->addCancelButton($cancel_uri);57}5859}606162