source: trunk/grails-app/controllers/AppCoreController.groovy @ 115

Last change on this file since 115 was 106, checked in by gav, 16 years ago

Some CSS adjustments to text color, img border, remove body height:100%, add buttons input.add to CSS.
Move admin stuff to AppAdmin? to make it very clear that it is not for daily use.
TaskDetailed? list and delete now use the IsActive? attribute.
Remove Task.comment size constraint.
Add more help-ballons to TaskDetailed? create.
Clean loose comments from main.gsp and auth.gsp
Use pretty pictures in TaskDetailed? views instead of Edit and Show words.

File size: 2.1 KB
Line 
1import org.codehaus.groovy.grails.plugins.springsecurity.Secured
2
3class AppCoreController extends BaseController {
4
5    def authenticateService
6
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
15    def options = {
16    }
17
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            if(params.confirmPass == params.pass) {
31                personInstance.pass = params.pass
32                personInstance.password = authenticateService.encodePassword(personInstance.pass)
33
34                if (!personInstance.hasErrors() && personInstance.save()) {
35                    //userCache.removeUserFromCache(personInstance.loginName)
36                    flash.message = "Password changed successfully."
37                    redirect(action:options)
38                }
39                else {
40                    render(view:'changePassword',model:[personInstance:personInstance])
41                }
42            }
43            else {
44                personInstance.errors.reject('person.pass.doesNotMatch',            // Error code, see grails-app/i18n/message.properties
45                                                                ['pass', 'class Person'].toArray(),      // Groovy ListArray cast to Object[]
46                                                                 '[NothingUseMessageProperites]')  // Default mapping string.
47                render(view:'changePassword',model:[personInstance:personInstance])
48            }
49               
50        } 
51    }
52
53    @Secured(['ROLE_Manager'])   
54    def manager = {
55    }
56
57    @Secured(['ROLE_AppAdmin'])   
58    def appAdmin = {
59    }
60
61}
Note: See TracBrowser for help on using the repository browser.