1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 20:51:10 +01:00

Fix a fatal during breadcrumb construction when viewing a dashboard you don't have permission to view

Summary: Ref PHI662. Viewing a dashboard you don't have permission to view (in the Dashboard application) currently fatals while building crumbs, since we fail to build the ` ... > Dashboard 123 > ...` crumb.

Test Plan:
  - Viewed a dashboard I didn't have permission to view in the Dashboards application.
  - Before patch, fatal when calling `getID()` on a non-object.
  - After patch, sensible policy error page.
  - Viewed a dashboard I can view, saw sensible crumbs.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D19449
This commit is contained in:
epriestley 2018-05-14 08:45:22 -07:00
parent 28ee6b8080
commit 29df80b48f

View file

@ -44,13 +44,16 @@ abstract class PhabricatorDashboardProfileController
}
protected function buildApplicationCrumbs() {
$dashboard = $this->getDashboard();
$id = $dashboard->getID();
$dashboard_uri = $this->getApplicationURI("/view/{$id}/");
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb($dashboard->getName(), $dashboard_uri);
$crumbs->setBorder(true);
$dashboard = $this->getDashboard();
if ($dashboard) {
$id = $dashboard->getID();
$dashboard_uri = $this->getApplicationURI("/view/{$id}/");
$crumbs->addTextCrumb($dashboard->getName(), $dashboard_uri);
}
return $crumbs;
}