feat: listen to user life cycle events

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-08-09 22:41:17 -04:00
parent e48c6c9bb6
commit d45d54951e
5 changed files with 117 additions and 0 deletions
@@ -335,6 +335,41 @@ class PersonalService implements ServiceBaseInterface, ServiceCollectionMutableI
return true;
}
/**
* Permanently remove all document data owned by the initialized user.
*/
public function destroy(): void {
foreach ($this->entityListBulk(null) as $entity) {
$identifier = $entity->identifier();
if ($identifier === null) {
continue;
}
$this->entityDelete(new EntityIdentifier(
$entity->provider(),
(string) $entity->service(),
(string) $entity->collection(),
(string) $identifier,
));
}
foreach ($this->collectionList(null) as $collection) {
$identifier = $collection->identifier();
if ($identifier === null) {
continue;
}
$this->collectionDelete(new CollectionIdentifier(
$collection->provider(),
(string) $collection->service(),
(string) $identifier,
), true);
}
$this->metaStore->chronicleExpungeByUser($this->serviceTenantId, $this->serviceUserId);
$this->blobStore->rootDestroy();
}
public function collectionCopy(CollectionIdentifierInterface|null $target, CollectionIdentifierInterface $source): CollectionResource {
$identifier = $source->collection();
// Protect root collection