@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

Expose dashboard policy editing to UI

Summary: Fixes T4981, Allow Dashboard view and edit policies to be configured

Test Plan: Create dashboard, edit dashboard, make sure user can edit who can edit and who can see dashboard.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4981

Differential Revision: https://secure.phabricator.com/D9243

authored by

lkassianik and committed by
epriestley
fbbb43c4 0bf18d5f

+32
+30
src/applications/dashboard/controller/PhabricatorDashboardEditController.php
··· 64 64 if ($request->isFormPost()) { 65 65 $v_name = $request->getStr('name'); 66 66 $v_layout_mode = $request->getStr('layout_mode'); 67 + $v_view_policy = $request->getStr('viewPolicy'); 68 + $v_edit_policy = $request->getStr('editPolicy'); 67 69 68 70 $xactions = array(); 69 71 70 72 $type_name = PhabricatorDashboardTransaction::TYPE_NAME; 71 73 $type_layout_mode = PhabricatorDashboardTransaction::TYPE_LAYOUT_MODE; 74 + $type_view_policy = PhabricatorTransactions::TYPE_VIEW_POLICY; 75 + $type_edit_policy = PhabricatorTransactions::TYPE_EDIT_POLICY; 72 76 73 77 $xactions[] = id(new PhabricatorDashboardTransaction()) 74 78 ->setTransactionType($type_name) ··· 76 80 $xactions[] = id(new PhabricatorDashboardTransaction()) 77 81 ->setTransactionType($type_layout_mode) 78 82 ->setNewValue($v_layout_mode); 83 + $xactions[] = id(new PhabricatorDashboardTransaction()) 84 + ->setTransactionType($type_view_policy) 85 + ->setNewValue($v_view_policy); 86 + $xactions[] = id(new PhabricatorDashboardTransaction()) 87 + ->setTransactionType($type_edit_policy) 88 + ->setNewValue($v_edit_policy); 79 89 80 90 try { 81 91 $editor = id(new PhabricatorDashboardTransactionEditor()) ··· 94 104 $validation_exception = $ex; 95 105 96 106 $e_name = $validation_exception->getShortMessage($type_name); 107 + 108 + $dashboard->setViewPolicy($v_view_policy); 109 + $dashboard->setEditPolicy($v_edit_policy); 97 110 } 98 111 } 99 112 113 + $policies = id(new PhabricatorPolicyQuery()) 114 + ->setViewer($viewer) 115 + ->setObject($dashboard) 116 + ->execute(); 117 + 100 118 $layout_mode_options = 101 119 PhabricatorDashboardLayoutConfig::getLayoutModeSelectOptions(); 102 120 $form = id(new AphrontFormView()) ··· 107 125 ->setName('name') 108 126 ->setValue($v_name) 109 127 ->setError($e_name)) 128 + ->appendChild( 129 + id(new AphrontFormPolicyControl()) 130 + ->setName('viewPolicy') 131 + ->setPolicyObject($dashboard) 132 + ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) 133 + ->setPolicies($policies)) 134 + ->appendChild( 135 + id(new AphrontFormPolicyControl()) 136 + ->setName('editPolicy') 137 + ->setPolicyObject($dashboard) 138 + ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) 139 + ->setPolicies($policies)) 110 140 ->appendChild( 111 141 id(new AphrontFormSelectControl()) 112 142 ->setLabel(pht('Layout Mode'))
+2
src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php
··· 89 89 switch ($xaction->getTransactionType()) { 90 90 case PhabricatorDashboardTransaction::TYPE_NAME: 91 91 case PhabricatorDashboardTransaction::TYPE_LAYOUT_MODE: 92 + case PhabricatorTransactions::TYPE_VIEW_POLICY: 93 + case PhabricatorTransactions::TYPE_EDIT_POLICY: 92 94 return; 93 95 case PhabricatorTransactions::TYPE_EDGE: 94 96 return;