Differential D20400 Diff 48752 src/applications/auth/controller/config/PhabricatorAuthListController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/config/PhabricatorAuthListController.php
<?php | <?php | ||||
final class PhabricatorAuthListController | final class PhabricatorAuthListController | ||||
extends PhabricatorAuthProviderConfigController { | extends PhabricatorAuthProviderConfigController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$configs = id(new PhabricatorAuthProviderConfigQuery()) | $configs = id(new PhabricatorAuthProviderConfigQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->execute(); | ->execute(); | ||||
$list = new PHUIObjectItemListView(); | $list = new PHUIObjectItemListView(); | ||||
$can_manage = $this->hasApplicationCapability( | $can_manage = $this->hasApplicationCapability( | ||||
AuthManageProvidersCapability::CAPABILITY); | AuthManageProvidersCapability::CAPABILITY); | ||||
$is_locked = PhabricatorEnv::getEnvConfig('auth.lock-config'); | |||||
foreach ($configs as $config) { | foreach ($configs as $config) { | ||||
$item = new PHUIObjectItemView(); | $item = new PHUIObjectItemView(); | ||||
$id = $config->getID(); | $id = $config->getID(); | ||||
$view_uri = $config->getURI(); | $view_uri = $config->getURI(); | ||||
Show All 40 Lines | $list->setNoDataString( | ||||
'href' => $this->getApplicationURI('config/new/'), | 'href' => $this->getApplicationURI('config/new/'), | ||||
), | ), | ||||
pht('Add Authentication Provider')))); | pht('Add Authentication Provider')))); | ||||
$crumbs = $this->buildApplicationCrumbs(); | $crumbs = $this->buildApplicationCrumbs(); | ||||
$crumbs->addTextCrumb(pht('Login and Registration')); | $crumbs->addTextCrumb(pht('Login and Registration')); | ||||
$crumbs->setBorder(true); | $crumbs->setBorder(true); | ||||
$guidance_context = new PhabricatorAuthProvidersGuidanceContext(); | $guidance_context = id(new PhabricatorAuthProvidersGuidanceContext()) | ||||
->setCanManage($can_manage); | |||||
$guidance = id(new PhabricatorGuidanceEngine()) | $guidance = id(new PhabricatorGuidanceEngine()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setGuidanceContext($guidance_context) | ->setGuidanceContext($guidance_context) | ||||
->newInfoView(); | ->newInfoView(); | ||||
$button = id(new PHUIButtonView()) | $button = id(new PHUIButtonView()) | ||||
->setTag('a') | ->setTag('a') | ||||
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) | ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) | ||||
->setHref($this->getApplicationURI('config/new/')) | ->setHref($this->getApplicationURI('config/new/')) | ||||
->setIcon('fa-plus') | ->setIcon('fa-plus') | ||||
->setDisabled(!$can_manage) | ->setDisabled(!$can_manage || $is_locked) | ||||
->setText(pht('Add Provider')); | ->setText(pht('Add Provider')); | ||||
$list->setFlush(true); | $list->setFlush(true); | ||||
$list = id(new PHUIObjectBoxView()) | $list = id(new PHUIObjectBoxView()) | ||||
->setHeaderText(pht('Providers')) | ->setHeaderText(pht('Providers')) | ||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ||||
->appendChild($list); | ->appendChild($list); | ||||
Show All 26 Lines |