source: branches/TaskRewrite/src/grails-app/domain/Person.groovy @ 73

Last change on this file since 73 was 73, checked in by gav, 11 years ago

Add changePassword under options view so that users can change their own password.
Adjust for password validation, userCache etc. Only a small bug during "edit" is left on second "update" command.

File size: 1.2 KB
Line 
1class Person {
2        static transients = ['pass']
3    static hasMany = [authorities: Authority,
4                        personGroups: PersonGroup,
5                        modifications: Modification,
6                        entries: Entry,
7                        tasks: Task]
8
9    static belongsTo = [Authority, PersonGroup]
10
11        String loginName
12        String firstName
13    String lastName
14    String employeeID
15
16        /** MD5 Password */
17        String password
18
19        /** enabled */
20        boolean isActive = true
21
22        String email
23        boolean emailShow = true
24
25        /** description */
26        String description = ''
27
28        /** plain password to create a MD5 password */
29        String pass
30
31        static constraints = {
32                loginName(blank: false, unique: true, minSize:4)//minSize:7
33                firstName(blank: false)
34        lastName(blank: false)
35        employeeID(blank: true, nullable:true)
36        description()
37        email()
38        emailShow()
39        isActive()
40        //Enforcing minSize on password does not work since "" gets encoded to a string.
41                password(blank: false)
42        //So we need to use pass for validation then encode it for above.
43        pass(blank: false, minSize:4)
44
45        }
46
47    //Overriding the default toString method
48    String toString() {"${this.firstName} ${this.lastName}"}
49}
Note: See TracBrowser for help on using the repository browser.