title: How to use session id in model using Anorm query with Scala Play Framework 2?
body: <p>I need a query which checks if two users ( current user and some other user) have common authors in their libraries, but I don't know how to write the id of the current user inside a model. 
  Is it allowed to use the id of the user in the current session inside of a model?</p>
  
  <pre><code>def getAuthors(friend_id: Long): Int   = {
      DB.withConnection{ implicit connection =&gt;
          val nrAuthors = SQL("select count(*) from book where author in (select author from book where user_id = userIdFromCurrentSession) and user_id = " + friend_id).as(scalar[Int].single) 
          nrAuthors
       }
  }  
  </code></pre>