Jump to content

Permission Table Normalization


shaggycap

Recommended Posts

I am working on a basic permissions system. I don't see the need the groups for this application, so I'm using something vaguely resembling the 'CRUD' method.

However I'm struggling to arrive at a decent database structure.

I have a table for the details of the user:

--------------------------------------------
| Username(pk) | Password | Email Address|
--------------------------------------------

and a table for the permissions:

---------------------------------
| Username | Task | CRUD |
---------------------------------
| Billybob | Content| 1011 |
| Sammyjoe | Product| 1100 |


I'm simply using a true/false for (c)reate (r)ead (u)pdate & (d) to assign permissions.

However, as you can see I havn't really normalised my table here, and I'm at a loss as to the next step.
At present I will end up with a load of duplicate entries for the tasks, ie both Billybob and Sammyjoe will have content permissions, and both have Product permissions etc.

Would anyone be able to advise me how would I improve this further? Or even scratch it if theres a better way.
Note- I don't want it to be too complex
Link to comment
Share on other sites

Duplicates between rows is different than duplicates within rows -- every lookup table has duplicates for all fields in various records, nothing wrong with that.  As for CRUD, personally, I think it's very convenient to use bit flags for this, since it's very easy to query and update.
Link to comment
Share on other sites

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.