diff options
author | yemkareems <yemkareems@gmail.com> | 2024-05-16 16:48:47 +0530 |
---|---|---|
committer | yemkareems <yemkareems@gmail.com> | 2024-05-16 16:48:47 +0530 |
commit | 7278198e6b31190f73f5b9fff57640b263de46ca (patch) | |
tree | 8d8ed9e2dba398ebe61c2a26c68770387541fcd2 /lib/private/User | |
parent | ee8a97be4330d402d5bc926f64c6d8ab6812df23 (diff) | |
download | nextcloud-server-7278198e6b31190f73f5b9fff57640b263de46ca.tar.gz nextcloud-server-7278198e6b31190f73f5b9fff57640b263de46ca.zip |
fix: delete user credentials stored in storages_credentials when user gets deleted
Signed-off-by: yemkareems <yemkareems@gmail.com>
Diffstat (limited to 'lib/private/User')
-rw-r--r-- | lib/private/User/Listeners/BeforeUserDeletedListener.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/User/Listeners/BeforeUserDeletedListener.php b/lib/private/User/Listeners/BeforeUserDeletedListener.php index 8978c341a13..a19f1dda791 100644 --- a/lib/private/User/Listeners/BeforeUserDeletedListener.php +++ b/lib/private/User/Listeners/BeforeUserDeletedListener.php @@ -27,6 +27,7 @@ use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\Files\NotFoundException; use OCP\IAvatarManager; +use OCP\Security\ICredentialsManager; use OCP\User\Events\BeforeUserDeletedEvent; use Psr\Log\LoggerInterface; @@ -35,10 +36,12 @@ use Psr\Log\LoggerInterface; */ class BeforeUserDeletedListener implements IEventListener { private IAvatarManager $avatarManager; + private ICredentialsManager $credentialsManager; private LoggerInterface $logger; - public function __construct(LoggerInterface $logger, IAvatarManager $avatarManager) { + public function __construct(LoggerInterface $logger, IAvatarManager $avatarManager, ICredentialsManager $credentialsManager) { $this->avatarManager = $avatarManager; + $this->credentialsManager = $credentialsManager; $this->logger = $logger; } @@ -61,5 +64,7 @@ class BeforeUserDeletedListener implements IEventListener { 'exception' => $e, ]); } + // Delete storages credentials on user deletion + $this->credentialsManager->erase($user->getUID()); } } |