Hi there,
Currently i'm working on an application for a company it has to be some sort of a filesharing system. There are at +/- 100 users in the database, including a few admin-users. The admin users are allowed to create groups and to put the rest of the users in one or more groups. One user can occur in more than one group. Here was my solution:
Groupname User_ids
"group_1" 1,4,6,21,31,54
"group_2" 1,4,23,31,64
So... user 1, 4, 31 are in both groups. Users can upload files and say which groups are allowed to read that file. So I build a new table:
Filename Group_id
"test.doc" 1, 2
"test2.doc" 2
Okay... everything clear so far? Here's my problem. When a user logs in he gets a list of files that he can read. So I have to check if the user is in the group that can read the file, but i think that my solution as I described above isn't very efficient.
Because now i first have to "explode" the users in the group and then compare these id's with the id of the logged-in user.
Is this the only way to do this, or does someone have a better idea?
Thanks alot!!
Greetz,
Daniel