source: trunk/grails-app/services/PersonService.groovy @ 182

Last change on this file since 182 was 182, checked in by gav, 12 years ago

Add support for inventory item Pictures and Images.
Add new PersonService, refactor CreateDataService and TaskService to suite.

File size: 737 bytes
Line 
1/* Provides a service class with some methods that integrate the Person domain class and Acegi security.
2 *
3 */
4class PersonService {
5
6    boolean transactional = false
7
8    def authenticateService
9
10    // Get current user as a Person and in a safe way to avoid a null userDomain during bootstrap.
11    def currentUser() {
12        if(authenticateService.userDomain()) {
13            return Person.get(authenticateService.userDomain().id)
14        }
15        else {
16            //println "Warning: userDomain not active yet, attempting to return Person #1"
17            return Person.get(1)
18        }
19    }
20
21    // Convenience wrapper.
22    def encodePassword(passClearText) {
23        authenticateService.encodePassword(passClearText)
24    }
25
26}
Note: See TracBrowser for help on using the repository browser.