I'm interested in your opinion: at the moment I've only one user-table in my database but I think about adding a new one to separate public accounts from the admin accounts.
Pro: I don't have to check the "roles"-table for validating the user who tries to log in.
Con: Admin accounts cannot be part of the community and are just for the backend. Thats too much redundance if you promote somebody to an moderator: he cannot write posts with his public account.
My current solution to check, if a user is a team-mate (pseudo-code):
$needed_role = "admin";
if ($User->is_in_team($user_id)) { // SELECT id FROM user WHERE team=1 AND user_id=$user_id
$roles = $User->getRoles($user_id);
if (in_array($needed_role, $roles)) {
// login...
}
}
That's an easy example. The Roles are divided in rights like "blog_post_write", "blog_post_delete", ...
The solution I'm currently isn't perfect, so please help me to pimp my database! :)