Back

[SOLVED] Document Security, multiple User permissions

  • 0
  • Teams
  • Web
  • Databases
  • Accounts
  • Users
Chola
13 Jun, 2023, 12:16

I have a document with file level security that was created with Permissions for only that 1 user to create, update and delete, (Permission.read(user...) e.tc...) Now within my app i want to be able to update the permissions to allow for a second user to have read access. Is there a specific method for this or must i fetch the current permissions then append the new Permission to it?

TL;DR
Solution: To have different permissions for each document within a collection, remove the `read` permission in the collection level and apply it only to the individual document. To allow a second user to have read access to a document, fetch the current permissions and append the new Permission to it.
Guille
13 Jun, 2023, 14:30

The user editing the document must have write permissions. The best way is to fetch the current permissions and append the new one(s)

Chola
13 Jun, 2023, 16:46

Great, next question, in the settings tab of the database collections, if I scroll down to permissions and enable Users: Read✅ Does this mean ANY Authenticated User can read any file in that collection?

Chola
13 Jun, 2023, 16:48

Because when I add a file to the collection I'm setting Permission.read, update and delete on that one User alone. And I'd like for them to be the only one to have those permissions. Would I have to disable Users: Read❎?

Guille
13 Jun, 2023, 17:54

Yes, you're right, the collection permissions apply to all documents, you should remove the read permission in the collection level and only apply it in the document itself

Chola
15 Jun, 2023, 19:32

[SOLVED] Document Security, multiple User permissions

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