#[SOLVED] Permissions must be one of: (any, users, user:X)

6 messages · Page 1 of 1 (latest)

steady hawk
#

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.

uneven mountain
#

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
steady hawk
uneven mountain
#

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)
steady hawk
#

Okay thanks a lot.