parent
a0ffdb0f7c
commit
de53925c7c
|
@ -23,6 +23,13 @@ class AuthBackendPage extends Form
|
|||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Default values for the subform's elements suggested by a previous step
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $suggestions = array();
|
||||
|
||||
/**
|
||||
* 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');
|
||||
$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') {
|
||||
$page->setWizard($this);
|
||||
} elseif ($page->getName() === 'setup_authentication_backend') {
|
||||
/** @var AuthBackendPage $page */
|
||||
|
||||
$authData = $this->getPageData('setup_authentication_type');
|
||||
if ($authData['type'] === 'db') {
|
||||
$page->setResourceConfig($this->getPageData('setup_auth_db_resource'));
|
||||
} elseif ($authData['type'] === 'ldap') {
|
||||
$page->setResourceConfig($this->getPageData('setup_ldap_resource'));
|
||||
|
||||
if (! $this->hasPageData('setup_authentication_backend') && ! $request->isPost()) {
|
||||
$suggestions = $this->getPageData('setup_ldap_discovery');
|
||||
if (isset($suggestions['backend'])) {
|
||||
$page->populate($suggestions['backend']);
|
||||
}
|
||||
$suggestions = $this->getPageData('setup_ldap_discovery');
|
||||
if (isset($suggestions['backend'])) {
|
||||
$page->setSuggestions($suggestions['backend']);
|
||||
}
|
||||
|
||||
if ($this->getDirection() === static::FORWARD) {
|
||||
|
|
Loading…
Reference in New Issue