@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add initial create screen for auth providers

Summary: Ref T1536. Adds an initial "choose a provider type" screen for adding a new provider. This doesn't go anywhere yet.

Test Plan: {F46316}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, chad

Maniphest Tasks: T1536

Differential Revision: https://secure.phabricator.com/D6199

+177 -51
+45 -45
src/__celerity_resource_map__.php
··· 814 814 ), 815 815 'aphront-form-view-css' => 816 816 array( 817 - 'uri' => '/res/a668dc36/rsrc/css/aphront/form-view.css', 817 + 'uri' => '/res/40b6b684/rsrc/css/aphront/form-view.css', 818 818 'type' => 'css', 819 819 'requires' => 820 820 array( ··· 4057 4057 ), array( 4058 4058 'packages' => 4059 4059 array( 4060 - '116c8dcd' => 4060 + 'f2a3a549' => 4061 4061 array( 4062 4062 'name' => 'core.pkg.css', 4063 4063 'symbols' => ··· 4105 4105 40 => 'phabricator-property-list-view-css', 4106 4106 41 => 'phabricator-tag-view-css', 4107 4107 ), 4108 - 'uri' => '/res/pkg/116c8dcd/core.pkg.css', 4108 + 'uri' => '/res/pkg/f2a3a549/core.pkg.css', 4109 4109 'type' => 'css', 4110 4110 ), 4111 4111 'f2ad0683' => ··· 4299 4299 'reverse' => 4300 4300 array( 4301 4301 'aphront-attached-file-view-css' => 'a7ca34a9', 4302 - 'aphront-dialog-view-css' => '116c8dcd', 4303 - 'aphront-error-view-css' => '116c8dcd', 4304 - 'aphront-form-view-css' => '116c8dcd', 4305 - 'aphront-list-filter-view-css' => '116c8dcd', 4306 - 'aphront-pager-view-css' => '116c8dcd', 4307 - 'aphront-panel-view-css' => '116c8dcd', 4308 - 'aphront-table-view-css' => '116c8dcd', 4309 - 'aphront-tokenizer-control-css' => '116c8dcd', 4310 - 'aphront-tooltip-css' => '116c8dcd', 4311 - 'aphront-typeahead-control-css' => '116c8dcd', 4302 + 'aphront-dialog-view-css' => 'f2a3a549', 4303 + 'aphront-error-view-css' => 'f2a3a549', 4304 + 'aphront-form-view-css' => 'f2a3a549', 4305 + 'aphront-list-filter-view-css' => 'f2a3a549', 4306 + 'aphront-pager-view-css' => 'f2a3a549', 4307 + 'aphront-panel-view-css' => 'f2a3a549', 4308 + 'aphront-table-view-css' => 'f2a3a549', 4309 + 'aphront-tokenizer-control-css' => 'f2a3a549', 4310 + 'aphront-tooltip-css' => 'f2a3a549', 4311 + 'aphront-typeahead-control-css' => 'f2a3a549', 4312 4312 'differential-changeset-view-css' => 'dd27a69b', 4313 4313 'differential-core-view-css' => 'dd27a69b', 4314 4314 'differential-inline-comment-editor' => '9488bb69', ··· 4322 4322 'differential-table-of-contents-css' => 'dd27a69b', 4323 4323 'diffusion-commit-view-css' => 'c8ce2d88', 4324 4324 'diffusion-icons-css' => 'c8ce2d88', 4325 - 'global-drag-and-drop-css' => '116c8dcd', 4325 + 'global-drag-and-drop-css' => 'f2a3a549', 4326 4326 'inline-comment-summary-css' => 'dd27a69b', 4327 4327 'javelin-aphlict' => 'f2ad0683', 4328 4328 'javelin-behavior' => 'a9f14d76', ··· 4396 4396 'javelin-util' => 'a9f14d76', 4397 4397 'javelin-vector' => 'a9f14d76', 4398 4398 'javelin-workflow' => 'a9f14d76', 4399 - 'lightbox-attachment-css' => '116c8dcd', 4399 + 'lightbox-attachment-css' => 'f2a3a549', 4400 4400 'maniphest-task-summary-css' => 'a7ca34a9', 4401 4401 'maniphest-transaction-detail-css' => 'a7ca34a9', 4402 - 'phabricator-action-list-view-css' => '116c8dcd', 4403 - 'phabricator-application-launch-view-css' => '116c8dcd', 4402 + 'phabricator-action-list-view-css' => 'f2a3a549', 4403 + 'phabricator-application-launch-view-css' => 'f2a3a549', 4404 4404 'phabricator-busy' => 'f2ad0683', 4405 4405 'phabricator-content-source-view-css' => 'dd27a69b', 4406 - 'phabricator-core-css' => '116c8dcd', 4407 - 'phabricator-crumbs-view-css' => '116c8dcd', 4406 + 'phabricator-core-css' => 'f2a3a549', 4407 + 'phabricator-crumbs-view-css' => 'f2a3a549', 4408 4408 'phabricator-drag-and-drop-file-upload' => '9488bb69', 4409 4409 'phabricator-dropdown-menu' => 'f2ad0683', 4410 4410 'phabricator-file-upload' => 'f2ad0683', 4411 - 'phabricator-filetree-view-css' => '116c8dcd', 4412 - 'phabricator-flag-css' => '116c8dcd', 4413 - 'phabricator-form-view-css' => '116c8dcd', 4414 - 'phabricator-header-view-css' => '116c8dcd', 4411 + 'phabricator-filetree-view-css' => 'f2a3a549', 4412 + 'phabricator-flag-css' => 'f2a3a549', 4413 + 'phabricator-form-view-css' => 'f2a3a549', 4414 + 'phabricator-header-view-css' => 'f2a3a549', 4415 4415 'phabricator-hovercard' => 'f2ad0683', 4416 - 'phabricator-jump-nav' => '116c8dcd', 4416 + 'phabricator-jump-nav' => 'f2a3a549', 4417 4417 'phabricator-keyboard-shortcut' => 'f2ad0683', 4418 4418 'phabricator-keyboard-shortcut-manager' => 'f2ad0683', 4419 - 'phabricator-main-menu-view' => '116c8dcd', 4419 + 'phabricator-main-menu-view' => 'f2a3a549', 4420 4420 'phabricator-menu-item' => 'f2ad0683', 4421 - 'phabricator-nav-view-css' => '116c8dcd', 4421 + 'phabricator-nav-view-css' => 'f2a3a549', 4422 4422 'phabricator-notification' => 'f2ad0683', 4423 - 'phabricator-notification-css' => '116c8dcd', 4424 - 'phabricator-notification-menu-css' => '116c8dcd', 4425 - 'phabricator-object-item-list-view-css' => '116c8dcd', 4423 + 'phabricator-notification-css' => 'f2a3a549', 4424 + 'phabricator-notification-menu-css' => 'f2a3a549', 4425 + 'phabricator-object-item-list-view-css' => 'f2a3a549', 4426 4426 'phabricator-object-selector-css' => 'dd27a69b', 4427 4427 'phabricator-phtize' => 'f2ad0683', 4428 4428 'phabricator-prefab' => 'f2ad0683', 4429 4429 'phabricator-project-tag-css' => 'a7ca34a9', 4430 - 'phabricator-property-list-view-css' => '116c8dcd', 4431 - 'phabricator-remarkup-css' => '116c8dcd', 4430 + 'phabricator-property-list-view-css' => 'f2a3a549', 4431 + 'phabricator-remarkup-css' => 'f2a3a549', 4432 4432 'phabricator-shaped-request' => '9488bb69', 4433 - 'phabricator-side-menu-view-css' => '116c8dcd', 4434 - 'phabricator-standard-page-view' => '116c8dcd', 4435 - 'phabricator-tag-view-css' => '116c8dcd', 4433 + 'phabricator-side-menu-view-css' => 'f2a3a549', 4434 + 'phabricator-standard-page-view' => 'f2a3a549', 4435 + 'phabricator-tag-view-css' => 'f2a3a549', 4436 4436 'phabricator-textareautils' => 'f2ad0683', 4437 4437 'phabricator-tooltip' => 'f2ad0683', 4438 - 'phabricator-transaction-view-css' => '116c8dcd', 4439 - 'phabricator-zindex-css' => '116c8dcd', 4440 - 'phui-button-css' => '116c8dcd', 4441 - 'phui-form-css' => '116c8dcd', 4442 - 'phui-icon-view-css' => '116c8dcd', 4443 - 'phui-spacing-css' => '116c8dcd', 4444 - 'sprite-apps-large-css' => '116c8dcd', 4445 - 'sprite-gradient-css' => '116c8dcd', 4446 - 'sprite-icons-css' => '116c8dcd', 4447 - 'sprite-menu-css' => '116c8dcd', 4448 - 'syntax-highlighting-css' => '116c8dcd', 4438 + 'phabricator-transaction-view-css' => 'f2a3a549', 4439 + 'phabricator-zindex-css' => 'f2a3a549', 4440 + 'phui-button-css' => 'f2a3a549', 4441 + 'phui-form-css' => 'f2a3a549', 4442 + 'phui-icon-view-css' => 'f2a3a549', 4443 + 'phui-spacing-css' => 'f2a3a549', 4444 + 'sprite-apps-large-css' => 'f2a3a549', 4445 + 'sprite-gradient-css' => 'f2a3a549', 4446 + 'sprite-icons-css' => 'f2a3a549', 4447 + 'sprite-menu-css' => 'f2a3a549', 4448 + 'syntax-highlighting-css' => 'f2a3a549', 4449 4449 ), 4450 4450 ));
+2
src/__phutil_library_map__.php
··· 821 821 'PhabricatorAuthLinkController' => 'applications/auth/controller/PhabricatorAuthLinkController.php', 822 822 'PhabricatorAuthListController' => 'applications/auth/controller/config/PhabricatorAuthListController.php', 823 823 'PhabricatorAuthLoginController' => 'applications/auth/controller/PhabricatorAuthLoginController.php', 824 + 'PhabricatorAuthNewController' => 'applications/auth/controller/config/PhabricatorAuthNewController.php', 824 825 'PhabricatorAuthProvider' => 'applications/auth/provider/PhabricatorAuthProvider.php', 825 826 'PhabricatorAuthProviderConfig' => 'applications/auth/storage/PhabricatorAuthProviderConfig.php', 826 827 'PhabricatorAuthProviderConfigController' => 'applications/auth/controller/config/PhabricatorAuthProviderConfigController.php', ··· 2698 2699 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 2699 2700 ), 2700 2701 'PhabricatorAuthLoginController' => 'PhabricatorAuthController', 2702 + 'PhabricatorAuthNewController' => 'PhabricatorAuthProviderConfigController', 2701 2703 'PhabricatorAuthProviderConfig' => 2702 2704 array( 2703 2705 0 => 'PhabricatorAuthDAO',
+1
src/applications/auth/application/PhabricatorApplicationAuth.php
··· 40 40 41 41 '(query/(?P<key>[^/]+)/)?' => 42 42 'PhabricatorAuthListController', 43 + 'config/new/' => 'PhabricatorAuthNewController', 43 44 44 45 */ 45 46 'login/(?P<pkey>[^/]+)/' => 'PhabricatorAuthLoginController',
+84
src/applications/auth/controller/config/PhabricatorAuthNewController.php
··· 1 + <?php 2 + 3 + final class PhabricatorAuthNewController 4 + extends PhabricatorAuthProviderConfigController { 5 + 6 + public function processRequest() { 7 + $request = $this->getRequest(); 8 + $viewer = $request->getUser(); 9 + 10 + $providers = PhabricatorAuthProvider::getAllBaseProviders(); 11 + 12 + $e_provider = null; 13 + $errors = array(); 14 + 15 + if ($request->isFormPost()) { 16 + $provider_string = $request->getStr('provider'); 17 + if (!strlen($provider_string)) { 18 + $e_provider = pht('Required'); 19 + $errors[] = pht('You must select an authentication provider.'); 20 + } else { 21 + $found = false; 22 + foreach ($providers as $provider) { 23 + if (get_class($provider) === $provider_string) { 24 + $found = true; 25 + break; 26 + } 27 + } 28 + if (!$found) { 29 + $e_provider = pht('Invalid'); 30 + $errors[] = pht('You must select a valid provider.'); 31 + } 32 + } 33 + 34 + if (!$errors) { 35 + return id(new AphrontRedirectResponse())->setURI( 36 + $this->getApplicationURI('/config/new/'.$provider_string.'/')); 37 + } 38 + } 39 + 40 + if ($errors) { 41 + $errors = id(new AphrontErrorView())->setErrors($errors); 42 + } 43 + 44 + $options = id(new AphrontFormRadioButtonControl()) 45 + ->setLabel(pht('Provider')) 46 + ->setName('provider') 47 + ->setError($e_provider); 48 + 49 + $providers = msort($providers, 'getProviderName'); 50 + foreach ($providers as $provider) { 51 + $options->addButton( 52 + get_class($provider), 53 + $provider->getNameForCreate(), 54 + $provider->getDescriptionForCreate()); 55 + } 56 + 57 + $form = id(new AphrontFormView()) 58 + ->setUser($viewer) 59 + ->appendChild($options) 60 + ->appendChild( 61 + id(new AphrontFormSubmitControl()) 62 + ->addCancelButton($this->getApplicationURI()) 63 + ->setValue(pht('Continue'))); 64 + 65 + 66 + $crumbs = $this->buildApplicationCrumbs(); 67 + $crumbs->addCrumb( 68 + id(new PhabricatorCrumbView()) 69 + ->setName(pht('Add Provider'))); 70 + 71 + return $this->buildApplicationPage( 72 + array( 73 + $crumbs, 74 + $errors, 75 + $form, 76 + ), 77 + array( 78 + 'title' => pht('Add Authentication Provider'), 79 + 'dust' => true, 80 + 'device' => true, 81 + )); 82 + } 83 + 84 + }
+20 -1
src/applications/auth/provider/PhabricatorAuthProvider.php
··· 2 2 3 3 abstract class PhabricatorAuthProvider { 4 4 5 + public function getNameForCreate() { 6 + return $this->getProviderName(); 7 + } 8 + 9 + public function getDescriptionForCreate() { 10 + return null; 11 + } 12 + 5 13 public function getProviderKey() { 6 14 return $this->getAdapter()->getAdapterKey(); 7 15 } ··· 14 22 return $this->getAdapter()->getAdapterDomain(); 15 23 } 16 24 17 - public static function getAllProviders() { 25 + public static function getAllBaseProviders() { 18 26 static $providers; 19 27 20 28 if ($providers === null) { 21 29 $objects = id(new PhutilSymbolLoader()) 22 30 ->setAncestorClass(__CLASS__) 23 31 ->loadObjects(); 32 + $providers = $objects; 33 + } 34 + 35 + return $providers; 36 + } 37 + 38 + public static function getAllProviders() { 39 + static $providers; 40 + 41 + if ($providers === null) { 42 + $objects = self::getAllBaseProviders(); 24 43 25 44 $providers = array(); 26 45 $from_class_map = array();
+7
src/applications/auth/provider/PhabricatorAuthProviderLDAP.php
··· 9 9 return pht('LDAP'); 10 10 } 11 11 12 + public function getDescriptionForCreate() { 13 + return pht( 14 + 'Configure a connection to an LDAP server so that users can use their '. 15 + 'LDAP credentials to log in to Phabricator.'); 16 + } 17 + 18 + 12 19 public function isEnabled() { 13 20 return parent::isEnabled() && 14 21 PhabricatorEnv::getEnvConfig('ldap.auth-enabled');
+5
src/applications/auth/provider/PhabricatorAuthProviderOAuth.php
··· 8 8 abstract protected function getOAuthClientSecret(); 9 9 abstract protected function newOAuthAdapter(); 10 10 11 + 12 + public function getDescriptionForCreate() { 13 + return pht('Configure %s OAuth.', $this->getProviderName()); 14 + } 15 + 11 16 public function getAdapter() { 12 17 if (!$this->adapter) { 13 18 $adapter = $this->newOAuthAdapter();
+5
src/applications/auth/provider/PhabricatorAuthProviderPassword.php
··· 9 9 return pht('Username/Password'); 10 10 } 11 11 12 + public function getDescriptionForCreate() { 13 + return pht( 14 + 'Allow users to login or register using a username and password.'); 15 + } 16 + 12 17 public function isEnabled() { 13 18 return parent::isEnabled() && 14 19 PhabricatorEnv::getEnvConfig('auth.password-auth-enabled');
+8 -5
webroot/rsrc/css/aphront/form-view.css
··· 180 180 181 181 table.aphront-form-control-radio-layout th, 182 182 table.aphront-form-control-checkbox-layout th { 183 - padding-top: 2px; 184 - padding-left: 0.35em; 185 - padding-bottom: 4px; 183 + padding-top: 3px; 184 + padding-left: 8px; 185 + padding-bottom: 12px; 186 + font-weight: bold; 187 + color: #222222; 186 188 } 187 189 188 190 .aphront-form-control-radio-layout td input, ··· 192 194 } 193 195 194 196 .aphront-form-radio-caption { 195 - font-size: 11px; 197 + margin-top: 4px; 198 + font-size: 12px; 199 + font-weight: normal; 196 200 color: #444444; 197 - max-width: 400px; 198 201 } 199 202 200 203 .aphront-form-control-image span {