Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] fix: delete user credentials stored in storages_credentials when user gets deleted #45362

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}
Loading