Last change
on this file since 97 was
91,
checked in by gav, 16 years ago
|
More detailing on Task and Entry. Added another authorisation ROLE_Manager and view to go with it. Work on PersonController? delete action.
|
File size:
1.5 KB
|
Rev | Line | |
---|
[59] | 1 | import org.codehaus.groovy.grails.plugins.springsecurity.Secured |
---|
| 2 | |
---|
| 3 | class AppCoreController extends BaseController { |
---|
| 4 | |
---|
[71] | 5 | def authenticateService |
---|
| 6 | |
---|
[59] | 7 | def index = { redirect(action:home,params:params) } |
---|
| 8 | |
---|
| 9 | // the delete, save and update actions only accept POST requests |
---|
| 10 | //def allowedMethods = [delete:'POST', save:'POST', update:'POST'] |
---|
| 11 | |
---|
| 12 | def home = { |
---|
| 13 | } |
---|
| 14 | |
---|
[71] | 15 | def options = { |
---|
| 16 | } |
---|
| 17 | |
---|
[73] | 18 | def changePassword = { |
---|
| 19 | //def principal = authenticateService.principal() |
---|
| 20 | //println principal.getAuthorities() |
---|
| 21 | |
---|
| 22 | if (request.method == 'GET') { |
---|
| 23 | def personInstance = Person.get(authenticateService.userDomain().id) |
---|
| 24 | return [ personInstance : personInstance ] |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | if (request.method == 'POST') { |
---|
| 28 | def personInstance = Person.get(authenticateService.userDomain().id) |
---|
| 29 | |
---|
| 30 | personInstance.pass = params.pass |
---|
| 31 | personInstance.password = authenticateService.encodePassword(personInstance.pass) |
---|
| 32 | |
---|
| 33 | if (!personInstance.hasErrors() && personInstance.save()) { |
---|
| 34 | //userCache.removeUserFromCache(personInstance.loginName) |
---|
| 35 | flash.message = "Password changed successfully." |
---|
| 36 | redirect(action:options) |
---|
| 37 | } |
---|
| 38 | else { |
---|
| 39 | render(view:'changePassword',model:[personInstance:personInstance]) |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | |
---|
[91] | 44 | @Secured(['ROLE_Manager']) |
---|
| 45 | def manager = { |
---|
| 46 | } |
---|
[73] | 47 | |
---|
[71] | 48 | @Secured(['ROLE_AppAdmin']) |
---|
[59] | 49 | def admin = { |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.