Skip to content
Snippets Groups Projects
Commit f021dad2 authored by Björn Schießle's avatar Björn Schießle
Browse files

remove user from cache if he was deleted successfully

parent b0b76fe0
No related branches found
No related tags found
No related merge requests found
......@@ -187,18 +187,25 @@ class OC_User {
public static function deleteUser($uid) {
$user = self::getManager()->get($uid);
if ($user) {
$user->delete();
$result = $user->delete();
// We have to delete the user from all groups
foreach (OC_Group::getUserGroups($uid) as $i) {
OC_Group::removeFromGroup($uid, $i);
// if delete was successful we clean-up the rest
if ($result) {
// We have to delete the user from all groups
foreach (OC_Group::getUserGroups($uid) as $i) {
OC_Group::removeFromGroup($uid, $i);
}
// Delete the user's keys in preferences
OC_Preferences::deleteUser($uid);
// Delete user files in /data/
OC_Helper::rmdirr(OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $uid . '/');
// Remove it from the Cache
self::getManager()->delete($uid);
}
// Delete the user's keys in preferences
OC_Preferences::deleteUser($uid);
// Delete user files in /data/
OC_Helper::rmdirr(OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $uid . '/');
return true;
} else {
return false;
......
......@@ -118,6 +118,20 @@ class Manager extends PublicEmitter {
return ($user !== null);
}
/**
* remove deleted user from cache
*
* @param string $uid
* @return bool
*/
public function delete($uid) {
if (isset($this->cachedUsers[$uid])) {
unset($this->cachedUsers[$uid]);
return true;
}
return false;
}
/**
* Check if the password is valid for the user
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment