Guest User

Untitled

a guest
Jun 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. // Supply functionality to controllers
  2. def controllers = grailsApplication.controllerClasses
  3. for(controller in controllers){
  4. controller.metaClass.authenticatedUser = {
  5. def authUser = User.get(SecurityUtils.getSubject()?.getPrincipal())
  6. if (!authUser) {
  7. log.error("Authenticated user was not able to be obtained when performing profile action")
  8. response.sendError(403)
  9. return null
  10. }
  11.  
  12. return authUser
  13. }
  14. }
Add Comment
Please, Sign In to add comment