title: Designing an advanced permission system
body: <p>I am currently wanting to implement a permission system, whereby it is convenient to add permissions as life goes on (by using rows instead of fields in MySQL). Each permission will have 5 bits: view, add, delete, modify, value. Ill give examples to explain this structure better. The thing is, with this system, I want to be able to give admins permissions to GIVE permissions as well as grant normal users permissions to do various tasks.</p>
  
  <p><strong>Example 1:</strong></p>
  
  <p>A forum</p>
  
  <p>Approach 1)</p>
  
  <p>There would be a permission called can_create_topic and can_modify_topic_name and can_delete_own_topic ETC ETC</p>
  
  <p>Approach 2)</p>
  
  <p>There would be a permission called topic and it would have subpermissions or bits: add, modify, view, delete. I like this approach better, just dont know how to implement this.</p>
  
  <p><strong>Example 2:</strong></p>
  
  <p>I also want to grant users permissions that are also other than yes or no permissions, for example max_number_of_topics_per_hour, which is an input value.</p>
  
  <p><strong>Example 3:</strong></p>
  
  <p>I want to grant other administrators (say i am super admin) permissions about giving permissions. For example, one administrator would be able to modify can_create_topic for UserA but not for UserB and so on. How do i go about doing all this?</p>