From 80acaf68312cf3cc28035d055ba948f5c653ac11 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Sun, 26 Apr 2015 12:45:08 -0700 Subject: [PATCH] Users with no build plan capabilities should see "New Build Plan" button as greyed out and a modal dialog explaining the policy. Summary: Fixes T7499, New Build Plan button should be greyed out in Harbormaster list view. Test Plan: Login as non-admin user, navigate to Harbormaster, New Build Plan button should be greyed out and clicking it should result in a "You Shall Not Pass" modal dialog that does not navigate away from build list view. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7499 Differential Revision: https://secure.phabricator.com/D12559 --- .../harbormaster/controller/HarbormasterController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/applications/harbormaster/controller/HarbormasterController.php b/src/applications/harbormaster/controller/HarbormasterController.php index 933590a1c5..7202e356a2 100644 --- a/src/applications/harbormaster/controller/HarbormasterController.php +++ b/src/applications/harbormaster/controller/HarbormasterController.php @@ -5,10 +5,15 @@ abstract class HarbormasterController extends PhabricatorController { protected function buildApplicationCrumbs() { $crumbs = parent::buildApplicationCrumbs(); + $can_create = $this->hasApplicationCapability( + HarbormasterManagePlansCapability::CAPABILITY); + $crumbs->addAction( id(new PHUIListItemView()) ->setName(pht('New Build Plan')) ->setHref($this->getApplicationURI('plan/edit/')) + ->setDisabled(!$can_create) + ->setWorkflow(!$can_create) ->setIcon('fa-plus-square')); return $crumbs;