1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Some formatting changes for showing auth provider config guidance

Summary:
Ref T7667. On the road to locking the auth config, also clean up some minor UI issues:

* Only show the warning about not Phacility instance auth if the user isn't a manager (see next diff).
* When rendering more than one warning in the guidance, add bullets.
* I didn't like the text in the `auth.config-lock` config setting.

Test Plan: Loaded the page, saw more reasonable-looking guidance: {F6369405}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T7667

Differential Revision: https://secure.phabricator.com/D20400
This commit is contained in:
Austin McKinley 2019-04-11 13:02:04 -07:00
parent e7a31832bf
commit 0583f6dc50
6 changed files with 49 additions and 15 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array( 'names' => array(
'conpherence.pkg.css' => '3c8a0668', 'conpherence.pkg.css' => '3c8a0668',
'conpherence.pkg.js' => '020aebcf', 'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '77c4f199', 'core.pkg.css' => '20f3fea5',
'core.pkg.js' => '69247edd', 'core.pkg.js' => '69247edd',
'differential.pkg.css' => '8d8360fb', 'differential.pkg.css' => '8d8360fb',
'differential.pkg.js' => '67e02996', 'differential.pkg.js' => '67e02996',
@ -160,7 +160,7 @@ return array(
'rsrc/css/phui/phui-icon-set-selector.css' => '7aa5f3ec', 'rsrc/css/phui/phui-icon-set-selector.css' => '7aa5f3ec',
'rsrc/css/phui/phui-icon.css' => '4cbc684a', 'rsrc/css/phui/phui-icon.css' => '4cbc684a',
'rsrc/css/phui/phui-image-mask.css' => '62c7f4d2', 'rsrc/css/phui/phui-image-mask.css' => '62c7f4d2',
'rsrc/css/phui/phui-info-view.css' => '37b8d9ce', 'rsrc/css/phui/phui-info-view.css' => 'a10a909b',
'rsrc/css/phui/phui-invisible-character-view.css' => 'c694c4a4', 'rsrc/css/phui/phui-invisible-character-view.css' => 'c694c4a4',
'rsrc/css/phui/phui-left-right.css' => '68513c34', 'rsrc/css/phui/phui-left-right.css' => '68513c34',
'rsrc/css/phui/phui-lightbox.css' => '4ebf22da', 'rsrc/css/phui/phui-lightbox.css' => '4ebf22da',
@ -842,7 +842,7 @@ return array(
'phui-icon-set-selector-css' => '7aa5f3ec', 'phui-icon-set-selector-css' => '7aa5f3ec',
'phui-icon-view-css' => '4cbc684a', 'phui-icon-view-css' => '4cbc684a',
'phui-image-mask-css' => '62c7f4d2', 'phui-image-mask-css' => '62c7f4d2',
'phui-info-view-css' => '37b8d9ce', 'phui-info-view-css' => 'a10a909b',
'phui-inline-comment-view-css' => '48acce5b', 'phui-inline-comment-view-css' => '48acce5b',
'phui-invisible-character-view-css' => 'c694c4a4', 'phui-invisible-character-view-css' => 'c694c4a4',
'phui-left-right-css' => '68513c34', 'phui-left-right-css' => '68513c34',

View file

@ -13,6 +13,7 @@ final class PhabricatorAuthListController
$list = new PHUIObjectItemListView(); $list = new PHUIObjectItemListView();
$can_manage = $this->hasApplicationCapability( $can_manage = $this->hasApplicationCapability(
AuthManageProvidersCapability::CAPABILITY); AuthManageProvidersCapability::CAPABILITY);
$is_locked = PhabricatorEnv::getEnvConfig('auth.lock-config');
foreach ($configs as $config) { foreach ($configs as $config) {
$item = new PHUIObjectItemView(); $item = new PHUIObjectItemView();
@ -69,7 +70,8 @@ final class PhabricatorAuthListController
$crumbs->addTextCrumb(pht('Login and Registration')); $crumbs->addTextCrumb(pht('Login and Registration'));
$crumbs->setBorder(true); $crumbs->setBorder(true);
$guidance_context = new PhabricatorAuthProvidersGuidanceContext(); $guidance_context = id(new PhabricatorAuthProvidersGuidanceContext())
->setCanManage($can_manage);
$guidance = id(new PhabricatorGuidanceEngine()) $guidance = id(new PhabricatorGuidanceEngine())
->setViewer($viewer) ->setViewer($viewer)
@ -81,7 +83,7 @@ final class PhabricatorAuthListController
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
->setHref($this->getApplicationURI('config/new/')) ->setHref($this->getApplicationURI('config/new/'))
->setIcon('fa-plus') ->setIcon('fa-plus')
->setDisabled(!$can_manage) ->setDisabled(!$can_manage || $is_locked)
->setText(pht('Add Provider')); ->setText(pht('Add Provider'));
$list->setFlush(true); $list->setFlush(true);

View file

@ -1,4 +1,17 @@
<?php <?php
final class PhabricatorAuthProvidersGuidanceContext final class PhabricatorAuthProvidersGuidanceContext
extends PhabricatorGuidanceContext {} extends PhabricatorGuidanceContext {
private $canManage = false;
public function setCanManage($can_manage) {
$this->canManage = $can_manage;
return $this;
}
public function getCanManage() {
return $this->canManage;
}
}

View file

@ -92,6 +92,25 @@ final class PhabricatorAuthProvidersGuidanceEngineExtension
->setMessage($message); ->setMessage($message);
} }
$locked_config_key = 'auth.lock-config';
$is_locked = PhabricatorEnv::getEnvConfig($locked_config_key);
if ($is_locked) {
$message = pht(
'Authentication provider configuration is locked, and can not be '.
'changed without being unlocked. See the configuration setting %s '.
'for details.',
phutil_tag(
'a',
array(
'href' => '/config/edit/'.$locked_config_key,
),
$locked_config_key));
$results[] = $this->newWarning('auth.locked-config')
->setPriority(500)
->setMessage($message);
}
return $results; return $results;
} }

View file

@ -85,13 +85,13 @@ final class PhabricatorAuthenticationConfigOptions
'configuration from the CLI before it can be edited.')) 'configuration from the CLI before it can be edited.'))
->setDescription( ->setDescription(
pht( pht(
'Normally, administrators configure authentication providers only '. 'When set to `true`, the authentication provider configuration '.
'once, immediately after instance creation. To further secure '. 'for this instance can not be modified without first running '.
'your instance, you can set this configuration option to `true`, '. '`bin/auth unlock` from the command line. This is to reduce '.
'which will require an adminstrator with CLI access to run '. 'the security impact of a compromised administrator account. '.
'`bin/auth unlock` to make any later changes to authentication '. "\n\n".
"provider configuration.\n\nAfter changing the config, you should ". 'After running `bin/auth unlock` and making your changes to the '.
'run `bin/auth lock` again from the CLI.')) 'authentication provider config, you should run `bin/auth lock`.'))
->setLocked(true), ->setLocked(true),
$this->newOption('account.editable', 'bool', true) $this->newOption('account.editable', 'bool', true)
->setBoolOptions( ->setBoolOptions(

View file

@ -74,8 +74,8 @@ h1.phui-info-view-head {
} }
.phui-info-view-list { .phui-info-view-list {
margin: 0; margin-left: 30px;
list-style: none; list-style: disc;
line-height: 1.6em; line-height: 1.6em;
} }