From 3f77ad9368c707dc1a871fcbb83fd7b467ad650d Mon Sep 17 00:00:00 2001 From: lkassianik Date: Sun, 26 Apr 2015 12:51:00 -0700 Subject: [PATCH] "Create Application" button in OAuth Server application should be greyed out if user does not have correct capabilities. Summary: Fixes T7497, "Create Application" button in Oauth Server application should be greyed out if user does not have correct capabilities and should open a "You Shall Not Pass" modal. Test Plan: Login as non-admin, open OAuth Server application, "Create Application" button should be greyed out, and clicking it should open a modal dialog over the list view without navigating away from it. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7497 Differential Revision: https://secure.phabricator.com/D12560 --- .../client/PhabricatorOAuthClientListController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php index 0e2be7a105..217fa1d7b1 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php @@ -25,10 +25,15 @@ final class PhabricatorOAuthClientListController protected function buildApplicationCrumbs() { $crumbs = parent::buildApplicationCrumbs(); + $can_create = $this->hasApplicationCapability( + PhabricatorOAuthServerCreateClientsCapability::CAPABILITY); + $crumbs->addAction( id(new PHUIListItemView()) ->setHref($this->getApplicationURI('client/create/')) ->setName(pht('Create Application')) + ->setDisabled(!$can_create) + ->setWorkflow(!$can_create) ->setIcon('fa-plus-square')); return $crumbs;