Welcome Guest, Not a member yet? Register   Sign In
User Roles & Database

I'm building an application which will have three different roles and was wondering what would make the most sense in database design and then logic when creating authentication.

If all three groups (admin, editors, users) need the following:
fname, lname, email, password, etc.

but the users group also needs:
field1, field2, field3, field4, etc.

Would it make sense to have a single table containing all three groups and a roles field leaving the user fields empty for admin and editors or three separate tables where I'm repeating the same fields in each table?

Once this is done and I write the authentication part does it make sense to do something like

$role = $this->session->data('role');
   if ($role == 'user') {
   else if ($role == 'admin') {

or to have completely different log in areas.

What are the best practices for handling different user groups?

For my side, what i would do is to hold all user in the same db table and has just 1 log in area, that would be more compact and organized.

Theme © iAndrew 2016 - Forum software by © MyBB