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

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

Add Department-Person relationship, update demo data and views to suite.
Add department and personGroups to Person views.

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