Ignore:
Timestamp:
Jan 24, 2010, 10:21:39 PM (14 years ago)
Author:
gav
Message:

Add custom checkBoxList for personGroups to Person.
Wrap save and update in transactions, tweak role add/remove logic and use a limited role list for non-admin users.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/Person.groovy

    r166 r294  
    5454    //Overriding the default toString method
    5555    String toString() {"${this.firstName} ${this.lastName}"}
    56 }
     56
     57    //  This additional setter is used to convert the checkBoxList string
     58    //  of ids selected to the corresponding domain objects.
     59    public void setPersonGroupsFromCheckBoxList(ids) {
     60        def idList = []
     61        ids.each() {
     62            if(it.isInteger())
     63                idList << it.toInteger()
     64        }
     65        this.personGroups = idList.collect { PersonGroup.get( it ) }
     66    }
     67
     68} // end class
Note: See TracChangeset for help on using the changeset viewer.