Jump to content

Recommended Posts

I have database tables for folders and a database with documents in it. 

 

The folders table is setup like this

 

folderid

foldername

folderdescription

 

The document table is setup like this

 

documentid

documentname

documentdescription

folderid

 

I have a user table and want to set it so I can say certain users have permission on certain folder but not others.

 

I was thinking about adding a group table and putting the users in groups, but then certain users may need access to more than one document folder.  I am thinking I will need to add some sort of table that handles just the permissions, but I am not sure.

 

I am just trying to sort out how to make it so I can put groups in and assign access to folders based on the groups. 

 

Any input would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/65468-database-design-question/
Share on other sites

Well something like this may be useful:

 

You have a user table like:

userid, username,...

A group table like:

groupid, groupname,...

and a usergroups table which will hold which user will belong to which group and user may join to more then one groups so my user_groups table is like:

ugid, userid, groupid

Now that I have the groups and users and relation between groups and users I can create my permissions table:

permissionid, userid, groupid, folderid, documentid

 

Here is the thing. You may set the user and folderid or group and folderid or user and documentid or group and documentid in this table. You may seperate them, but you may not too as it wont change a lot. So from this permissions table you can get the permission list which user can reach which document or folder or other things. I hope it was helpful for you.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.