Differential D15943 Diff 38392 src/applications/almanac/management/AlmanacManagementTrustKeyWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/management/AlmanacManagementTrustKeyWorkflow.php
| Show All 29 Lines | $key = id(new PhabricatorAuthSSHKeyQuery()) | ||||
| ->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
| ->withIDs(array($id)) | ->withIDs(array($id)) | ||||
| ->executeOne(); | ->executeOne(); | ||||
| if (!$key) { | if (!$key) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| pht('No public key exists with ID "%s".', $id)); | pht('No public key exists with ID "%s".', $id)); | ||||
| } | } | ||||
| if (!$key->getIsActive()) { | |||||
| throw new PhutilArgumentUsageException( | |||||
| pht('Public key "%s" is not an active key.', $id)); | |||||
| } | |||||
| if ($key->getIsTrusted()) { | if ($key->getIsTrusted()) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| pht('Public key with ID %s is already trusted.', $id)); | pht('Public key with ID %s is already trusted.', $id)); | ||||
| } | } | ||||
| if (!($key->getObject() instanceof AlmanacDevice)) { | if (!($key->getObject() instanceof AlmanacDevice)) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| pht('You can only trust keys associated with Almanac devices.')); | pht('You can only trust keys associated with Almanac devices.')); | ||||
| Show All 40 Lines | |||||