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
This commit is contained in:
parent
e29a568bff
commit
169a646a1a
application/forms/Setup
library/Icinga/Application
|
@ -23,13 +23,6 @@ class AuthBackendPage extends Form
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
|
||||||
* Suggested configuration settings
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $suggestions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize this page
|
* Initialize this page
|
||||||
*/
|
*/
|
||||||
|
@ -61,19 +54,6 @@ class AuthBackendPage extends Form
|
||||||
return new Zend_Config($this->config);
|
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()
|
* @see Form::createElements()
|
||||||
*/
|
*/
|
||||||
|
@ -105,10 +85,6 @@ class AuthBackendPage extends Form
|
||||||
$backendForm = new DbBackendForm();
|
$backendForm = new DbBackendForm();
|
||||||
$backendForm->createElements($formData)->removeElement('resource');
|
$backendForm->createElements($formData)->removeElement('resource');
|
||||||
} elseif ($this->config['type'] === 'ldap') {
|
} elseif ($this->config['type'] === 'ldap') {
|
||||||
if ($this->suggestions !== null) {
|
|
||||||
$formData += $this->suggestions;
|
|
||||||
}
|
|
||||||
|
|
||||||
$backendForm = new LdapBackendForm();
|
$backendForm = new LdapBackendForm();
|
||||||
$backendForm->createElements($formData)->removeElement('resource');
|
$backendForm->createElements($formData)->removeElement('resource');
|
||||||
} else { // $this->config['type'] === 'autologin'
|
} else { // $this->config['type'] === 'autologin'
|
||||||
|
|
|
@ -13,13 +13,6 @@ use Icinga\Form\Config\Resource\LdapResourceForm;
|
||||||
*/
|
*/
|
||||||
class LdapResourcePage extends Form
|
class LdapResourcePage extends Form
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Suggested configuration settings
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $suggestions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize this page
|
* Initialize this page
|
||||||
*/
|
*/
|
||||||
|
@ -28,19 +21,6 @@ class LdapResourcePage extends Form
|
||||||
$this->setName('setup_ldap_resource');
|
$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()
|
* @see Form::createElements()
|
||||||
*/
|
*/
|
||||||
|
@ -79,10 +59,6 @@ class LdapResourcePage extends Form
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->suggestions !== null) {
|
|
||||||
$formData += $this->suggestions;
|
|
||||||
}
|
|
||||||
|
|
||||||
$resourceForm = new LdapResourceForm();
|
$resourceForm = new LdapResourceForm();
|
||||||
$this->addElements($resourceForm->createElements($formData)->getElements());
|
$this->addElements($resourceForm->createElements($formData)->getElements());
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ class WebSetup extends Wizard implements SetupWizard
|
||||||
|
|
||||||
$suggestions = $this->getPageData('setup_ldap_discovery_confirm');
|
$suggestions = $this->getPageData('setup_ldap_discovery_confirm');
|
||||||
if (isset($suggestions['backend'])) {
|
if (isset($suggestions['backend'])) {
|
||||||
$page->setSuggestions($suggestions['backend']);
|
$page->populate($suggestions['backend']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($page->getName() === 'setup_ldap_discovery_confirm') {
|
} 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')
|
t('The given resource name must be unique and is already in use by the database resource')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$suggestion = $this->getPageData('setup_ldap_discovery_confirm');
|
$suggestion = $this->getPageData('setup_ldap_discovery_confirm');
|
||||||
if (isset($suggestion['resource'])) {
|
if (isset($suggestion['resource'])) {
|
||||||
$page->setSuggestions($suggestion['resource']);
|
$page->populate($suggestion['resource']);
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($page->getName() === 'setup_authentication_type') {
|
} elseif ($page->getName() === 'setup_authentication_type') {
|
||||||
$authData = $this->getPageData($page->getName());
|
$authData = $this->getPageData($page->getName());
|
||||||
if ($authData !== null && $request->getPost('type') !== $authData['type']) {
|
if ($authData !== null && $request->getPost('type') !== $authData['type']) {
|
||||||
|
|
Loading…
Reference in New Issue