Zergman Posted February 23, 2009 Share Posted February 23, 2009 I have an application that is used by different groups from within the company. I have a main menu page that everyone see's after logging in that will show them the links to their group based on their access level. This is working fine. What im running into now is that there are a few people that have access to 2 or more groups. This won't work as they won't see the other groups depending on what I have their access level set to in the DB. I thought about trying to see if I could do comma seperated values so I could add multiple groups to 1 user but can't get that going. Thought about making more access levels for multi group people but that seems like a lot of work. What is the best way to accomplish this easily? Quote Link to comment https://forums.phpfreaks.com/topic/146538-access-levels/ Share on other sites More sharing options...
JonnoTheDev Posted February 23, 2009 Share Posted February 23, 2009 By using a user_to_groups table design users ===== user_id name username password groups ====== group_id title user_to_groups =========== id user_id group_id So if there are 3 groups - id 1,2, and 3 then I can grant access to any user id by adding a record in the user_to_groups table. Lets give user_id 1 access to groups 1 & 3 user_to_groups =========== 1 1 1 2 1 3 Quote Link to comment https://forums.phpfreaks.com/topic/146538-access-levels/#findComment-769311 Share on other sites More sharing options...
Zergman Posted February 23, 2009 Author Share Posted February 23, 2009 Ok, I see how you're doing it. So you're using a separate table (groups) to store access permissions then the pages are pulling access from the (user_to_groups) table. Im just having an issue wrapping my head around exactly how to implement this design. So in group 1's part of the site, I restrict access to only allow group 1 to see the pages? $restrict->addLevel("1"); But since user_id 1 also has access to group 3's part, he should also be able to access group 3's site since those pages have $restrict->addLevel("3"); Am I on the right track here? Quote Link to comment https://forums.phpfreaks.com/topic/146538-access-levels/#findComment-769398 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.