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

Straighten out Drydock policies for Resources

Summary: Ref T9252. Resources always have a corresponding blueprint, and it makes sense to use the same policies for both.

Test Plan: Viewed resources in web UI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9252

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

+9 -10
+4 -2
src/applications/drydock/controller/DrydockResourceViewController.php
··· 17 17 $title = pht('Resource %s %s', $resource->getID(), $resource->getName()); 18 18 19 19 $header = id(new PHUIHeaderView()) 20 + ->setUser($viewer) 21 + ->setPolicyObject($resource) 20 22 ->setHeader($title); 21 23 22 24 $actions = $this->buildActionListView($resource); ··· 117 119 PhabricatorActionListView $actions) { 118 120 $viewer = $this->getViewer(); 119 121 120 - $view = new PHUIPropertyListView(); 121 - $view->setActionList($actions); 122 + $view = id(new PHUIPropertyListView()) 123 + ->setActionList($actions); 122 124 123 125 $status = $resource->getStatus(); 124 126 $status = DrydockResourceStatus::getNameForStatus($status);
+5 -8
src/applications/drydock/storage/DrydockResource.php
··· 223 223 } 224 224 225 225 public function getPolicy($capability) { 226 - switch ($capability) { 227 - case PhabricatorPolicyCapability::CAN_VIEW: 228 - case PhabricatorPolicyCapability::CAN_EDIT: 229 - // TODO: Implement reasonable policies. 230 - return PhabricatorPolicies::getMostOpenPolicy(); 231 - } 226 + return $this->getBlueprint()->getPolicy($capability); 232 227 } 233 228 234 229 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 235 - return false; 230 + return $this->getBlueprint()->hasAutomaticCapability( 231 + $capability, 232 + $viewer); 236 233 } 237 234 238 235 public function describeAutomaticCapability($capability) { 239 - return null; 236 + return pht('Resources inherit the policies of their blueprints.'); 240 237 } 241 238 }