@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
3interface PhabricatorPolicyInterface extends PhabricatorPHIDInterface {
4
5 /**
6 * @return array<string> Array of string constants defined in
7 * @{class:PhabricatorPolicyCapability} or in a child class of it
8 */
9 public function getCapabilities();
10
11 /**
12 * @param PhabricatorPolicyCapability $capability
13 * @return string A PhabricatorPolicyConstant
14 */
15 public function getPolicy($capability);
16
17 /**
18 * Whether an object provides automatic capability grants to a user (e.g. the
19 * owner of an object can always see it even if a capability is set to NOONE)
20 *
21 * @param PhabricatorPolicyCapability $capability
22 * @param PhabricatorUser $viewer
23 * @return bool
24 */
25 public function hasAutomaticCapability($capability, PhabricatorUser $viewer);
26
27}
28
29// TEMPLATE IMPLEMENTATION /////////////////////////////////////////////////////
30
31/* -( PhabricatorPolicyInterface )----------------------------------------- */
32/*
33
34 public function getCapabilities() {
35 return array(
36 PhabricatorPolicyCapability::CAN_VIEW,
37 );
38 }
39
40 public function getPolicy($capability) {
41 switch ($capability) {
42 case PhabricatorPolicyCapability::CAN_VIEW:
43 return PhabricatorPolicies::POLICY_USER;
44 }
45 }
46
47 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
48 return false;
49 }
50
51*/