diff options
author | yemkareems <yemkareems@gmail.com> | 2024-06-03 18:38:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-03 18:38:15 +0530 |
commit | 0b39ab1c6d0f05f303a094a0987a0c2b7a9efa52 (patch) | |
tree | bf47b163a8dec93b63b7df6dc61e9c500555c893 | |
parent | 06c01c568d6e1084a1fb2e2bc1015ea1a2d1c82f (diff) | |
parent | 043c64aef15e59fff9425995ca9aedb212081c4d (diff) | |
download | nextcloud-server-0b39ab1c6d0f05f303a094a0987a0c2b7a9efa52.tar.gz nextcloud-server-0b39ab1c6d0f05f303a094a0987a0c2b7a9efa52.zip |
Merge pull request #45362 from nextcloud/backport/45355/stable28
[stable28] fix: delete user credentials stored in storages_credentials when user gets deleted
-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()); } } |