mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Move "Preferences" to "Settings"
Summary: It makes more sense to just make this a settings panel rather than a standalone app, particularly since setting panels are relatively well separated now. Also default-disabled the SSH Keys interface since it won't currently be useful for most installs. Test Plan: Edited preferences. Reviewed By: jungejason Reviewers: tuomaspelkonen, jungejason, aran CC: aran, jungejason Differential Revision: 716
This commit is contained in:
parent
2de071ce3a
commit
6e08a9215d
12 changed files with 42 additions and 70 deletions
|
@ -228,6 +228,13 @@ return array(
|
||||||
// to have.
|
// to have.
|
||||||
'auth.sessions.conduit' => 3,
|
'auth.sessions.conduit' => 3,
|
||||||
|
|
||||||
|
// Set this true to enable the Settings -> SSH Public Keys panel, which will
|
||||||
|
// allow users to associated SSH public keys with their accounts. This is only
|
||||||
|
// really useful if you're setting up services over SSH and want to use
|
||||||
|
// Phabricator for authentication; in most situations you can leave this
|
||||||
|
// disabled.
|
||||||
|
'auth.sshkeys.enabled' => false,
|
||||||
|
|
||||||
|
|
||||||
// -- Accounts -------------------------------------------------------------- //
|
// -- Accounts -------------------------------------------------------------- //
|
||||||
|
|
||||||
|
|
2
resources/sql/patches/067.preferences.sql
Normal file
2
resources/sql/patches/067.preferences.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
DELETE FROM phabricator_directory.directory_item
|
||||||
|
WHERE href = '/preferences/';
|
|
@ -574,6 +574,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorUserLog' => 'applications/people/storage/log',
|
'PhabricatorUserLog' => 'applications/people/storage/log',
|
||||||
'PhabricatorUserOAuthInfo' => 'applications/people/storage/useroauthinfo',
|
'PhabricatorUserOAuthInfo' => 'applications/people/storage/useroauthinfo',
|
||||||
'PhabricatorUserOAuthSettingsPanelController' => 'applications/people/controller/settings/panels/oauth',
|
'PhabricatorUserOAuthSettingsPanelController' => 'applications/people/controller/settings/panels/oauth',
|
||||||
|
'PhabricatorUserPreferenceSettingsPanelController' => 'applications/people/controller/settings/panels/preferences',
|
||||||
'PhabricatorUserPreferences' => 'applications/people/storage/preferences',
|
'PhabricatorUserPreferences' => 'applications/people/storage/preferences',
|
||||||
'PhabricatorUserProfile' => 'applications/people/storage/profile',
|
'PhabricatorUserProfile' => 'applications/people/storage/profile',
|
||||||
'PhabricatorUserSSHKey' => 'applications/people/storage/usersshkey',
|
'PhabricatorUserSSHKey' => 'applications/people/storage/usersshkey',
|
||||||
|
@ -1094,6 +1095,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorUserLog' => 'PhabricatorUserDAO',
|
'PhabricatorUserLog' => 'PhabricatorUserDAO',
|
||||||
'PhabricatorUserOAuthInfo' => 'PhabricatorUserDAO',
|
'PhabricatorUserOAuthInfo' => 'PhabricatorUserDAO',
|
||||||
'PhabricatorUserOAuthSettingsPanelController' => 'PhabricatorUserSettingsPanelController',
|
'PhabricatorUserOAuthSettingsPanelController' => 'PhabricatorUserSettingsPanelController',
|
||||||
|
'PhabricatorUserPreferenceSettingsPanelController' => 'PhabricatorUserSettingsPanelController',
|
||||||
'PhabricatorUserPreferences' => 'PhabricatorUserDAO',
|
'PhabricatorUserPreferences' => 'PhabricatorUserDAO',
|
||||||
'PhabricatorUserProfile' => 'PhabricatorUserDAO',
|
'PhabricatorUserProfile' => 'PhabricatorUserDAO',
|
||||||
'PhabricatorUserSSHKey' => 'PhabricatorUserDAO',
|
'PhabricatorUserSSHKey' => 'PhabricatorUserDAO',
|
||||||
|
|
|
@ -275,10 +275,6 @@ class AphrontDefaultApplicationConfiguration
|
||||||
=> 'HeraldTranscriptController',
|
=> 'HeraldTranscriptController',
|
||||||
),
|
),
|
||||||
|
|
||||||
'/preferences/' => array(
|
|
||||||
'$' => 'PhabricatorEditPreferencesController'
|
|
||||||
),
|
|
||||||
|
|
||||||
'/uiexample/' => array(
|
'/uiexample/' => array(
|
||||||
'$' => 'PhabricatorUIExampleRenderController',
|
'$' => 'PhabricatorUIExampleRenderController',
|
||||||
'view/(?P<class>[^/]+)/$' => 'PhabricatorUIExampleRenderController',
|
'view/(?P<class>[^/]+)/$' => 'PhabricatorUIExampleRenderController',
|
||||||
|
|
|
@ -29,14 +29,19 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
// TODO: Implement a password panel.
|
||||||
|
|
||||||
$this->pages = array(
|
$this->pages = array(
|
||||||
'account' => 'Account',
|
'account' => 'Account',
|
||||||
'email' => 'Email',
|
'email' => 'Email',
|
||||||
// 'password' => 'Password',
|
'preferences' => 'Preferences',
|
||||||
'conduit' => 'Conduit Certificate',
|
'conduit' => 'Conduit Certificate',
|
||||||
'sshkeys' => 'SSH Public Keys',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (PhabricatorUserSSHKeysSettingsPanelController::isEnabled()) {
|
||||||
|
$this->pages['sshkeys'] = 'SSH Public Keys';
|
||||||
|
}
|
||||||
|
|
||||||
$oauth_providers = PhabricatorOAuthProvider::getAllProviders();
|
$oauth_providers = PhabricatorOAuthProvider::getAllProviders();
|
||||||
foreach ($oauth_providers as $provider) {
|
foreach ($oauth_providers as $provider) {
|
||||||
if (!$provider->isProviderEnabled()) {
|
if (!$provider->isProviderEnabled()) {
|
||||||
|
@ -64,6 +69,10 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
|
||||||
case 'sshkeys':
|
case 'sshkeys':
|
||||||
$delegate = new PhabricatorUserSSHKeysSettingsPanelController($request);
|
$delegate = new PhabricatorUserSSHKeysSettingsPanelController($request);
|
||||||
break;
|
break;
|
||||||
|
case 'preferences':
|
||||||
|
$delegate = new PhabricatorUserPreferenceSettingsPanelController(
|
||||||
|
$request);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (empty($this->pages[$this->page])) {
|
if (empty($this->pages[$this->page])) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'applications/people/controller/settings/pa
|
||||||
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/conduit');
|
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/conduit');
|
||||||
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/email');
|
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/email');
|
||||||
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/oauth');
|
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/oauth');
|
||||||
|
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/preferences');
|
||||||
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/sshkeys');
|
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/sshkeys');
|
||||||
phutil_require_module('phabricator', 'view/layout/sidenav');
|
phutil_require_module('phabricator', 'view/layout/sidenav');
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
class PhabricatorEditPreferencesController
|
class PhabricatorUserPreferenceSettingsPanelController
|
||||||
extends PhabricatorPreferencesController {
|
extends PhabricatorUserSettingsPanelController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ extends PhabricatorPreferencesController {
|
||||||
$preferences->setPreferences($pref_dict);
|
$preferences->setPreferences($pref_dict);
|
||||||
$preferences->save();
|
$preferences->save();
|
||||||
return id(new AphrontRedirectResponse())
|
return id(new AphrontRedirectResponse())
|
||||||
->setURI('/preferences/?saved=true');
|
->setURI('/settings/page/preferences/?saved=true');
|
||||||
}
|
}
|
||||||
|
|
||||||
$example_string = <<<EXAMPLE
|
$example_string = <<<EXAMPLE
|
||||||
|
@ -51,8 +51,8 @@ function helloWorld() {
|
||||||
EXAMPLE;
|
EXAMPLE;
|
||||||
|
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setAction('/preferences/')
|
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
->setAction('/settings/page/preferences/')
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSelectControl())
|
id(new AphrontFormSelectControl())
|
||||||
->setLabel('Page Titles')
|
->setLabel('Page Titles')
|
||||||
|
@ -99,15 +99,12 @@ EXAMPLE;
|
||||||
->setErrors(array('Your preferences have been saved.'));
|
->setErrors(array('Your preferences have been saved.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildStandardPageResponse(
|
return id(new AphrontNullView())
|
||||||
array(
|
->appendChild(
|
||||||
$error_view,
|
array(
|
||||||
$panel,
|
$error_view,
|
||||||
),
|
$panel,
|
||||||
array(
|
));
|
||||||
'title' => 'Edit Preferences',
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||||
|
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/base');
|
||||||
phutil_require_module('phabricator', 'applications/people/storage/preferences');
|
phutil_require_module('phabricator', 'applications/people/storage/preferences');
|
||||||
phutil_require_module('phabricator', 'applications/preferences/controller/base');
|
|
||||||
phutil_require_module('phabricator', 'view/form/base');
|
phutil_require_module('phabricator', 'view/form/base');
|
||||||
phutil_require_module('phabricator', 'view/form/control/markup');
|
phutil_require_module('phabricator', 'view/form/control/markup');
|
||||||
phutil_require_module('phabricator', 'view/form/control/select');
|
phutil_require_module('phabricator', 'view/form/control/select');
|
||||||
|
@ -16,9 +16,10 @@ phutil_require_module('phabricator', 'view/form/control/submit');
|
||||||
phutil_require_module('phabricator', 'view/form/control/text');
|
phutil_require_module('phabricator', 'view/form/control/text');
|
||||||
phutil_require_module('phabricator', 'view/form/error');
|
phutil_require_module('phabricator', 'view/form/error');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
phutil_require_module('phabricator', 'view/null');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
||||||
phutil_require_source('PhabricatorEditPreferencesController.php');
|
phutil_require_source('PhabricatorUserPreferenceSettingsPanelController.php');
|
|
@ -21,7 +21,12 @@ class PhabricatorUserSSHKeysSettingsPanelController
|
||||||
|
|
||||||
const PANEL_BASE_URI = '/settings/page/sshkeys/';
|
const PANEL_BASE_URI = '/settings/page/sshkeys/';
|
||||||
|
|
||||||
|
public static function isEnabled() {
|
||||||
|
return PhabricatorEnv::getEnvConfig('auth.sshkeys.enabled');
|
||||||
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||||
phutil_require_module('phabricator', 'aphront/response/reload');
|
phutil_require_module('phabricator', 'aphront/response/reload');
|
||||||
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/base');
|
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/base');
|
||||||
phutil_require_module('phabricator', 'applications/people/storage/usersshkey');
|
phutil_require_module('phabricator', 'applications/people/storage/usersshkey');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
phutil_require_module('phabricator', 'view/dialog');
|
phutil_require_module('phabricator', 'view/dialog');
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2011 Facebook, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
abstract class PhabricatorPreferencesController extends PhabricatorController {
|
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
|
||||||
|
|
||||||
$page = $this->buildStandardPageView();
|
|
||||||
|
|
||||||
$page->setApplicationName('Preferences');
|
|
||||||
$page->setBaseURI('/preferences/');
|
|
||||||
$page->setTitle(idx($data, 'title'));
|
|
||||||
$page->setGlyph("\xE2\x9A\x92");
|
|
||||||
$page->appendChild($view);
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
|
||||||
return $response->setContent($page->render());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is automatically generated. Lint this module to rebuild it.
|
|
||||||
* @generated
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'aphront/response/webpage');
|
|
||||||
phutil_require_module('phabricator', 'applications/base/controller/base');
|
|
||||||
|
|
||||||
phutil_require_module('phutil', 'utils');
|
|
||||||
|
|
||||||
|
|
||||||
phutil_require_source('PhabricatorPreferencesController.php');
|
|
Loading…
Reference in a new issue