Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / meta / controller / PhabricatorApplicationPanelController.php
blob4fab71c501dd13e5f5f8c89c6b71fb1ca0d76be0
1 <?php
3 final class PhabricatorApplicationPanelController
4 extends PhabricatorApplicationsController {
6 private $application;
8 public function handleRequest(AphrontRequest $request) {
9 $viewer = $this->getViewer();
11 $application = $request->getURIData('application');
12 $panel_key = $request->getURIData('panel');
14 $selected = id(new PhabricatorApplicationQuery())
15 ->setViewer($viewer)
16 ->withClasses(array($application))
17 ->requireCapabilities(
18 array(
19 PhabricatorPolicyCapability::CAN_VIEW,
20 PhabricatorPolicyCapability::CAN_EDIT,
22 ->executeOne();
23 if (!$selected) {
24 return new Aphront404Response();
27 $panels =
28 PhabricatorApplicationConfigurationPanel::loadAllPanelsForApplication(
29 $selected);
30 if (empty($panels[$panel_key])) {
31 return new Aphront404Response();
34 $panel = $panels[$panel_key];
36 if (!$panel->shouldShowForApplication($selected)) {
37 return new Aphront404Response();
40 $panel->setViewer($viewer);
41 $panel->setApplication($selected);
43 $this->application = $selected;
45 return $panel->handlePanelRequest($request, $this);
48 public function buildPanelCrumbs(
49 PhabricatorApplicationConfigurationPanel $panel) {
50 $application = $this->application;
52 $crumbs = $this->buildApplicationCrumbs();
54 $view_uri = '/applications/view/'.get_class($application).'/';
55 $crumbs->addTextCrumb($application->getName(), $view_uri);
57 return $crumbs;
60 public function buildPanelPage(
61 PhabricatorApplicationConfigurationPanel $panel,
62 $title,
63 $crumbs,
64 $content) {
66 return $this->newPage()
67 ->setTitle($title)
68 ->setCrumbs($crumbs)
69 ->appendChild($content);