Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/calendar/policyrule/PhabricatorCalendarEventHostPolicyRule.php
12256 views
1
<?php
2
3
final class PhabricatorCalendarEventHostPolicyRule
4
extends PhabricatorPolicyRule {
5
6
public function getObjectPolicyKey() {
7
return 'calendar.event.host';
8
}
9
10
public function getObjectPolicyName() {
11
return pht('Event Host');
12
}
13
14
public function getPolicyExplanation() {
15
return pht('The host of this event can take this action.');
16
}
17
18
public function getRuleDescription() {
19
return pht('event host');
20
}
21
22
public function canApplyToObject(PhabricatorPolicyInterface $object) {
23
return ($object instanceof PhabricatorCalendarEvent);
24
}
25
26
public function applyRule(
27
PhabricatorUser $viewer,
28
$value,
29
PhabricatorPolicyInterface $object) {
30
31
$viewer_phid = $viewer->getPHID();
32
if (!$viewer_phid) {
33
return false;
34
}
35
36
return ($object->getHostPHID() == $viewer_phid);
37
}
38
39
public function getValueControlType() {
40
return self::CONTROL_TYPE_NONE;
41
}
42
43
}
44
45