title: Best Practices: Creating a simple CRUD web application with users/roles
body: <p>After searching online a good amount, I couldn't find anything that was exactly what I was looking for or that outlined how to create a web application with users. The closest thing I could find was <a href="https://stackoverflow.com/questions/1395278/best-practice-on-users-roles-on-sql-server-for-a-web-application">this stackoverflow post</a>, which outlined how to create a web application with users/roles on a SQL server. </p>
  
  <p>I also found a couple alternatives from <a href="https://stackoverflow.com/questions/6240059/create-user-roles-and-profiles-in-codeigniter-using-ion-auth">this post</a>.</p>
  
  <ul>
  <li>Create a simple relational database</li>
  <li>make a 'meta-table'</li>
  </ul>
  
  <p>I'm creating a web application on CodeIgniter that is a wine management tool, similar to <a href="http://www.cellartracker.com/" rel="nofollow noreferrer">CellarTracker</a>. Each user has their own 'cellar', or collection of wines that they can perform the CRUD operations on. What would be a conventional way to make this. How should I structure the database? Are there any CI Libraries that would make User-management, roles, permissions, etc. easier? 
  (I have already found that TankAuth seems like its the best authentication library).</p>
  
  <p>Here's how I would structure (part of) the database:</p>
  
  <pre><code>**users_table**
  id
  email
  password
  
  **wines_table**
  id
  user_id
  </code></pre>
  
  <p>My plan is to have each bottle of wine have a user's id associated with it. I doubt that this is the most secure or efficient way to handle a CRUD web application with many users though. </p>
  
  <p>I have experience with the CRUD operations, but am not sure how I can connect them with a user-management system.</p>