parent
0b8e4d4b5c
commit
9400bf9224
|
@ -264,19 +264,32 @@ class LdapBackendForm extends Form
|
||||||
public function isValidPartial(array $formData)
|
public function isValidPartial(array $formData)
|
||||||
{
|
{
|
||||||
if (isset($formData['btn_discover_domains']) && parent::isValid($formData)) {
|
if (isset($formData['btn_discover_domains']) && parent::isValid($formData)) {
|
||||||
try {
|
return $this->populateDomains(ResourceFactory::create($this->getElement('resource')->getValue()));
|
||||||
$domains = $this->discoverDomains(ResourceFactory::create($this->getElement('resource')->getValue()));
|
|
||||||
} catch (LdapException $e) {
|
|
||||||
$this->_elements['btn_discover_domains']->addError($e->getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_elements['domains']->setValue(implode(',', $domains));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Discover the domains the LDAP server is responsible for and fill them in the form
|
||||||
|
*
|
||||||
|
* @param LdapConnection $connection
|
||||||
|
*
|
||||||
|
* @return bool Whether the discovery succeeded
|
||||||
|
*/
|
||||||
|
public function populateDomains(LdapConnection $connection)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$domains = $this->discoverDomains($connection);
|
||||||
|
} catch (LdapException $e) {
|
||||||
|
$this->_elements['btn_discover_domains']->addError($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_elements['domains']->setValue(implode(',', $domains));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discover the domains the LDAP server is responsible for
|
* Discover the domains the LDAP server is responsible for
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue