1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-11 08:06:13 +01:00
phorge-phorge/src/applications/passphrase/xaction/PassphraseCredentialConduitTransaction.php
Chad Little 06eae5578b Update Passphrase for modular transactions
Summary: Updates Passphrase for modular transactions.

Test Plan: Create, edit, lock, view, lots of different types of Passphrases. Enable Conduit, Lock Passphrases, Destroy Secrets from the interface and verify from the DB it was eradicated.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17824
2017-05-04 11:31:37 -07:00

53 lines
1.2 KiB
PHP

<?php
final class PassphraseCredentialConduitTransaction
extends PassphraseCredentialTransactionType {
const TRANSACTIONTYPE = 'passphrase:conduit';
public function generateOldValue($object) {
return $object->getAllowConduit();
}
public function applyInternalEffects($object, $value) {
$object->setAllowConduit((int)$value);
}
public function getTitle() {
$new = $this->getNewValue();
if ($new) {
return pht(
'%s allowed Conduit API access to this credential.',
$this->renderAuthor());
} else {
return pht(
'%s disallowed Conduit API access to this credential.',
$this->renderAuthor());
}
}
public function getTitleForFeed() {
$new = $this->getNewValue();
if ($new) {
return pht(
'%s allowed Conduit API access to credential %s.',
$this->renderAuthor(),
$this->renderObject());
} else {
return pht(
'%s disallowed Conduit API access to credential %s.',
$this->renderAuthor(),
$this->renderObject());
}
}
public function getIcon() {
$new = $this->getNewValue();
if ($new) {
return 'fa-tty';
} else {
return 'fa-ban';
}
}
}