2
votes

I have my custom authenticated action that is like

def Authenticated(rights: String*) = new ActionBuilder[MyAuthenticatedRequest] {
  ***
}

In my controller I use this action to check the user has the right to view the page

def password = Authenticated(UserRights.USER) { implicit request: MyAuthenticatedRequest[_] =>
  Users.findById(request.account.id) match {
    case Some(user) => Ok(views.html.settings.password(frontUser, user))
    case _ => NotFound
  }
}

My oject Users uses slick to retrieve the user in the database

def findById(id: Long)(implicit s: Session): Option[User] = users.where(_.id === id).firstOption

In my controller I have an error

could not find implicit value for parameter s: play.api.db.slick.Config.driver.simple.Session

This is due to the fact that I have to open a session in my controller before querying the database.

I would like to use DBAction that is provided by play-slick and compose it with my authenticated action but I have some problems understanding how action composition works

any news on this - did you resolve the issue? I'd want to achieve the exact same thing and need to use DBAction because that resolves my other issue stackoverflow.com/questions/22622892/…mattanja
FYI - I gave up on this side-project and didn't further follow the issue. If you have the same problem you may check out the tweets linked by @cvogt or report to the play-slick project I guess.mattanja
This PR seems to request and suggest a solution to this github.com/playframework/play-slick/issues/84cvogt