mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +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());
|
||||
|
||||
$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);
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue