
I want to create a document that has also the read permission for a other user. When I try to achive this with:
Permission.read(Role.user(entry.userid)),
Permission.read(Role.user(entry.enemyid)),
I get the error "Permission must be one of: (any, users, user:OWN USER ID").
When I add the permission from the web panel everything works fine. Document Security is enabled and the collection permissions are set to users create enabled.

Hey there 👋 This is expected behaviour for security reasons.
Imagine there was notifications
collection. If I could spam anyones notification inbox by giving them read permissions, it would be pretty bad experience for them.
Some possible solutions:
- Use Teams. Put users into same team (other person needs to accept), and you can now give permission to the team
- Use Functions. Write a function that would set the permission to specific user. Functions are allowed to do anything. Then, call this function using
createExecution

Okay thanks. Can I also use the server SDK? Like a REST request with a api key?

Yes, that's exactly what Appwrite Function would do. Tho make sure API key is not visible to the client, otherwise they could hack your whole project.

You can do this by for example:
- Running in Appwrite Function
- Running on your api server (python, nodeJS, Deno, ..)
- Running in SSR (possible in most meta web frameworks)

Okay thanks a lot.

[SOLVED] Permissions must be one of: (any, users, user:X)
Recommended threads
- Flutter OAuth2 Google does not return to...
When the flow starts, the browser opens, I select an account, and it keeps showing: """ Page not found The page you're looking for doesn't exist. `general_rout...
- JSON and Object Support in Collection do...
I am working with Next.Js and Appwrite Cloud, I am relatively New to Appwrite but i have noticed there is no direct support of JSON and Object support in attrib...
- list() is very slow; eventually shows no...
When I use the web browser to view the collections in my database, the documents they contain are normally displayed within a few seconds. For a few days now, h...
