source: trunk/grails-app/domain/dbnp/authentication/SecUser.groovy @ 1584

Last change on this file since 1584 was 1584, checked in by work@…, 9 years ago
  • did some more restyling of the home page (ticket #339)
    • statistics
    • introductionary texts
    • quick search
  • Property svn:keywords set to Rev Author Date
File size: 1.0 KB
RevLine 
[976]1package dbnp.authentication
2
3class SecUser implements Serializable {
4
5        String username
6        String password
[1426]7        String email
[1144]8        Date dateCreated
[976]9        boolean enabled
10        boolean accountExpired
11        boolean accountLocked
12        boolean passwordExpired
[1426]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
[976]15
16        static constraints = {
17                username blank: false, unique: true
18                password blank: false
[1426]19                email blank: false
[976]20        }
21
22        static mapping = {
23                password column: '`password`'
[1426]24                enabled formula: 'USER_CONFIRMED AND ADMIN_CONFIRMED'
[976]25        }
26
27        Set<SecRole> getAuthorities() {
28                SecUserSecRole.findAllBySecUser(this).collect { it.secRole } as Set
29        }
30
[1426]31        public boolean equals(Object y) {
32                if (!(y instanceof SecUser)) {
[1213]33                        return false;
34                }
[976]35
[1213]36                if (y == null) return false;
[976]37
[1213]38                return this.id == y.id
39        }
40
41        public boolean hasAdminRights() {
[1426]42                return getAuthorities().contains(SecRole.findByAuthority('ROLE_ADMIN'));
[1213]43        }
[976]44}
Note: See TracBrowser for help on using the repository browser.