aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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());
}
}