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

Last change on this file since 1426 was 1426, checked in by work@…, 10 years ago
  • Resolved part of improvement #225
  • refactored the template model out of GSCF into the GDT (Grails Domain Templates) plugin version 0.0.1
  • still work needs to be done (move template editor into gdt, etcetera)
  • fix template owner
  • some methods are missing from Template, but most of it works
File size: 1.0 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                if (!(y instanceof SecUser)) {
33                        return false;
34                }
35
36                if (y == null) return false;
37
38                return this.id == y.id
39        }
40
41        public boolean hasAdminRights() {
42                return getAuthorities().contains(SecRole.findByAuthority('ROLE_ADMIN'));
43        }
44
45}
Note: See TracBrowser for help on using the repository browser.