Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Supply functionality to controllers
- def controllers = grailsApplication.controllerClasses
- for(controller in controllers){
- controller.metaClass.authenticatedUser = {
- def authUser = User.get(SecurityUtils.getSubject()?.getPrincipal())
- if (!authUser) {
- log.error("Authenticated user was not able to be obtained when performing profile action")
- response.sendError(403)
- return null
- }
- return authUser
- }
- }
Add Comment
Please, Sign In to add comment