Ensure a user's identities are deleted when user is deleted
This commit is contained in:
parent
a235024268
commit
43d5c96f7d
1 changed files with 6 additions and 0 deletions
|
@ -366,6 +366,7 @@ class DeletesV1 extends Worker
|
||||||
protected function deleteUser(Document $document, string $projectId): void
|
protected function deleteUser(Document $document, string $projectId): void
|
||||||
{
|
{
|
||||||
$userId = $document->getId();
|
$userId = $document->getId();
|
||||||
|
$userInternalId = $document->getInternalId();
|
||||||
|
|
||||||
// Delete all sessions of this user from the sessions table and update the sessions field of the user record
|
// Delete all sessions of this user from the sessions table and update the sessions field of the user record
|
||||||
$this->deleteByGroup('sessions', [
|
$this->deleteByGroup('sessions', [
|
||||||
|
@ -399,6 +400,11 @@ class DeletesV1 extends Worker
|
||||||
$this->deleteByGroup('tokens', [
|
$this->deleteByGroup('tokens', [
|
||||||
Query::equal('userId', [$userId])
|
Query::equal('userId', [$userId])
|
||||||
], $this->getProjectDB($projectId));
|
], $this->getProjectDB($projectId));
|
||||||
|
|
||||||
|
// Delete identities
|
||||||
|
$this->deleteByGroup('identities', [
|
||||||
|
Query::equal('userInternalId', [$userInternalId])
|
||||||
|
], $this->getProjectDB($projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue