Skip to content
Back

Allow only verified users access to database collection

  • 0
  • Databases
  • Auth
Pwncake
15 Nov, 2024, 08:22

Hello, I have a database collection which I want to only be accessed by users that verified their email. Is there a way to use custom permissions to achieve this? https://appwrite.io/docs/advanced/platform/permissions describes Role.users([STATUS]) as a possible Role but if i Input something like users:["verified"] I get Invalid permissions param: Role "users" can not have an ID value. Am I just missing the right syntax or is this not supposed to work like this?

TL;DR
Developer wants to restrict database collection access to verified users only. Attempts to use `Role.users(["verified"])` but receives an error. The correct syntax should be `Role.users().setRead(['*'], ['*'], ['verified'])` to achieve the desired permission setup.
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