mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
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
This commit is contained in:
parent
e117ace8c7
commit
b71ce90b9c
2 changed files with 9 additions and 10 deletions
|
@ -17,6 +17,8 @@ final class DrydockResourceViewController extends DrydockResourceController {
|
||||||
$title = pht('Resource %s %s', $resource->getID(), $resource->getName());
|
$title = pht('Resource %s %s', $resource->getID(), $resource->getName());
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$header = id(new PHUIHeaderView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setPolicyObject($resource)
|
||||||
->setHeader($title);
|
->setHeader($title);
|
||||||
|
|
||||||
$actions = $this->buildActionListView($resource);
|
$actions = $this->buildActionListView($resource);
|
||||||
|
@ -117,8 +119,8 @@ final class DrydockResourceViewController extends DrydockResourceController {
|
||||||
PhabricatorActionListView $actions) {
|
PhabricatorActionListView $actions) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$view = new PHUIPropertyListView();
|
$view = id(new PHUIPropertyListView())
|
||||||
$view->setActionList($actions);
|
->setActionList($actions);
|
||||||
|
|
||||||
$status = $resource->getStatus();
|
$status = $resource->getStatus();
|
||||||
$status = DrydockResourceStatus::getNameForStatus($status);
|
$status = DrydockResourceStatus::getNameForStatus($status);
|
||||||
|
|
|
@ -223,19 +223,16 @@ final class DrydockResource extends DrydockDAO
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPolicy($capability) {
|
public function getPolicy($capability) {
|
||||||
switch ($capability) {
|
return $this->getBlueprint()->getPolicy($capability);
|
||||||
case PhabricatorPolicyCapability::CAN_VIEW:
|
|
||||||
case PhabricatorPolicyCapability::CAN_EDIT:
|
|
||||||
// TODO: Implement reasonable policies.
|
|
||||||
return PhabricatorPolicies::getMostOpenPolicy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
||||||
return false;
|
return $this->getBlueprint()->hasAutomaticCapability(
|
||||||
|
$capability,
|
||||||
|
$viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAutomaticCapability($capability) {
|
public function describeAutomaticCapability($capability) {
|
||||||
return null;
|
return pht('Resources inherit the policies of their blueprints.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue