Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/metamta/herald/PhabricatorMailMustEncryptHeraldAction.php
12256 views
1
<?php
2
3
final class PhabricatorMailMustEncryptHeraldAction
4
extends HeraldAction {
5
6
const DO_MUST_ENCRYPT = 'do.must-encrypt';
7
8
const ACTIONCONST = 'email.must-encrypt';
9
10
public function getHeraldActionName() {
11
return pht('Require secure email');
12
}
13
14
public function renderActionDescription($value) {
15
return pht(
16
'Require mail content be transmitted only over secure channels.');
17
}
18
public function supportsObject($object) {
19
return PhabricatorMetaMTAEmailHeraldAction::isMailGeneratingObject($object);
20
}
21
22
public function getActionGroupKey() {
23
return HeraldUtilityActionGroup::ACTIONGROUPKEY;
24
}
25
26
public function supportsRuleType($rule_type) {
27
return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
28
}
29
30
public function getHeraldActionStandardType() {
31
return self::STANDARD_NONE;
32
}
33
34
public function applyEffect($object, HeraldEffect $effect) {
35
$rule_phid = $effect->getRule()->getPHID();
36
37
$adapter = $this->getAdapter();
38
$adapter->addMustEncryptReason($rule_phid);
39
40
$this->logEffect(self::DO_MUST_ENCRYPT, array($rule_phid));
41
}
42
43
protected function getActionEffectMap() {
44
return array(
45
self::DO_MUST_ENCRYPT => array(
46
'icon' => 'fa-shield',
47
'color' => 'blue',
48
'name' => pht('Must Encrypt'),
49
),
50
);
51
}
52
53
protected function renderActionEffectDescription($type, $data) {
54
switch ($type) {
55
case self::DO_MUST_ENCRYPT:
56
return pht(
57
'Made it a requirement that mail content be transmitted only '.
58
'over secure channels.');
59
}
60
}
61
62
}
63
64