]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: clear the cache not only when TTL changes, but with every settings update....
authorArthur Schiwon <blizzz@owncloud.com>
Thu, 1 Nov 2012 15:48:17 +0000 (16:48 +0100)
committerArthur Schiwon <blizzz@owncloud.com>
Thu, 1 Nov 2012 15:48:17 +0000 (16:48 +0100)
apps/user_ldap/settings.php

index f765151456a462ea3d1b4c653bc5f8f1737fe4e4..ca9855df6c1bee37bf6b40cd7aa06e138961bb2f 100644 (file)
@@ -26,16 +26,12 @@ OCP\Util::addscript('user_ldap', 'settings');
 OCP\Util::addstyle('user_ldap', 'settings');
 
 if ($_POST) {
+       $clearCache = false;
        foreach($params as $param) {
                if(isset($_POST[$param])) {
+                       $clearCache = true;
                        if('ldap_agent_password' == $param) {
                                OCP\Config::setAppValue('user_ldap', $param, base64_encode($_POST[$param]));
-                       } elseif('ldap_cache_ttl' == $param) {
-                               if(OCP\Config::getAppValue('user_ldap', $param,'') != $_POST[$param]) {
-                                       $ldap = new \OCA\user_ldap\lib\Connection('user_ldap');
-                                       $ldap->clearCache();
-                                       OCP\Config::setAppValue('user_ldap', $param, $_POST[$param]);
-                               }
                        } elseif('home_folder_naming_rule' == $param) {
                                $value = empty($_POST[$param]) ? 'opt:username' : 'attr:'.$_POST[$param];
                                OCP\Config::setAppValue('user_ldap', $param, $value);
@@ -54,6 +50,10 @@ if ($_POST) {
                        OCP\Config::setAppValue('user_ldap', $param, 0);
                }
        }
+       if($clearCache){
+               $ldap = new \OCA\user_ldap\lib\Connection('user_ldap');
+               $ldap->clearCache();
+       }
 }
 
 // fill template