[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorAuthListController 4 extends PhabricatorAuthProviderConfigController { 5 6 public function processRequest() { 7 $request = $this->getRequest(); 8 $viewer = $request->getUser(); 9 10 $configs = id(new PhabricatorAuthProviderConfigQuery()) 11 ->setViewer($viewer) 12 ->execute(); 13 14 $list = new PHUIObjectItemListView(); 15 foreach ($configs as $config) { 16 $item = new PHUIObjectItemView(); 17 18 $id = $config->getID(); 19 20 $edit_uri = $this->getApplicationURI('config/edit/'.$id.'/'); 21 $enable_uri = $this->getApplicationURI('config/enable/'.$id.'/'); 22 $disable_uri = $this->getApplicationURI('config/disable/'.$id.'/'); 23 24 $provider = $config->getProvider(); 25 if ($provider) { 26 $name = $provider->getProviderName(); 27 } else { 28 $name = $config->getProviderType().' ('.$config->getProviderClass().')'; 29 } 30 31 $item 32 ->setHeader($name); 33 34 if ($provider) { 35 $item->setHref($edit_uri); 36 } else { 37 $item->addAttribute(pht('Provider Implementation Missing!')); 38 } 39 40 $domain = null; 41 if ($provider) { 42 $domain = $provider->getProviderDomain(); 43 if ($domain !== 'self') { 44 $item->addAttribute($domain); 45 } 46 } 47 48 if ($config->getShouldAllowRegistration()) { 49 $item->addAttribute(pht('Allows Registration')); 50 } 51 52 if ($config->getIsEnabled()) { 53 $item->setBarColor('green'); 54 $item->addAction( 55 id(new PHUIListItemView()) 56 ->setIcon('fa-times') 57 ->setHref($disable_uri) 58 ->addSigil('workflow')); 59 } else { 60 $item->setBarColor('grey'); 61 $item->addIcon('fa-times grey', pht('Disabled')); 62 $item->addAction( 63 id(new PHUIListItemView()) 64 ->setIcon('fa-plus') 65 ->setHref($enable_uri) 66 ->addSigil('workflow')); 67 } 68 69 $list->addItem($item); 70 } 71 72 $list->setNoDataString( 73 pht( 74 '%s You have not added authentication providers yet. Use "%s" to add '. 75 'a provider, which will let users register new Phabricator accounts '. 76 'and log in.', 77 phutil_tag( 78 'strong', 79 array(), 80 pht('No Providers Configured:')), 81 phutil_tag( 82 'a', 83 array( 84 'href' => $this->getApplicationURI('config/new/'), 85 ), 86 pht('Add Authentication Provider')))); 87 88 $crumbs = $this->buildApplicationCrumbs(); 89 $crumbs->addTextCrumb(pht('Auth Providers')); 90 91 $config_name = 'auth.email-domains'; 92 $config_href = '/config/edit/'.$config_name.'/'; 93 $config_link = phutil_tag( 94 'a', 95 array( 96 'href' => $config_href, 97 'target' => '_blank', 98 ), 99 $config_name); 100 101 $warning = new AphrontErrorView(); 102 103 $email_domains = PhabricatorEnv::getEnvConfig($config_name); 104 if ($email_domains) { 105 $warning->setSeverity(AphrontErrorView::SEVERITY_NOTICE); 106 $warning->setTitle(pht('Registration is Restricted')); 107 $warning->appendChild( 108 pht( 109 'Only users with a verified email address at one of the %s domains '. 110 'will be able to register a Phabricator account: %s', 111 $config_link, 112 phutil_tag('strong', array(), implode(', ', $email_domains)))); 113 } else { 114 $warning->setSeverity(AphrontErrorView::SEVERITY_WARNING); 115 $warning->setTitle(pht('Anyone Can Register an Account')); 116 $warning->appendChild( 117 pht( 118 'Anyone who can browse to this Phabricator install will be able to '. 119 'register an account. To restrict who can register an account, '. 120 'configure %s.', 121 $config_link)); 122 } 123 124 return $this->buildApplicationPage( 125 array( 126 $crumbs, 127 $warning, 128 $list, 129 ), 130 array( 131 'title' => pht('Authentication Providers'), 132 )); 133 } 134 135 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |