Advertisement
Guest User

Untitled

a guest
Sep 7th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
  2.  
  3. class RobotController {
  4.  
  5. def springSecurityService
  6.  
  7. def edit() {
  8.  
  9. if (Robot.get(params.id).usuario.username == springSecurityService.authentication.name
  10. || SpringSecurityUtils.ifAnyGranted("ROL_ADMIN,ROL_SUPERADMIN"))
  11. println "editing allowed"
  12. else
  13. println "editing denied"
  14.  
  15. }
  16. }
  17.  
  18. grails.plugins.springsecurity.interceptUrlMap = [
  19. '/index.gsp': ["isAuthenticated()"],
  20. '/robot/edit/**': ["Robot.get(params.id).usuario.username == springSecurityService.authentication.name
  21. || hasAnyRole('ROL_ADMIN','ROL_SUPERADMIN')"],
  22. '/robot/**': ["isAuthenticated()"]
  23. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement