Skip to content

Instantly share code, notes, and snippets.

@mariogarcia
Created March 3, 2015 11:16
Show Gist options
  • Save mariogarcia/320c64eef9f59250f5e9 to your computer and use it in GitHub Desktop.
Save mariogarcia/320c64eef9f59250f5e9 to your computer and use it in GitHub Desktop.
withnewsession
UserDetails getUserDetails(String username) {
return UserDetails.findByUsername(username)
}
UserRole getUserRole(String username) {
return UserRole.findByUserName(username)
}
UserDetails getUserDetailsNoMatterWhat(String username) {
WholeUserInfo info = new WholeUserInfo()
UserDetails.withNewSession {
info.userDetails = getUserDetails(username)
info.role = getUserRole(username)
}
return info
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment