Page MenuHomePhabricator

D14154.diff
No OneTemporary

D14154.diff

diff --git a/src/applications/drydock/controller/DrydockResourceViewController.php b/src/applications/drydock/controller/DrydockResourceViewController.php
--- a/src/applications/drydock/controller/DrydockResourceViewController.php
+++ b/src/applications/drydock/controller/DrydockResourceViewController.php
@@ -17,6 +17,8 @@
$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 @@
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
--- a/src/applications/drydock/storage/DrydockResource.php
+++ b/src/applications/drydock/storage/DrydockResource.php
@@ -223,19 +223,16 @@
}
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.');
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 8:36 PM (15 h, 45 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723022
Default Alt Text
D14154.diff (1 KB)

Event Timeline