Back

AppwriteException: Permissions must be one of: (any, users)

  • 0
  • Web
rohan
28 Jul, 2023, 17:22

Hi im trying to create a document.. i want to give some users access to read the document... im using

TypeScript
[              Permission.read(Role.user("62f5509c95b3ca818386")),            Permission.read(Role.user("62eda8240ae7ce3ec563")),
]

but im getting this error

TypeScript
[AppwriteException: Permissions must be one of: (any, users, user:62f00557d69fcfbe9c1e, user:62f00557d69fcfbe9c1e/verified, users/verified, team:paidUsers, member:62f5509c95b3ca818386, team:paidUsers/paidUsers)]
TL;DR
The user is trying to give permission to specific users to read a document using the Appwrite SDK. However, they are getting an error saying that the permissions must be one of: (any, users, user:62f00557d69fcfbe9c1e, user:62f00557d69fcfbe9c1e/verified, users/verified, team:paidUsers, member:62f5509c95b3ca818386, team:paidUsers/paidUsers). The reason for this limitation is not explained in the thread. The solution suggested is to use the Server SDK instead of the
Binyamin
28 Jul, 2023, 17:27

When using a Client side SDK the user can give permission only to any, users, or any thing in the list including the user itself.

But, if you want to give permission to other users you'll have to use the Server sdk

P.s. It's actually doesn't mentionedit at the permission documentation in the website But, you can read it here https://github.com/appwrite/appwrite/blob/master/app/controllers/api/databases.php#L2690

Binyamin
28 Jul, 2023, 17:28

And it does sounds right and make sense that the user will have option to let give other user permissions if that user is the owner of the document.

As of now Appwrite doesn't have the document-owner logic so you'll have to go with a function.

rohan
28 Jul, 2023, 17:30

what is the difference bw client sdk and server sdk?

Binyamin
28 Jul, 2023, 17:31

First you can check here https://appwrite.io/docs/sdks

Binyamin
28 Jul, 2023, 17:31

In general

  • Client - User/guest based. limited.
  • Server - With API key can do almost everything.
rohan
28 Jul, 2023, 17:38

does the permission rules applies to storage also?

rohan
28 Jul, 2023, 18:17

but what is reason for not allowing ?

Binyamin
28 Jul, 2023, 18:40

I think it's security wise. But, I see your logic I'll recommend search, or create a feature request for it.

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