PROBLEM
- User authenticated into the application
- Simple database schema: User ---> Document ---> Item
- API to access to Document Items
If the logged user knows the id of items that belong to some other user, he can access to it. I would like to prevent this behavior.
SOLUTION
The first solution I found is to add a userid field to every records in every table to check at every query if the record belong to the logged user.
This is a good solution? Do you know some better design pattern to prevent the user to access other users' data?
Thanks