[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorAuthApplication extends PhabricatorApplication { 4 5 public function canUninstall() { 6 return false; 7 } 8 9 public function getBaseURI() { 10 return '/auth/'; 11 } 12 13 public function getIconName() { 14 return 'authentication'; 15 } 16 17 public function isPinnedByDefault(PhabricatorUser $viewer) { 18 return $viewer->getIsAdmin(); 19 } 20 21 public function getName() { 22 return pht('Auth'); 23 } 24 25 public function getShortDescription() { 26 return pht('Login/Registration'); 27 } 28 29 public function getHelpURI() { 30 // NOTE: Although reasonable help exists for this in "Configuring Accounts 31 // and Registration", specifying a help URI here means we get the menu 32 // item in all the login/link interfaces, which is confusing and not 33 // helpful. 34 35 // TODO: Special case this, or split the auth and auth administration 36 // applications? 37 38 return null; 39 } 40 41 public function buildMainMenuItems( 42 PhabricatorUser $user, 43 PhabricatorController $controller = null) { 44 45 $items = array(); 46 47 if ($user->isLoggedIn()) { 48 $item = id(new PHUIListItemView()) 49 ->addClass('core-menu-item') 50 ->setName(pht('Log Out')) 51 ->setIcon('logout-sm') 52 ->setWorkflow(true) 53 ->setHref('/logout/') 54 ->setSelected(($controller instanceof PhabricatorLogoutController)) 55 ->setAural(pht('Log Out')) 56 ->setOrder(900); 57 $items[] = $item; 58 } else { 59 if ($controller instanceof PhabricatorAuthController) { 60 // Don't show the "Login" item on auth controllers, since they're 61 // generally all related to logging in anyway. 62 } else { 63 $item = id(new PHUIListItemView()) 64 ->addClass('core-menu-item') 65 ->setName(pht('Log In')) 66 // TODO: Login icon? 67 ->setIcon('power') 68 ->setHref('/auth/start/') 69 ->setAural(pht('Log In')) 70 ->setOrder(900); 71 $items[] = $item; 72 } 73 } 74 75 return $items; 76 } 77 78 public function getApplicationGroup() { 79 return self::GROUP_ADMIN; 80 } 81 82 public function getRoutes() { 83 return array( 84 '/auth/' => array( 85 '' => 'PhabricatorAuthListController', 86 'config/' => array( 87 'new/' => 'PhabricatorAuthNewController', 88 'new/(?P<className>[^/]+)/' => 'PhabricatorAuthEditController', 89 'edit/(?P<id>\d+)/' => 'PhabricatorAuthEditController', 90 '(?P<action>enable|disable)/(?P<id>\d+)/' 91 => 'PhabricatorAuthDisableController', 92 ), 93 'login/(?P<pkey>[^/]+)/(?:(?P<extra>[^/]+)/)?' 94 => 'PhabricatorAuthLoginController', 95 'register/(?:(?P<akey>[^/]+)/)?' => 'PhabricatorAuthRegisterController', 96 'start/' => 'PhabricatorAuthStartController', 97 'validate/' => 'PhabricatorAuthValidateController', 98 'finish/' => 'PhabricatorAuthFinishController', 99 'unlink/(?P<pkey>[^/]+)/' => 'PhabricatorAuthUnlinkController', 100 '(?P<action>link|refresh)/(?P<pkey>[^/]+)/' 101 => 'PhabricatorAuthLinkController', 102 'confirmlink/(?P<akey>[^/]+)/' 103 => 'PhabricatorAuthConfirmLinkController', 104 'session/terminate/(?P<id>[^/]+)/' 105 => 'PhabricatorAuthTerminateSessionController', 106 'token/revoke/(?P<id>[^/]+)/' 107 => 'PhabricatorAuthRevokeTokenController', 108 'session/downgrade/' 109 => 'PhabricatorAuthDowngradeSessionController', 110 'multifactor/' 111 => 'PhabricatorAuthNeedsMultiFactorController', 112 'sshkey/' => array( 113 'generate/' => 'PhabricatorAuthSSHKeyGenerateController', 114 'upload/' => 'PhabricatorAuthSSHKeyEditController', 115 'edit/(?P<id>\d+)/' => 'PhabricatorAuthSSHKeyEditController', 116 'delete/(?P<id>\d+)/' => 'PhabricatorAuthSSHKeyDeleteController', 117 ), 118 ), 119 120 '/oauth/(?P<provider>\w+)/login/' 121 => 'PhabricatorAuthOldOAuthRedirectController', 122 123 '/login/' => array( 124 '' => 'PhabricatorAuthStartController', 125 'email/' => 'PhabricatorEmailLoginController', 126 'once/'. 127 '(?P<type>[^/]+)/'. 128 '(?P<id>\d+)/'. 129 '(?P<key>[^/]+)/'. 130 '(?:(?P<emailID>\d+)/)?' => 'PhabricatorAuthOneTimeLoginController', 131 'refresh/' => 'PhabricatorRefreshCSRFController', 132 'mustverify/' => 'PhabricatorMustVerifyEmailController', 133 ), 134 135 '/emailverify/(?P<code>[^/]+)/' 136 => 'PhabricatorEmailVerificationController', 137 138 '/logout/' => 'PhabricatorLogoutController', 139 ); 140 } 141 142 }
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 |