12

私はscalaとplayframeworkが初めてです。誰かが下のスニペットを平易な英語に翻訳してくれませんか? コンテキストについては、ここにあります: http://www.playframework.org/documentation/2.0.4/ScalaSecurity

/**
 * This method shows how you could wrap the withAuth method to also fetch your user
 * You will need to implement UserDAO.findOneByUsername
 */
def withUser(f: User => Request[AnyContent] => Result) = withAuth { username => implicit request =>
  UserDAO.findOneByUsername(username).map { user =>
    f(user)(request)
  }.getOrElse(onUnauthorized(request))
}
4

1 に答える 1