[icinga-checkins] icinga.org: icingaweb2/master: ConfigController: Warn the user if he' s about to remove referenced resources
git at icinga.org
git at icinga.org
Fri Nov 11 11:04:02 CET 2016
Module: icingaweb2
Branch: master
Commit: 82cc96173d5456c8686da8e4d5631927228d18d7
URL: https://git.icinga.org/?p=icingaweb2.git;a=commit;h=82cc96173d5456c8686da8e4d5631927228d18d7
Author: Johannes Meyer <johannes.meyer at netways.de>
Date: Fri Nov 11 11:01:16 2016 +0100
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 c652983..d22e3a6 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');
}
More information about the icinga-checkins
mailing list