title: Databases: Save users and admins in the same table (pros/cons)?
body: <p>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.</p>
  
  <p>Pro: I don't have to check the "roles"-table for validating the user who tries to log in. </p>
  
  <p>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.</p>
  
  <p>My current solution to check, if a user is a team-mate (pseudo-code):</p>
  
  <pre><code>$needed_role = "admin";
  if ($User-&gt;is_in_team($user_id)) { // SELECT id FROM user WHERE team=1 AND user_id=$user_id
      $roles = $User-&gt;getRoles($user_id);
      if (in_array($needed_role, $roles)) {
          // login...
      }
  }
  </code></pre>
  
  <p>That's an easy example. The Roles are divided in rights like "blog_post_write", "blog_post_delete", ...</p>
  
  <p>The solution I'm currently isn't perfect, so please help me to pimp my database! :)</p>