I have a 'documents' table containing a whole list of documents and a 'users' table containing registered users. Now I want to map this onto a 'permissions' model that will give me the permissions a user has for a particular document (eg. can_edit,can_delete,etc).
My first attempt at an implementation was something like this:
Code: Select all
TABLE: permissions
id | document_id | user_id | can_edit | can_deleteCode: Select all
SELECT `can_edit` FROM `permissions` WHERE `document_id` = 10 AND `user_id` = 2Even I use 'user groups' instead of individual users to match permissions, the same issue occurs when I add a new user group.
So I need some kind of 3D model for permissions. Documents on the X axis, Users on the Y axis, and Permissions on the Z axis. So each time I create a new user, it just fills up all of it's releated X and Z co-ordinates with default values specified in the model.
Any suggestions?