1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 13:30:55 +01:00

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
This commit is contained in:
lkassianik 2015-04-26 12:45:08 -07:00 committed by epriestley
parent f347c002a6
commit 80acaf6831

View file

@ -5,10 +5,15 @@ abstract class HarbormasterController extends PhabricatorController {
protected function buildApplicationCrumbs() { protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs(); $crumbs = parent::buildApplicationCrumbs();
$can_create = $this->hasApplicationCapability(
HarbormasterManagePlansCapability::CAPABILITY);
$crumbs->addAction( $crumbs->addAction(
id(new PHUIListItemView()) id(new PHUIListItemView())
->setName(pht('New Build Plan')) ->setName(pht('New Build Plan'))
->setHref($this->getApplicationURI('plan/edit/')) ->setHref($this->getApplicationURI('plan/edit/'))
->setDisabled(!$can_create)
->setWorkflow(!$can_create)
->setIcon('fa-plus-square')); ->setIcon('fa-plus-square'));
return $crumbs; return $crumbs;