Or you could just run it all off groups lol… and get rid of a table… because you could run it like this
user
{
user_id
username
}
user_to_group
{
user_id
group_id
expires
}
group
{
group_id
group_name
group_desc
}
then the groups are assigned the permissions
With the roles and groups you would have the above but with below and two tables for the permissions 1 for roles 1 for groups…
user
{
role_id
}
roles
{
role_id
role_name
}
SO if you think about it just running groups would be easier…
And when you want to check for permission you just limit to 1 and search for the access where group_id in groups or something like that
If I can find my working example ill show you what I mean.