From 82cc96173d5456c8686da8e4d5631927228d18d7 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 11 Nov 2016 11:01:16 +0100 Subject: [PATCH] ConfigController: Warn the user if he's about to remove referenced resources refs #9804 --- application/controllers/ConfigController.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index c65298377..d22e3a680 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -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'); }