|
|
|
@ -33,12 +33,19 @@ OCP\JSON::callCheck(); |
|
|
|
|
$l = \OC::$server->getL10N('user_ldap'); |
|
|
|
|
|
|
|
|
|
$ldapWrapper = new OCA\User_LDAP\LDAP(); |
|
|
|
|
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, '', null); |
|
|
|
|
//needs to be true, otherwise it will also fail with an irritating message |
|
|
|
|
$_POST['ldap_configuration_active'] = 1; |
|
|
|
|
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $_POST['ldap_serverconfig_chooser']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
if ($connection->setConfiguration($_POST)) { |
|
|
|
|
$configurationOk = true; |
|
|
|
|
$conf = $connection->getConfiguration(); |
|
|
|
|
if ($conf['ldap_configuration_active'] === '0') { |
|
|
|
|
//needs to be true, otherwise it will also fail with an irritating message |
|
|
|
|
$conf['ldap_configuration_active'] = '1'; |
|
|
|
|
$configurationOk = $connection->setConfiguration($conf); |
|
|
|
|
} |
|
|
|
|
if ($configurationOk) { |
|
|
|
|
//Configuration is okay |
|
|
|
|
/* |
|
|
|
|
* Clossing the session since it won't be used from this point on. There might be a potential |
|
|
|
|
* race condition if a second request is made: either this request or the other might not |
|
|
|
@ -46,7 +53,6 @@ try { |
|
|
|
|
* problem with that other than the extra connection. |
|
|
|
|
*/ |
|
|
|
|
\OC::$server->getSession()->close(); |
|
|
|
|
//Configuration is okay |
|
|
|
|
if ($connection->bind()) { |
|
|
|
|
/* |
|
|
|
|
* This shiny if block is an ugly hack to find out whether anonymous |
|
|
|
|