From 0c0b81602972a17bf81dfb2827e9d03bc2848b1b Mon Sep 17 00:00:00 2001 From: yemkareems Date: Thu, 16 May 2024 16:48:47 +0530 Subject: fix: delete user credentials stored in storages_credentials when user gets deleted Signed-off-by: yemkareems [skip ci] --- lib/private/User/Listeners/BeforeUserDeletedListener.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/User/Listeners/BeforeUserDeletedListener.php b/lib/private/User/Listeners/BeforeUserDeletedListener.php index ec1f80c5413..42d07a51682 100644 --- a/lib/private/User/Listeners/BeforeUserDeletedListener.php +++ b/lib/private/User/Listeners/BeforeUserDeletedListener.php @@ -35,10 +35,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 +63,7 @@ class BeforeUserDeletedListener implements IEventListener { 'exception' => $e, ]); } + // Delete storages credentials on user deletion + $this->credentialsManager->erase($user->getUID()); } } -- cgit v1.2.3 From f7e7761a434ab7af995251f2694f162ecdec1584 Mon Sep 17 00:00:00 2001 From: yemkareems Date: Thu, 16 May 2024 18:05:03 +0530 Subject: fix: restored the file to what it is in master branch Signed-off-by: yemkareems --- lib/private/User/Listeners/BeforeUserDeletedListener.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/User/Listeners/BeforeUserDeletedListener.php b/lib/private/User/Listeners/BeforeUserDeletedListener.php index 42d07a51682..a19f1dda791 100644 --- a/lib/private/User/Listeners/BeforeUserDeletedListener.php +++ b/lib/private/User/Listeners/BeforeUserDeletedListener.php @@ -25,9 +25,10 @@ namespace OC\User\Listeners; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use OCP\User\Events\BeforeUserDeletedEvent; use OCP\Files\NotFoundException; use OCP\IAvatarManager; +use OCP\Security\ICredentialsManager; +use OCP\User\Events\BeforeUserDeletedEvent; use Psr\Log\LoggerInterface; /** -- cgit v1.2.3