ConfigController: Warn the user if he's about to remove referenced resources

refs #9804
This commit is contained in:
Johannes Meyer 2016-11-11 11:01:16 +01:00
parent 252ce5d60d
commit 82cc96173d
1 changed files with 14 additions and 3 deletions

View File

@ -395,10 +395,10 @@ class ConfigController extends Controller
$authConfig = Config::app('authentication');
foreach ($authConfig as $backendName => $config) {
if ($config->get('resource') === $resource) {
$form->addDescription(sprintf(
$form->warning(sprintf(
$this->translate(
'The resource "%s" is currently utilized for authentication by user backend "%s". ' .
'Removing the resource can result in noone being able to log in any longer.'
'The resource "%s" is currently utilized for authentication by user backend "%s".'
. ' Removing the resource can result in noone being able to log in any longer.'
),
$resource,
$backendName
@ -406,6 +406,17 @@ class ConfigController extends Controller
}
}
// Check if selected resource is currently used as user preferences backend
if (Config::app()->get('global', 'config_resource') === $resource) {
$form->warning(sprintf(
$this->translate(
'The resource "%s" is currently utilized to store user preferences. Removing the'
. ' resource causes all current user preferences not being available any longer.'
),
$resource
));
}
$this->view->form = $form;
$this->render('resource/remove');
}