1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-03 03:11:01 +01:00

Fix a few minor bugs in Auth Providers

Summary: Fixes T7496, T7511. Sets text for registration is not enabled, sets can_manage on add_provider button.

Test Plan: Test with a logged in admin and logged in normal joe user.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7496, T7511

Differential Revision: https://secure.phabricator.com/D12014
This commit is contained in:
Chad Little 2015-03-08 11:04:57 -07:00
parent 1df321bf00
commit 6608eea91d

View file

@ -12,6 +12,8 @@ final class PhabricatorAuthListController
->execute(); ->execute();
$list = new PHUIObjectItemListView(); $list = new PHUIObjectItemListView();
$can_manage = $this->hasApplicationCapability(
AuthManageProvidersCapability::CAPABILITY);
foreach ($configs as $config) { foreach ($configs as $config) {
$item = new PHUIObjectItemView(); $item = new PHUIObjectItemView();
@ -47,10 +49,10 @@ final class PhabricatorAuthListController
if ($config->getShouldAllowRegistration()) { if ($config->getShouldAllowRegistration()) {
$item->addAttribute(pht('Allows Registration')); $item->addAttribute(pht('Allows Registration'));
} else {
$item->addAttribute(pht('Does Not Allow Registration'));
} }
$can_manage = $this->hasApplicationCapability(
AuthManageProvidersCapability::CAPABILITY);
if ($config->getIsEnabled()) { if ($config->getIsEnabled()) {
$item->setState(PHUIObjectItemView::STATE_SUCCESS); $item->setState(PHUIObjectItemView::STATE_SUCCESS);
$item->addAction( $item->addAction(
@ -152,6 +154,7 @@ final class PhabricatorAuthListController
->setColor(PHUIButtonView::SIMPLE) ->setColor(PHUIButtonView::SIMPLE)
->setHref($this->getApplicationURI('config/new/')) ->setHref($this->getApplicationURI('config/new/'))
->setIcon($image) ->setIcon($image)
->setDisabled(!$can_manage)
->setText(pht('Add Provider')); ->setText(pht('Add Provider'));
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())