Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/146538-access-levels/
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/146538-access-levels/#findComment-769311
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/146538-access-levels/#findComment-769398
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.