3 final class PhabricatorAuthListController
4 extends PhabricatorAuthProviderConfigController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $this->getViewer();
9 $configs = id(new PhabricatorAuthProviderConfigQuery())
13 $list = new PHUIObjectItemListView();
14 $can_manage = $this->hasApplicationCapability(
15 AuthManageProvidersCapability
::CAPABILITY
);
16 $is_locked = PhabricatorEnv
::getEnvConfig('auth.lock-config');
18 foreach ($configs as $config) {
19 $item = new PHUIObjectItemView();
21 $id = $config->getID();
23 $view_uri = $config->getURI();
25 $provider = $config->getProvider();
26 $name = $provider->getProviderName();
32 $domain = $provider->getProviderDomain();
33 if ($domain !== 'self') {
34 $item->addAttribute($domain);
37 if ($config->getShouldAllowRegistration()) {
38 $item->addAttribute(pht('Allows Registration'));
40 $item->addAttribute(pht('Does Not Allow Registration'));
43 if ($config->getIsEnabled()) {
44 $item->setStatusIcon('fa-check-circle green');
46 $item->setStatusIcon('fa-ban red');
47 $item->addIcon('fa-ban grey', pht('Disabled'));
50 $list->addItem($item);
53 $list->setNoDataString(
55 '%s You have not added authentication providers yet. Use "%s" to add '.
56 'a provider, which will let users register new accounts and log in.',
60 pht('No Providers Configured:')),
64 'href' => $this->getApplicationURI('config/new/'),
66 pht('Add Provider'))));
68 $crumbs = $this->buildApplicationCrumbs();
69 $crumbs->addTextCrumb(pht('Login and Registration'));
70 $crumbs->setBorder(true);
72 $guidance_context = id(new PhabricatorAuthProvidersGuidanceContext())
73 ->setCanManage($can_manage);
75 $guidance = id(new PhabricatorGuidanceEngine())
77 ->setGuidanceContext($guidance_context)
80 $is_disabled = (!$can_manage ||
$is_locked);
81 $button = id(new PHUIButtonView())
83 ->setButtonType(PHUIButtonView
::BUTTONTYPE_SIMPLE
)
85 ->setDisabled($is_disabled)
86 ->setWorkflow($is_disabled)
87 ->setHref($this->getApplicationURI('config/new/'))
88 ->setText(pht('Add Provider'));
90 $list->setFlush(true);
91 $list = id(new PHUIObjectBoxView())
92 ->setHeaderText(pht('Providers'))
93 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
96 $title = pht('Login and Registration Providers');
97 $header = id(new PHUIHeaderView())
99 ->setHeaderIcon('fa-key')
100 ->addActionLink($button);
102 $view = id(new PHUITwoColumnView())
110 $nav = $this->newNavigation()
112 ->appendChild($view);
114 $nav->selectFilter('login');
116 return $this->newPage()