make all this work in an early configuration state in the wizard by marking the config active and ignoring the validation state.

remotes/origin/stable6
Arthur Schiwon 2014-06-11 22:36:40 +07:00
parent c491fa272e
commit 0ba9a6b73d
2 changed files with 15 additions and 1 deletions

@ -41,6 +41,8 @@ class Connection extends LDAPUtility {
protected $doNotValidate = false;
protected $ignoreValidation = false;
/**
* @brief Constructor
* @param \OCA\user_ldap\lib\ILDAPWrapper $ldap
@ -108,6 +110,16 @@ class Connection extends LDAPUtility {
}
}
/**
* sets whether the result of the configuration validation shall
* be ignored when establishing the connection. Used by the Wizard
* in early configuration state.
* @param bool $state
*/
public function setIgnoreValidation($state) {
$this->ignoreValidation = (bool)$state;
}
/**
* @brief initializes the LDAP backend
* @param $force read the config settings no matter what
@ -441,7 +453,7 @@ class Connection extends LDAPUtility {
if(!$phpLDAPinstalled) {
return false;
}
if(!$this->configured) {
if(!$this->ignoreValidation && !$this->configured) {
\OCP\Util::writeLog('user_ldap',
'Configuration is invalid, cannot connect',
\OCP\Util::WARN);

@ -1072,6 +1072,8 @@ class Wizard extends LDAPUtility {
private function getAccess() {
$con = new Connection($this->ldap, '', null);
$con->setConfiguration($this->configuration->getConfiguration());
$con->ldapConfigurationActive = true;
$con->setIgnoreValidation(true);
$ldapAccess = new Access($con, $this->ldap);
return $ldapAccess;
}