We are using AppwriteCloud and we have a very simple use case.
Users save data in a collection and later on they query this data. Let's say they are creating projects and then I want to show the user his projects.
How would you structure the permissions and the database?
One project collection that stores all the documents of all users and then query only the projects of that user? If yes how are you structuring the permissions because I only want users to to query the own created projects.
Summary
To only allow users to view their own created projects in a collection, you can structure the permissions as follows:
1. Ensure that the List Documents endpoint (databasesListDocuments) is used by the logged-in user.
2. When creating a document, set the permissions for the current user only. This can be done using the Create Document endpoint (databasesCreateDocument).
3. To allow a team to access the document, use the TeamsAPI.
To structure permissions with teams, group the permissions for a set of users by using teams. However, in this simple use case, where there are only single users creating projects, you may
D5
Moderator
Jul 13, 2023, 15:30
Permissions are not being structured in the database
D5
Moderator
Jul 13, 2023, 15:30
You use teams to group permissions
JulianLenz
Flutter Developer
Jul 13, 2023, 15:57
How would you structure those things with teams? In my case I only have single users that create projects
D5
Moderator
Jul 13, 2023, 16:17
To allow only people seeing their own things, just set when creating the document permissions for the current user
D5
Moderator
Jul 13, 2023, 16:17
To allow for example a team accessing it, you can use TeamsAPI
JulianLenz
Flutter Developer
Jul 14, 2023, 05:09
Thanks for helping me out!
Can you point me to the correct documentation for document permission? I am not familiar with the permissions since and I am not sure how to do this
By default the current user is granted with all permissions.
So, if the user is logged in they have all permissions by default. However, if you need other users to have access you need more complex permissions structure. And if you need to group permissions for a set of users you would use teams.