1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

"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
This commit is contained in:
lkassianik 2015-04-26 12:51:00 -07:00 committed by epriestley
parent 80acaf6831
commit 3f77ad9368

View file

@ -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;