diff options
author | Joas Schilling <coding@schilljs.com> | 2017-05-15 13:30:52 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-05-15 13:31:31 +0200 |
commit | 975e572a3d6f01a6b7cda7de2aec8b27a7141cf0 (patch) | |
tree | 0a032f818b132b54c7582384216cf9affa0a71f3 | |
parent | cd79eb1b2ce70876a496e071af90bd601d8ddcd1 (diff) | |
download | nextcloud-server-975e572a3d6f01a6b7cda7de2aec8b27a7141cf0.tar.gz nextcloud-server-975e572a3d6f01a6b7cda7de2aec8b27a7141cf0.zip |
Remove account data on user deletion
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/private/Accounts/AccountManager.php | 13 | ||||
-rw-r--r-- | lib/private/User/User.php | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 41fdad148aa..7db686c33a1 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -114,6 +114,19 @@ class AccountManager { } /** + * delete user from accounts table + * + * @param IUser $user + */ + public function deleteUser(IUser $user) { + $uid = $user->getUID(); + $query = $this->connection->getQueryBuilder(); + $query->delete($this->table) + ->where($query->expr()->eq('uid', $query->createNamedParameter($uid))) + ->execute(); + } + + /** * get stored data from a given user * * @param IUser $user diff --git a/lib/private/User/User.php b/lib/private/User/User.php index f55807bc769..5e5d3f0d772 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -30,6 +30,7 @@ namespace OC\User; +use OC\Accounts\AccountManager; use OC\Files\Cache\Storage; use OC\Hooks\Emitter; use OC_Helper; @@ -235,6 +236,10 @@ class User implements IUser { $notification->setUser($this->uid); \OC::$server->getNotificationManager()->markProcessed($notification); + /** @var AccountManager $accountManager */ + $accountManager = \OC::$server->query(AccountManager::class); + $accountManager->deleteUser($this); + if ($this->emitter) { $this->emitter->emit('\OC\User', 'postDelete', array($this)); } |