Merge pull request #3082 from owncloud/ldap_confcache_opt

LDAP: reset user/group-config association only after exists-check, may p...
This commit is contained in:
Bart Visscher 2013-04-23 09:44:38 -07:00
commit c357f7b8cd
2 changed files with 18 additions and 4 deletions

View file

@ -76,8 +76,15 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface {
if(isset($this->backends[$prefix])) {
$result = call_user_func_array(array($this->backends[$prefix], $method), $parameters);
if(!$result) {
//not found here, reset cache to null
$this->writeToCache($cacheKey, null);
//not found here, reset cache to null if group vanished
//because sometimes methods return false with a reason
$groupExists = call_user_func_array(
array($this->backends[$prefix], 'groupExists'),
array($gid)
);
if(!$groupExists) {
$this->writeToCache($cacheKey, null);
}
}
return $result;
}

View file

@ -76,8 +76,15 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
if(isset($this->backends[$prefix])) {
$result = call_user_func_array(array($this->backends[$prefix], $method), $parameters);
if(!$result) {
//not found here, reset cache to null
$this->writeToCache($cacheKey, null);
//not found here, reset cache to null if user vanished
//because sometimes methods return false with a reason
$userExists = call_user_func_array(
array($this->backends[$prefix], 'userExists'),
array($uid)
);
if(!$userExists) {
$this->writeToCache($cacheKey, null);
}
}
return $result;
}