Query for different user groups login

Hi,
so i’ve been struggling with how to allow different user groups to login where some users may be a member of different groups. I can’t find an example of how others would do it.

So i first thought i’d use a number system so if a user is >= to the required level they can log in. That way admins will have full control as they will be higher than all the other levels. The next level down will have access to everything below that etc.

The trouble i have is that i have various groups at the same level that i don’t want to be able to see what is in the other sections e.g

Admin

Group1 Group2 Group3

General users

It gets more complicated as some people may be in more than one group.

So i need to know how to store the page security in the database. Eg in the security field for the page do i have (Group 1, Group 2)
and if i do that and i have (admin) in my user field how would that supersede the security or if i am in Group1 but the page is just general user, how would i make it to allow me to see the page as i can’t match anything.

hopefully this makes some kind of sense.

can anyone point me to any examples?

thanks

Sounds like you’re looking for an access control list (ACL). I haven’t used it, but I know ZendFramework as one.

This will involve permissions set for separate sections instead of just a single level as you’re thinking. With that, group1 can have permissions to view sections A, B, and C while group2 might have permissions for sections B and E. Admin would probably have permissions on all sections A, B, C, D, and E.

In essence, it’s your level idea but each role will have a level for each section/page.