I've used bit masking in the past and it works well in all the cases I've needed it. Not sure if its something you'd like to try or not, but it works kinda like this:
Define your pages and assign each one a unique bit. In decimal, this ends up being a number in base two ( 2x where x = 0 to infinity).
Lets say you have 5 pages. You might start with:
page 1: 1
page 2: 2
page 3: 4
page 4: 8
page 5: 16
I'm going to leave groups out so the explanation is a little clearer, but all a group will be (and I think it fits in your example) is a pre-assigned list of pages - aka: a fixed number.
Lets say you have two users. You want user A to have access to page one. No problem: User A's access number would be 1.
But User B should have access to page 1 and 2. No problem. Just add the value for page 1 and 2 together. 1 + 2 = 3 so User B's value will be 3.
But wait! User A should have access to all the pages but page 3. So it would work like this:
(notice, no page 3 in there here)
page 1: 1
page 2: 2
page 4: 8
page 5: 16
Add these pages up:
1 + 2 + 8 + 16 = 27. 27 = User B's value.
Now the fun part (and I usually botch this up so I'll try to make sure this is all correct).
To test if a user has access to a page, you need to do some bit masking with the bitwise "and" (or in code terms "&"). You might have code that looks like this:
if(([page's value] & [user's value]) == [page's value])
// user has access to this page
else
// user does not have access to this page
$user = 3; // access to page 1 and 2
$page = 2; // this is page 2
// 2 & 3 == 2 equals true - this user has access
if(($page & $user) == $page)
// user has access to this page
else
// user does NOT have access
- Notice the extra set of parens '(' ')' around the & clause. Without it, PHP gets a little create on the order of operations and doesn't return you the results you want.
So that tests a user's value with a page value to see if that user has access to that page. But what if you have the page info in a database and you want to see which pages a user has access to? You could do something like this:
SELECT pagename FROM mypagetable WHERE pagevalue & uservalue = pagevalue
(I done this before, but I'm not at a spot where I can verify or test this - if its incorrect, somebody correct it or contact me with questions)
You can also do some tricks with check boxes and assigning rights to users.
Just setup a list of check boxes for all the pages you have. For the value of the check boxes, put in that page's value. Then when you process the form, add up all the values that were checked and you have the end result value for the user.
For setting this field up in the database, you can start out with an INT field unsigned. But it depends on how many "groups" or "pages" you might have. I might almost recommend just setting the field up as a long or double.
This is just ONE of the many ways of doing it. I kinda like this approach because I can add-on to it at any time (either add more pages or assign multiple pages to users, etc). Its something you could have SQL test for or PHP. It requires a little bit of math, but in return it doesn't require a lot of code. I think this would work for what you described you'd like to do, but only you will know if its a good fit for you.