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

[eluser]malzahar[/eluser]
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

Code:
$role = $this->session->data('role');
   if ($role == 'user') {
      $this->load->view("admin_area");
   }
   else if ($role == 'admin') {
      $this->load->view("user_area");
   }
}

or to have completely different log in areas.

What are the best practices for handling different user groups?
#2

[eluser]ojcarga[/eluser]
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