mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-02 19:52:44 +01:00
fa1ecb7f66
Summary: Ref T13043. Adds CLI support for revoking SSH keys. Also retargets UI language from "Deactivate" to "Revoke" to make it more clear that this is a one-way operation. This operation is already correctly implemented as a "Revoke" operation. Test Plan: Used `bin/auth revoke --type ssh` to revoke keys, verified they became revoked (with proper transactions) in the UI. Revoked keys from the web UI flow. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13043 Differential Revision: https://secure.phabricator.com/D18893
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class PhabricatorAuthSSHKeyTransaction
|
|
extends PhabricatorApplicationTransaction {
|
|
|
|
const TYPE_NAME = 'sshkey.name';
|
|
const TYPE_KEY = 'sshkey.key';
|
|
const TYPE_DEACTIVATE = 'sshkey.deactivate';
|
|
|
|
public function getApplicationName() {
|
|
return 'auth';
|
|
}
|
|
|
|
public function getApplicationTransactionType() {
|
|
return PhabricatorAuthSSHKeyPHIDType::TYPECONST;
|
|
}
|
|
|
|
public function getApplicationTransactionCommentObject() {
|
|
return null;
|
|
}
|
|
|
|
public function getTitle() {
|
|
$author_phid = $this->getAuthorPHID();
|
|
|
|
$old = $this->getOldValue();
|
|
$new = $this->getNewValue();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case PhabricatorTransactions::TYPE_CREATE:
|
|
return pht(
|
|
'%s created this key.',
|
|
$this->renderHandleLink($author_phid));
|
|
case self::TYPE_NAME:
|
|
return pht(
|
|
'%s renamed this key from "%s" to "%s".',
|
|
$this->renderHandleLink($author_phid),
|
|
$old,
|
|
$new);
|
|
case self::TYPE_KEY:
|
|
return pht(
|
|
'%s updated the public key material for this SSH key.',
|
|
$this->renderHandleLink($author_phid));
|
|
case self::TYPE_DEACTIVATE:
|
|
if ($new) {
|
|
return pht(
|
|
'%s revoked this key.',
|
|
$this->renderHandleLink($author_phid));
|
|
} else {
|
|
return pht(
|
|
'%s reinstated this key.',
|
|
$this->renderHandleLink($author_phid));
|
|
}
|
|
|
|
}
|
|
|
|
return parent::getTitle();
|
|
}
|
|
|
|
}
|