From 04ff2e271a9861d09a8e2b777a3a9ea3a197a5cb Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 6 Oct 2014 16:52:19 +0200 Subject: [PATCH] Drop dependent page data more earlier Not only the "setup_authentication_backend" page depends on the auth type but also the "setup_admin_account" page, so just drop both entries once a new auth type gets submitted. refs #7163 --- library/Icinga/Application/WebSetup.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/library/Icinga/Application/WebSetup.php b/library/Icinga/Application/WebSetup.php index 896d05287..9f0fa04b6 100644 --- a/library/Icinga/Application/WebSetup.php +++ b/library/Icinga/Application/WebSetup.php @@ -86,15 +86,6 @@ class WebSetup extends Wizard implements SetupWizard } } elseif ($page->getName() === 'setup_authentication_backend') { $authData = $this->getPageData('setup_authentication_type'); - if (($backendData = $this->getPageData($page->getName())) !== null - && $backendData['backend'] !== $authData['type'] - ) { - // Drop any existing page data in case the authentication type has changed, - // otherwise it will conflict with other forms that depend on this one - $pageData = & $this->getPageData(); - unset($pageData[$page->getName()]); - } - if ($authData['type'] === 'db') { $page->setResourceConfig($this->getPageData('setup_db_resource')); } elseif ($authData['type'] === 'ldap') { @@ -125,6 +116,15 @@ class WebSetup extends Wizard implements SetupWizard t('The given resource name must be unique and is already in use by the database resource') ); } + } elseif ($page->getName() === 'setup_authentication_type') { + $authData = $this->getPageData($page->getName()); + if ($authData !== null && $request->getPost('type') !== $authData['type']) { + // Drop any existing page data in case the authentication type has changed, + // otherwise it will conflict with other forms that depend on this one + $pageData = & $this->getPageData(); + unset($pageData['setup_admin_account']); + unset($pageData['setup_authentication_backend']); + } } }