summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/User/Listeners/BeforeUserDeletedListener.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/User/Listeners/BeforeUserDeletedListener.php b/lib/private/User/Listeners/BeforeUserDeletedListener.php
index ec1f80c5413..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;
/**
@@ -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());
}
}