diff options
author | Louis <louis@chmn.me> | 2024-05-17 14:47:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 14:47:37 +0200 |
commit | 9948dcc76709eed401a31e03548bcda27304eed3 (patch) | |
tree | 9c29cfe2087e55487132dea1440f0c1b2773b393 | |
parent | 7e400afcbb03fc3870a4d212bb5c88e21c7cdf7f (diff) | |
parent | f7e7761a434ab7af995251f2694f162ecdec1584 (diff) | |
download | nextcloud-server-27.1.10rc1.tar.gz nextcloud-server-27.1.10rc1.zip |
Merge pull request #45361 from nextcloud/backport/45355/stable27v27.1.10rc1
[stable27] fix: delete user credentials stored in storages_credentials when user gets deleted
-rw-r--r-- | lib/private/User/Listeners/BeforeUserDeletedListener.php | 9 |
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()); } } |