source: trunk/grails-app/domain/Person.groovy @ 235

Last change on this file since 235 was 166, checked in by gav, 15 years ago

Add test and message for no granted authority to LoginController.
Correct belongsTo in Person-PersonGroup? relationship.
Re-generate PersonGroup? controller and views.
Add more help balloon messages for Person and Task.
Default ROLE_AppUser to ON when creating a person.

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