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

Last change on this file since 1213 was 1213, checked in by robert@…, 10 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
Line 
1package dbnp.authentication
2
3class SecUser implements Serializable {
4
5        String username
6        String password
7        String email
8        Date dateCreated
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
31        public boolean equals(Object y)
32        {
33                if( !( y instanceof SecUser ) ) {
34                        return false;
35                }
36
37                if (y == null) return false;
38
39                return this.id == y.id
40        }
41
42        public boolean hasAdminRights() {
43                return getAuthorities().contains( SecRole.findByAuthority( 'ROLE_ADMIN' ) );
44        }
45
46}
Note: See TracBrowser for help on using the repository browser.