Remove LdapBackendForm::isValidPartial()

This commit is contained in:
Alexander A. Klimov 2017-06-21 16:59:46 +02:00
parent 686d022987
commit 8b43bd6646

View File

@ -232,7 +232,8 @@ class LdapBackendForm extends Form
. ' authenticating the user based on the username without the domain part.' . ' authenticating the user based on the username without the domain part.'
. ' If your LDAP backend holds usernames with a domain part or if it is not necessary in your setup' . ' If your LDAP backend holds usernames with a domain part or if it is not necessary in your setup'
. ' to authenticate users based on their domains, leave this field empty.' . ' to authenticate users based on their domains, leave this field empty.'
) ),
'preserveDefault' => true
) )
); );
@ -255,26 +256,16 @@ class LdapBackendForm extends Form
'formnovalidate' => 'formnovalidate' 'formnovalidate' => 'formnovalidate'
) )
); );
}
/** if ($this->getElement('btn_discover_domain')->isChecked() && isset($formData['resource'])) {
* {@inheritdoc} $this->populateDomain(ResourceFactory::create($formData['resource']));
*/
public function isValidPartial(array $formData)
{
if (isset($formData['btn_discover_domain']) && parent::isValid($formData)) {
return $this->populateDomain(ResourceFactory::create($this->getElement('resource')->getValue()));
} }
return true;
} }
/** /**
* Discover the domain the LDAP server is responsible for and fill it in the form * Discover the domain the LDAP server is responsible for and fill it in the form
* *
* @param LdapConnection $connection * @param LdapConnection $connection
*
* @return bool Whether the discovery succeeded
*/ */
public function populateDomain(LdapConnection $connection) public function populateDomain(LdapConnection $connection)
{ {
@ -282,11 +273,9 @@ class LdapBackendForm extends Form
$domain = $this->discoverDomain($connection); $domain = $this->discoverDomain($connection);
} catch (LdapException $e) { } catch (LdapException $e) {
$this->_elements['btn_discover_domain']->addError($e->getMessage()); $this->_elements['btn_discover_domain']->addError($e->getMessage());
return false;
} }
$this->_elements['domain']->setValue($domain); $this->_elements['domain']->setValue($domain);
return true;
} }
/** /**