diff --git a/src/applications/drydock/controller/DrydockResourceViewController.php b/src/applications/drydock/controller/DrydockResourceViewController.php index 659f7b4fc1..be1db24a0c 100644 --- a/src/applications/drydock/controller/DrydockResourceViewController.php +++ b/src/applications/drydock/controller/DrydockResourceViewController.php @@ -17,6 +17,8 @@ final class DrydockResourceViewController extends DrydockResourceController { $title = pht('Resource %s %s', $resource->getID(), $resource->getName()); $header = id(new PHUIHeaderView()) + ->setUser($viewer) + ->setPolicyObject($resource) ->setHeader($title); $actions = $this->buildActionListView($resource); @@ -117,8 +119,8 @@ final class DrydockResourceViewController extends DrydockResourceController { PhabricatorActionListView $actions) { $viewer = $this->getViewer(); - $view = new PHUIPropertyListView(); - $view->setActionList($actions); + $view = id(new PHUIPropertyListView()) + ->setActionList($actions); $status = $resource->getStatus(); $status = DrydockResourceStatus::getNameForStatus($status); diff --git a/src/applications/drydock/storage/DrydockResource.php b/src/applications/drydock/storage/DrydockResource.php index a2962ee293..f2be89a6f2 100644 --- a/src/applications/drydock/storage/DrydockResource.php +++ b/src/applications/drydock/storage/DrydockResource.php @@ -223,19 +223,16 @@ final class DrydockResource extends DrydockDAO } public function getPolicy($capability) { - switch ($capability) { - case PhabricatorPolicyCapability::CAN_VIEW: - case PhabricatorPolicyCapability::CAN_EDIT: - // TODO: Implement reasonable policies. - return PhabricatorPolicies::getMostOpenPolicy(); - } + return $this->getBlueprint()->getPolicy($capability); } public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { - return false; + return $this->getBlueprint()->hasAutomaticCapability( + $capability, + $viewer); } public function describeAutomaticCapability($capability) { - return null; + return pht('Resources inherit the policies of their blueprints.'); } }