3 final class PhabricatorApplicationTransactionValueController
4 extends PhabricatorApplicationTransactionController
{
6 public function shouldAllowPublic() {
10 public function handleRequest(AphrontRequest
$request) {
11 $viewer = $this->getViewer();
12 $phid = $request->getURIData('phid');
13 $type = $request->getURIData('value');
15 $xaction = id(new PhabricatorObjectQuery())
17 ->withPHIDs(array($phid))
20 return new Aphront404Response();
23 // For now, this pathway only supports policy transactions
24 // to show the details of custom policies. If / when this pathway
25 // supports more transaction types, rendering coding should be moved
26 // into PhabricatorTransactions e.g. feed rendering code.
28 // TODO: This should be some kind of "hey do you support this?" thing on
29 // the transactions themselves.
31 switch ($xaction->getTransactionType()) {
32 case PhabricatorTransactions
::TYPE_VIEW_POLICY
:
33 case PhabricatorTransactions
::TYPE_EDIT_POLICY
:
34 case PhabricatorTransactions
::TYPE_JOIN_POLICY
:
35 case PhabricatorRepositoryPushPolicyTransaction
::TRANSACTIONTYPE
:
36 case PhabricatorApplicationPolicyChangeTransaction
::TRANSACTIONTYPE
:
39 return new Aphront404Response();
44 $value = $xaction->getOldValue();
46 $value = $xaction->getNewValue();
49 $policy = id(new PhabricatorPolicyQuery())
51 ->withPHIDs(array($value))
54 return new Aphront404Response();
57 if ($policy->getType() != PhabricatorPolicyType
::TYPE_CUSTOM
) {
58 return new Aphront404Response();
61 $rules_view = id(new PhabricatorPolicyRulesView())
65 $cancel_uri = $this->guessCancelURI($viewer, $xaction);
67 return $this->newDialog()
68 ->setTitle($policy->getFullName())
69 ->setWidth(AphrontDialogView
::WIDTH_FORM
)
70 ->appendChild($rules_view)
71 ->addCancelButton($cancel_uri, pht('Close'));