Skip to content

Commit

Permalink
Reset layer ownerships when deleting user
Browse files Browse the repository at this point in the history
  • Loading branch information
bkis committed Nov 7, 2023
1 parent 7c3063c commit af1703f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Tekst-API/tekst/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from tekst.config import TekstConfig, get_config
from tekst.email import TemplateIdentifier, send_email
from tekst.logging import log
from tekst.models.layer import LayerBaseDocument
from tekst.models.user import UserCreate, UserDocument, UserRead, UserUpdate


Expand Down Expand Up @@ -231,6 +232,10 @@ async def on_after_delete(self, user: UserDocument, request: Request | None = No
user,
TemplateIdentifier.DELETED,
)
# reset data layer ownerships
await LayerBaseDocument.find(
LayerBaseDocument.owner_id == user.id, with_children=True
).set({LayerBaseDocument.owner_id: None})

async def validate_password(
self,
Expand Down

0 comments on commit af1703f

Please sign in to comment.