My application is basically a way for groups to manage content.
There will be 3 different levels of users:
- Website Administrators: a few people who can do everything.
- Group administrators: privilege to upload files, edit calendars, and manage members, but only for their group.
- Members: can see content for the groups that they are members of.
Group admins should be able to remove members from the group. Anyone can be a member of a group, regardless of user level and can be members of multiple groups at one time.
The part that is confusing me is how to keep track of the multiple groups that a member can be a part of.
How should I structure my database so I can achieve this?
This is my idea so far:
//pseudo code:
users
( id , username , password , role ) //role within website
groups
( id , name )
group_members
( group_id , user_id , role ) //role within group
group_members VALUES
( 1 , 1 , 'group admin' )
( 1 , 2 , 'group member' )
( 2 , 2 , 'group member' )
Is this how I should track membership of groups?