3 final class PhabricatorPolicyRef
9 public function setViewer(PhabricatorUser
$viewer) {
10 $this->viewer
= $viewer;
14 public function getViewer() {
18 public function setPolicy(PhabricatorPolicy
$policy) {
19 $this->policy
= $policy;
23 public function getPolicy() {
27 public function getPolicyDisplayName() {
28 $policy = $this->getPolicy();
29 return $policy->getFullName();
32 public function newTransactionLink(
34 PhabricatorApplicationTransaction
$xaction) {
36 $policy = $this->getPolicy();
38 if ($policy->isCustomPolicy()) {
40 '/transactions/%s/%s/',
45 $uri = $policy->getHref();
49 return $this->newLink($uri, $workflow);
52 public function newCapabilityLink($object, $capability) {
53 $policy = $this->getPolicy();
56 '/policy/explain/%s/%s/',
60 return $this->newLink($uri, true);
63 private function newLink($uri, $workflow) {
64 $policy = $this->getPolicy();
65 $name = $policy->getName();
72 'sigil' => ($workflow ?
'workflow' : null),
77 $hint = $this->getPolicyTypeHint();
79 $name = pht('%s (%s)', $name, $hint);
85 private function getPolicyTypeHint() {
86 $policy = $this->getPolicy();
88 if ($policy->isProjectPolicy()) {
89 return pht('Project');
92 if ($policy->isMaskedPolicy()) {
93 return pht('You do not have permission to view policy details.');