summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryemkareems <yemkareems@gmail.com>2024-05-16 16:48:47 +0530
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-05-16 12:27:40 +0000
commit926d611bd38c048a7ae649b4cb665550beb7fc13 (patch)
tree37d2e721383ceb3eed5a0991c3ca19f68e20bb6e
parentea82b23b3260a8ab50145ecff9887461350cceac (diff)
downloadnextcloud-server-926d611bd38c048a7ae649b4cb665550beb7fc13.tar.gz
nextcloud-server-926d611bd38c048a7ae649b4cb665550beb7fc13.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.php7
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());
}
}