playframework/Play20 — comment on commit f35fd305d98038ab0fe3f8076368ee7f8d90015b
File:  line 0
By recalcitrant:

Very nice, almost there, now I am wondering how to get the User out of the

anorm.ResultSetParser[Seq[models.auth.User]]

so I can get the user as a singleOpt:

val user = User.byId(42).getOrElse(...)

def byId(id: Long): Option[User] = DB.withConnection(implicit connection =>
SQL(sql + "and ua.id = {id}" + order).on("id" -> id).as(User.withPermissions.singleOpt))

val withPermissions = (User.instance ~ Permission.instance *).map(_.groupBy(_._1).toSeq.map {
case (u, ps) => u.copy(permissions = ps.map(_._2).toSet)
})

Thank you again for you time.