Last change
on this file since 1213 was
1213,
checked in by robert@…, 12 years ago
|
Improved the study overview page such that the different tabs are loaded when needed. Also rewritten parts of the code. See ticket #155
|
File size:
1.1 KB
|
Rev | Line | |
---|
[976] | 1 | package dbnp.authentication |
---|
| 2 | |
---|
| 3 | class SecUser implements Serializable { |
---|
| 4 | |
---|
| 5 | String username |
---|
| 6 | String password |
---|
| 7 | String email |
---|
[1144] | 8 | Date dateCreated |
---|
[976] | 9 | boolean enabled |
---|
| 10 | boolean accountExpired |
---|
| 11 | boolean accountLocked |
---|
| 12 | boolean passwordExpired |
---|
| 13 | boolean userConfirmed // True if the user has confirmed his subscription using the link in the email |
---|
| 14 | boolean adminConfirmed // True if the administrator has confirmed this subscription using the link in the email |
---|
| 15 | |
---|
| 16 | static constraints = { |
---|
| 17 | username blank: false, unique: true |
---|
| 18 | password blank: false |
---|
| 19 | email blank: false |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | static mapping = { |
---|
| 23 | password column: '`password`' |
---|
| 24 | enabled formula: 'USER_CONFIRMED AND ADMIN_CONFIRMED' |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | Set<SecRole> getAuthorities() { |
---|
| 28 | SecUserSecRole.findAllBySecUser(this).collect { it.secRole } as Set |
---|
| 29 | } |
---|
| 30 | |
---|
[1213] | 31 | public boolean equals(Object y) |
---|
| 32 | { |
---|
| 33 | if( !( y instanceof SecUser ) ) { |
---|
| 34 | return false; |
---|
| 35 | } |
---|
[976] | 36 | |
---|
[1213] | 37 | if (y == null) return false; |
---|
[976] | 38 | |
---|
[1213] | 39 | return this.id == y.id |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | public boolean hasAdminRights() { |
---|
| 43 | return getAuthorities().contains( SecRole.findByAuthority( 'ROLE_ADMIN' ) ); |
---|
| 44 | } |
---|
| 45 | |
---|
[976] | 46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.