Skip to content

Commit

Permalink
Merge pull request #45363 from nextcloud/backport/45355/stable29
Browse files Browse the repository at this point in the history
[stable29] fix: delete user credentials stored in storages_credentials when user gets deleted
  • Loading branch information
artonge authored May 16, 2024
2 parents cda94f2 + 926d611 commit 29072dd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/private/User/Listeners/BeforeUserDeletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Files\NotFoundException;
use OCP\IAvatarManager;
use OCP\Security\ICredentialsManager;
use OCP\User\Events\BeforeUserDeletedEvent;
use Psr\Log\LoggerInterface;

Expand All @@ -35,10 +36,12 @@
*/
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;
}

Expand All @@ -61,5 +64,7 @@ public function handle(Event $event): void {
'exception' => $e,
]);
}
// Delete storages credentials on user deletion
$this->credentialsManager->erase($user->getUID());
}
}

0 comments on commit 29072dd

Please sign in to comment.