Back

Permission for the Author of the Document

  • 0
  • Databases
SenZi
30 Apr, 2023, 13:22

Hi, Is it possible to set permissions for read, update and delete for only the author of the document? Without having to set it during document creation? for example in firebase we can do something like this if request.auth != null && request.auth.uid == resource.data.author_uid;

TL;DR
User A is seeking clarification on how to set permissions for user A and user B to delete a document. User A suggests using a permission system like Firebase for better control. A user suggests updating the permissions to specify that only user A and user B have read, update, and delete access. User B finds the permissions confusing and mentions the possibility of creating a generic function. However, it would require multiple functions to update data. They suggest not exposing update access and using an appwrite function instead. User C asks if a user can update their own permission and if there's a way to prevent that. User A asks how to make a document
Drake
30 Apr, 2023, 15:16

By default, it gets automatically populated with the current user.

SenZi
30 Apr, 2023, 15:46

so if a user creates the document, they by default has permission to read update and delete?

Drake
30 Apr, 2023, 15:52

Yes we automatically populate permissions with the current user. Try it out and see

SenZi
30 Apr, 2023, 16:00

Does it include delete too? if so is there any way to remove delete permission from the current user?

Drake
30 Apr, 2023, 16:03

No, in that case, you have to manually pass in what permissions you want to set

Drake
30 Apr, 2023, 16:04

That said, if they have update permissions, they can update it to add delete πŸ˜…

SenZi
1 May, 2023, 18:37

Oh, So How would i go about making a document only editable?

SenZi
1 May, 2023, 18:44

A user can update their own permission? is there any way to prevent that

Drake
1 May, 2023, 18:52

you would have to not expose update access and use an appwrite function instead

SenZi
1 May, 2023, 18:54

then id' have to write a lot of functions to just update data...

Drake
1 May, 2023, 18:55

you could try making a generic function

SenZi
1 May, 2023, 19:05
SenZi
1 May, 2023, 19:06

The permissions got kinda confusing

Drake
1 May, 2023, 19:08

@VincentGe maybe we should update this to:

Using permissions, you can decide that only user A and user B will have read, update, and delete access to a specific document...

VincentGe
1 May, 2023, 19:14

Hmmmm, is that really different?

SenZi
1 May, 2023, 19:14

As a Suggestion it would be better having a permission system like firebase or finer permission control like preventing users from updating set permissions, etc

Drake
1 May, 2023, 19:18

only to clarify that user A and user B will be able to delete

VincentGe
1 May, 2023, 19:21

πŸ€”

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