From 169a646a1a62a80eb908ec1d6431f6b375151564 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 9 Oct 2014 10:47:45 +0200 Subject: [PATCH] Fix that LDAP discovery suggestions are not populated I've broke this when re-commiting the changes made by Matthias and fixed this by populating dependent pages directly in WebSetup::setupPage. refs #7163 --- application/forms/Setup/AuthBackendPage.php | 24 -------------------- application/forms/Setup/LdapResourcePage.php | 24 -------------------- library/Icinga/Application/WebSetup.php | 6 ++--- 3 files changed, 3 insertions(+), 51 deletions(-) diff --git a/application/forms/Setup/AuthBackendPage.php b/application/forms/Setup/AuthBackendPage.php index d7dfe5deb..12d3e3f7d 100644 --- a/application/forms/Setup/AuthBackendPage.php +++ b/application/forms/Setup/AuthBackendPage.php @@ -23,13 +23,6 @@ class AuthBackendPage extends Form */ protected $config; - /** - * Suggested configuration settings - * - * @var array - */ - protected $suggestions; - /** * Initialize this page */ @@ -61,19 +54,6 @@ class AuthBackendPage extends Form return new Zend_Config($this->config); } - /** - * Set suggested configuration settings - * - * @param array $suggestions - * - * @return self - */ - public function setSuggestions(array $suggestions) - { - $this->suggestions = $suggestions; - return $this; - } - /** * @see Form::createElements() */ @@ -105,10 +85,6 @@ class AuthBackendPage extends Form $backendForm = new DbBackendForm(); $backendForm->createElements($formData)->removeElement('resource'); } elseif ($this->config['type'] === 'ldap') { - if ($this->suggestions !== null) { - $formData += $this->suggestions; - } - $backendForm = new LdapBackendForm(); $backendForm->createElements($formData)->removeElement('resource'); } else { // $this->config['type'] === 'autologin' diff --git a/application/forms/Setup/LdapResourcePage.php b/application/forms/Setup/LdapResourcePage.php index 9436743e3..4a31502db 100644 --- a/application/forms/Setup/LdapResourcePage.php +++ b/application/forms/Setup/LdapResourcePage.php @@ -13,13 +13,6 @@ use Icinga\Form\Config\Resource\LdapResourceForm; */ class LdapResourcePage extends Form { - /** - * Suggested configuration settings - * - * @var array - */ - protected $suggestions; - /** * Initialize this page */ @@ -28,19 +21,6 @@ class LdapResourcePage extends Form $this->setName('setup_ldap_resource'); } - /** - * Set suggested configuration settings - * - * @param array $suggestions - * - * @return self - */ - public function setSuggestions(array $suggestions) - { - $this->suggestions = $suggestions; - return $this; - } - /** * @see Form::createElements() */ @@ -79,10 +59,6 @@ class LdapResourcePage extends Form ); } - if ($this->suggestions !== null) { - $formData += $this->suggestions; - } - $resourceForm = new LdapResourceForm(); $this->addElements($resourceForm->createElements($formData)->getElements()); } diff --git a/library/Icinga/Application/WebSetup.php b/library/Icinga/Application/WebSetup.php index 18139d71a..1effea33a 100644 --- a/library/Icinga/Application/WebSetup.php +++ b/library/Icinga/Application/WebSetup.php @@ -89,7 +89,7 @@ class WebSetup extends Wizard implements SetupWizard $suggestions = $this->getPageData('setup_ldap_discovery_confirm'); if (isset($suggestions['backend'])) { - $page->setSuggestions($suggestions['backend']); + $page->populate($suggestions['backend']); } } } else if ($page->getName() === 'setup_ldap_discovery_confirm') { @@ -120,11 +120,11 @@ class WebSetup extends Wizard implements SetupWizard t('The given resource name must be unique and is already in use by the database resource') ); } + $suggestion = $this->getPageData('setup_ldap_discovery_confirm'); if (isset($suggestion['resource'])) { - $page->setSuggestions($suggestion['resource']); + $page->populate($suggestion['resource']); } - } elseif ($page->getName() === 'setup_authentication_type') { $authData = $this->getPageData($page->getName()); if ($authData !== null && $request->getPost('type') !== $authData['type']) {