title: Deadbolt 2: Controlling restrictions with DB settings, totally
body: <p>ellou'</p>
  
  <p>I want or rather need to control restrictions for some actions and controllers via database settings, which is best way to do such job?</p>
  
  <p>What is my goal: I need to create solution, where there will be lot of user groups (stored in DB) and they will be fully dynamic (created and removed from the admin panel). Permissions should be inherited to subgroups, so if user has role <code>EditorsChief</code> he can also perform actions allowed to all <code>Editor</code>. I cannot just annotate action/controller with <code>@Restrict({"EditorsChief", "Editor"})</code> because they doesn't exist (are supposed to be created on the fly with admin panel).   </p>
  
  <p>My first thoughts are to use <code>@Dynamic</code> controller and <em>grouping</em> the restrictions with separate handlers which of course requiring to <em>hardcode</em> some of them. It's not quite bad - with some attention it's possible to set quite good schema, (ie. by naming handlers with convention: <code>handlerControllerAction</code>, <code>handlerControllerOtherAction</code>...</p>
  
  <p>What are your thoughts ? Am I going in good direction ?</p>