Back

About collection permissions

  • 1
  • Users
  • Teams
  • Databases
  • Accounts
nightwielder
18 Apr, 2023, 14:02

Let's say I have 2 kinds of users in my app. One kind can only post texts, and those posts are stored in a collection called posts. And the other kind of users can only comment on those posts. Those comments are stored in a collection called comments. Now, I can't allow write permissions for the type 1 users to the comments collection. And vice versa is true, type 2 users can't write, update or delete documents in the posts collection. How can I achieve this? I thought this would be pretty easy by using the teams feature, but it seems this feature is only for those who'll work on the development of this project; not the actual users.

For example, I would like to ideally be able to set permissions in the posts collection like this: users[role: type_1] -> read, write users[role: type_2] -> read

Where, role is an attribute for the users collection in my database. Thanks in advance.

TL;DR
The user wants to know how to give a certain group of users access to a specific collection based on a role attribute. They are looking for a solution similar to the teams feature, but for the actual app users. They confirm that they have read the documentation on permissions. They want to restrict write permissions for one type of user to the comments collection, and restrict write, update, and delete permissions for another type of user to the posts collection. They are unsure how to achieve this and thought the teams feature would work. They would ideally like to set permissions in the posts collection based on the role attribute in the users collection.
joeyouss
18 Apr, 2023, 14:08

Hi

joeyouss
18 Apr, 2023, 14:08

Just to confirm, you have tried this? https://appwrite.io/docs/permissions

nightwielder
18 Apr, 2023, 14:13

Yes I have! If you won't mind I would like to put my question in a simpler way: How can I give a certain group of users access to a certain collection, when the users are grouped according to, say, a role attribute in the userData collection?

I would like to be able to exactly what the teams feature does, but for the users of my app. My understanding is that the teams feature is only for the maintainers of the project. Please correct me if I'm wrong.

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