Back

Deleting user documents

  • 0
  • Databases
  • Web
  • Cloud
larkx
14 Mar, 2024, 09:48

I'm creating a program that has data in a database connected to a user. In the future, this data will possibly be shared with other users (which will mean that multiple users will be given read and or edit permissions on documents).

How do I go about correctly deleting documents relating to the original creator, should there be an attribute in the documents that correlates to the ID of the original creator, so that when a user deletes their account, I can filter through all documents that specific user can access and delete them?

I essentially want to future proof so that I'm not deleting documents which a user has been added to, not necessarily created.

This is sort of two questions in one:

  1. How do I delete documents relating to a specific user before I delete their account? (Is there a function for it)
  2. How do I do it if multiple people have read / edit document permissions?

Sorry if this is confusing, if you don't understand anything just let me know and I'll try and explain it better.

TL;DR
Developers want to know how to properly delete documents associated with a user before deleting their account. They are considering using a document attribute to track the original creator's ID for this purpose. The developers also seek guidance on handling document deletion if multiple users have access permissions. Solution: 1. Create a filter based on the user's ID to delete documents associated with that user 2. Utilize user permissions to handle document deletion for users with read/edit access
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more