parent
a0ffdb0f7c
commit
de53925c7c
|
@ -23,6 +23,13 @@ class AuthBackendPage extends Form
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default values for the subform's elements suggested by a previous step
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $suggestions = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize this page
|
* Initialize this page
|
||||||
*/
|
*/
|
||||||
|
@ -112,6 +119,13 @@ class AuthBackendPage extends Form
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->suggestions as $key => $suggestion) {
|
||||||
|
$element = $backendForm->getElement($key);
|
||||||
|
if ($element !== null) {
|
||||||
|
$element->setValue($suggestion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$backendForm->getElement('name')->setValue('icingaweb2');
|
$backendForm->getElement('name')->setValue('icingaweb2');
|
||||||
$this->addSubForm($backendForm, 'backend_form');
|
$this->addSubForm($backendForm, 'backend_form');
|
||||||
}
|
}
|
||||||
|
@ -231,4 +245,28 @@ class AuthBackendPage extends Form
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default values for the subform's elements suggested by a previous step
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getSuggestions()
|
||||||
|
{
|
||||||
|
return $this->suggestions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default values for the subform's elements suggested by a previous step
|
||||||
|
*
|
||||||
|
* @param string[] $suggestions
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setSuggestions(array $suggestions)
|
||||||
|
{
|
||||||
|
$this->suggestions = $suggestions;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,17 +132,17 @@ class WebWizard extends Wizard implements SetupWizard
|
||||||
if ($page->getName() === 'setup_requirements') {
|
if ($page->getName() === 'setup_requirements') {
|
||||||
$page->setWizard($this);
|
$page->setWizard($this);
|
||||||
} elseif ($page->getName() === 'setup_authentication_backend') {
|
} elseif ($page->getName() === 'setup_authentication_backend') {
|
||||||
|
/** @var AuthBackendPage $page */
|
||||||
|
|
||||||
$authData = $this->getPageData('setup_authentication_type');
|
$authData = $this->getPageData('setup_authentication_type');
|
||||||
if ($authData['type'] === 'db') {
|
if ($authData['type'] === 'db') {
|
||||||
$page->setResourceConfig($this->getPageData('setup_auth_db_resource'));
|
$page->setResourceConfig($this->getPageData('setup_auth_db_resource'));
|
||||||
} elseif ($authData['type'] === 'ldap') {
|
} elseif ($authData['type'] === 'ldap') {
|
||||||
$page->setResourceConfig($this->getPageData('setup_ldap_resource'));
|
$page->setResourceConfig($this->getPageData('setup_ldap_resource'));
|
||||||
|
|
||||||
if (! $this->hasPageData('setup_authentication_backend') && ! $request->isPost()) {
|
$suggestions = $this->getPageData('setup_ldap_discovery');
|
||||||
$suggestions = $this->getPageData('setup_ldap_discovery');
|
if (isset($suggestions['backend'])) {
|
||||||
if (isset($suggestions['backend'])) {
|
$page->setSuggestions($suggestions['backend']);
|
||||||
$page->populate($suggestions['backend']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getDirection() === static::FORWARD) {
|
if ($this->getDirection() === static::FORWARD) {
|
||||||
|
|
Loading…
Reference in New Issue