title: Play framework, Scala: authenticate User by Role
body: <p>I've user roles: <code>user</code>, <code>manager</code>, <code>admin</code>. I need to authenticate them in controllers (methods). For example only <code>admin</code> can delete (now it looks like this, need to change that only admin should have permission):</p>
  
  <pre><code>def deleteBook(id: Int) = DBAction {
      findById(id) match {
          case Some(entity) =&gt; {
              books.filter(_.id === id).delete
              Ok("")
          }
          case None =&gt; Ok("")
      }
  }
  </code></pre>
  
  <p>I've many controllers and methods. I need to authenticate before process request (for example deleting book). My <code>routes</code> file contains:</p>
  
  <pre><code>...
  DELETE        /books/:id                  @controllers.Book.deleteBook(id: Int)
  ...
  </code></pre>
  
  <p>Some routes are only accessible to admin and manager. Some are for all types of users. </p>
  
  <p>I'm currently seeing <a href="http://deadbolt.ws/" rel="noreferrer">deadbolt2scala</a> authorization module for play. </p>
  
  <p>Can you recommend best way to authenticate multirole users in playframework scala?</p>