Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. transient springSecurityService
  2. static belongsTo = [rol: Role]
  3.  
  4.  
  5. String username
  6. String password
  7. boolean enabled = true
  8. boolean accountExpired
  9. boolean accountLocked
  10. boolean passwordExpired
  11.  
  12.  
  13. static transients = ['springSecurityService']
  14.  
  15. static constraints = {
  16. username blank: false, unique: true
  17. password blank: false
  18. }
  19.  
  20. static mapping = {
  21. password column: '`password`'
  22. }
  23.  
  24. Set<Role> getAuthorities() {
  25. UserRole.findAllByUser(this).collect { it.role } as Set
  26. }
  27.  
  28. def beforeInsert() {
  29. encodePassword()
  30. }
  31. protected void encodePassword() {
  32. password = springSecurityService.encodePassword(password)
  33. }
  34.  
  35. def beforeUpdate() {
  36. if (isDirty('password')) {
  37. encodePassword()
  38. }
  39. }
  40.  
  41. static belongsTo = [taches: Tache,projet:Project,modules: Moduleee]
  42.  
  43.  
  44. static constraints = {
  45.  
  46.  
  47.  
  48. }
  49. String toString() {
  50. "$username"
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement