My current custom action is this
class UserRequest[A](val user: Option[models.UserProfile],
request: Request[A]) extends WrappedRequest[A](request)
object UserAction extends ActionBuilder[UserRequest] with ActionTransformer[Request, UserRequest] {
def transform[A](request: Request[A]) = Future.successful {
val user = ... get user from session
new UserRequest(user, request)
}
}
Additionally, I want to pass a parameter to UserAction (e.g. role to validate). So in controller I can use it in this way:
def admin = UserAction("admin") { Ok("granted") }