diff options
author | yemkareems <yemkareems@gmail.com> | 2024-05-16 16:48:47 +0530 |
---|---|---|
committer | Louis <louis@chmn.me> | 2024-05-30 15:00:28 +0200 |
commit | 043c64aef15e59fff9425995ca9aedb212081c4d (patch) | |
tree | 305773a98cc88d6746b41abc6f7de05f6b8b0c9d | |
parent | 8d2502aca2bb895674a6883de6d923ac4d6e8aec (diff) | |
download | nextcloud-server-043c64aef15e59fff9425995ca9aedb212081c4d.tar.gz nextcloud-server-043c64aef15e59fff9425995ca9aedb212081c4d.zip |
fix: delete user credentials stored in storages_credentials when user gets deleted
Signed-off-by: yemkareems <yemkareems@gmail.com>
-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()); } } |