summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-05-15 11:03:33 -0500
committerGitHub <noreply@github.com>2017-05-15 11:03:33 -0500
commit3f201ec7f3ed65ad672da14b55881ad4d678ce29 (patch)
tree4f827935df5347a9b8ac8b1bd8babc4dab4728a2 /lib
parent79af585ecd005298f78a926734d5d844ac32cb5e (diff)
parent975e572a3d6f01a6b7cda7de2aec8b27a7141cf0 (diff)
downloadnextcloud-server-3f201ec7f3ed65ad672da14b55881ad4d678ce29.tar.gz
nextcloud-server-3f201ec7f3ed65ad672da14b55881ad4d678ce29.zip
Merge pull request #4871 from nextcloud/remove-more-personal-info-on-user-deletion
Remove more personal info on user deletion
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php13
-rw-r--r--lib/private/User/User.php5
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));
}