Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/passphrase/xaction/PassphraseCredentialConduitTransaction.php
12256 views
1
<?php
2
3
final class PassphraseCredentialConduitTransaction
4
extends PassphraseCredentialTransactionType {
5
6
const TRANSACTIONTYPE = 'passphrase:conduit';
7
8
public function generateOldValue($object) {
9
return $object->getAllowConduit();
10
}
11
12
public function applyInternalEffects($object, $value) {
13
$object->setAllowConduit((int)$value);
14
}
15
16
public function getTitle() {
17
$new = $this->getNewValue();
18
if ($new) {
19
return pht(
20
'%s allowed Conduit API access to this credential.',
21
$this->renderAuthor());
22
} else {
23
return pht(
24
'%s disallowed Conduit API access to this credential.',
25
$this->renderAuthor());
26
}
27
}
28
29
public function getTitleForFeed() {
30
$new = $this->getNewValue();
31
if ($new) {
32
return pht(
33
'%s allowed Conduit API access to credential %s.',
34
$this->renderAuthor(),
35
$this->renderObject());
36
} else {
37
return pht(
38
'%s disallowed Conduit API access to credential %s.',
39
$this->renderAuthor(),
40
$this->renderObject());
41
}
42
}
43
44
public function getIcon() {
45
$new = $this->getNewValue();
46
if ($new) {
47
return 'fa-tty';
48
} else {
49
return 'fa-ban';
50
}
51
}
52
53
}
54
55