@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class ManiphestTaskAuthorPolicyRule
4 extends PhabricatorPolicyRule {
5
6 public function getObjectPolicyKey() {
7 return 'maniphest.author';
8 }
9
10 public function getObjectPolicyName() {
11 return pht('Task Author');
12 }
13
14 public function getPolicyExplanation() {
15 return pht('The author of this task can take this action.');
16 }
17
18 public function getRuleDescription() {
19 return pht('task author');
20 }
21
22 public function canApplyToObject(PhabricatorPolicyInterface $object) {
23 return ($object instanceof ManiphestTask);
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->getAuthorPHID() == $viewer_phid);
37 }
38
39 public function getValueControlType() {
40 return self::CONTROL_TYPE_NONE;
41 }
42
43}