mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 00:02:41 +01:00
4489204361
Summary: Ref T2015. Allow configuration of default edit/view policies for blueprints. Add create policy. Remove administrative exception in policies. Test Plan: Configured these settings and created (or, with a restrictive create setting, tried to create) blueprints. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2015 Differential Revision: https://secure.phabricator.com/D7921
67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
|
|
|
final class DrydockBlueprintListController extends DrydockBlueprintController
|
|
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
|
|
private $queryKey;
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->queryKey = idx($data, 'queryKey');
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
|
->setQueryKey($this->queryKey)
|
|
->setSearchEngine(new DrydockBlueprintSearchEngine())
|
|
->setNavigation($this->buildSideNavView());
|
|
|
|
return $this->delegateToController($controller);
|
|
}
|
|
|
|
public function renderResultsList(
|
|
array $blueprints,
|
|
PhabricatorSavedQuery $query) {
|
|
assert_instances_of($blueprints, 'DrydockBlueprint');
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
$view = new PHUIObjectItemListView();
|
|
|
|
foreach ($blueprints as $blueprint) {
|
|
$item = id(new PHUIObjectItemView())
|
|
->setHeader($blueprint->getBlueprintName())
|
|
->setHref($this->getApplicationURI('/blueprint/'.$blueprint->getID()))
|
|
->setObjectName(pht('Blueprint %d', $blueprint->getID()));
|
|
|
|
if (!$blueprint->getImplementation()->isEnabled()) {
|
|
$item->setDisabled(true);
|
|
}
|
|
|
|
$item->addAttribute($blueprint->getImplementation()->getBlueprintName());
|
|
|
|
$view->addItem($item);
|
|
}
|
|
|
|
return $view;
|
|
}
|
|
|
|
public function buildApplicationCrumbs() {
|
|
$can_create = $this->hasApplicationCapability(
|
|
DrydockCapabilityCreateBlueprints::CAPABILITY);
|
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
$crumbs->addAction(
|
|
id(new PHUIListItemView())
|
|
->setName(pht('New Blueprint'))
|
|
->setHref($this->getApplicationURI('/blueprint/create/'))
|
|
->setDisabled(!$can_create)
|
|
->setWorkflow(!$can_create)
|
|
->setIcon('create'));
|
|
return $crumbs;
|
|
}
|
|
|
|
}
|