I'am working on a PHP + MySQL Social Networking application, now i need to setup different access control (read,create,edit,delete) for global (all items) and/or self items (item which created by themselves) for each module to group or specific user.
Does anyone has suggestions in doing this (table structures, etc)?
okay here i provide more detail, currently i have a tbl_module, tbl_user, and tbl_user_role. Each user and role can have different access to specific module.
- read
- update
- create
- delete
and devided by global access or self only (own account or records created by themselves).
and my current approach: i create another table to hold the access detail:
- acl_uid
- mod_id (fk module uid)
- target_id (fk user uid or role uid)
- acl_type (user/role to identify the target id reference)
- acl_read
- acl_update
- acl_create
- acl_delete
acl_read, acl_update, acl_create, acl_delete value ranges:
- 0 deny
- 1 allow
- 2 refer to lower priority check (if user has value 2 then refer to role)
- 3 self only
i believe that theres more efficient way to solve this, or may an improvement to my current approach.
thanks for your responses.