Last change
on this file since 246 was
216,
checked in by gav, 15 years ago
|
Replace personService.currentUser() with the more groovy personService.getCurrentUser() so that personService.currentUser can be called.
|
File size:
971 bytes
|
Line | |
---|
1 | /** |
---|
2 | * Provides a service class with some methods that integrate the Person domain class and Acegi security. |
---|
3 | * |
---|
4 | */ |
---|
5 | class PersonService { |
---|
6 | |
---|
7 | boolean transactional = false |
---|
8 | |
---|
9 | def authenticateService |
---|
10 | |
---|
11 | /** |
---|
12 | * Get the current user in a safe way to avoid a null userDomain. |
---|
13 | * @returns The current user or the 'system' person (Person #1) if userDomain() is not active. |
---|
14 | */ |
---|
15 | def getCurrentUser() { |
---|
16 | if(authenticateService.userDomain()) { |
---|
17 | return Person.get(authenticateService.userDomain().id) |
---|
18 | } |
---|
19 | else { |
---|
20 | log.warn "userDomain not active, attempting to return Person #1." |
---|
21 | return Person.get(1) |
---|
22 | } |
---|
23 | } |
---|
24 | |
---|
25 | /** |
---|
26 | * Convenience wrapper around authenticateService.encodePassword(). |
---|
27 | * @param passClearText The clear text password to encode. |
---|
28 | * @returns The encoded password. |
---|
29 | */ |
---|
30 | def encodePassword(passClearText) { |
---|
31 | authenticateService.encodePassword(passClearText) |
---|
32 | } |
---|
33 | |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.