Changeset 97 for trunk/src/grails-app/controllers/PersonController.groovy
- Timestamp:
- Apr 1, 2009, 5:07:23 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/grails-app/controllers/PersonController.groovy
r91 r97 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 @Secured(['ROLE_ AppAdmin', 'ROLE_Manager'])4 class PersonController {3 @Secured(['ROLE_Manager']) 4 class PersonController extends BaseAppAdminController { 5 5 6 6 def authenticateService … … 54 54 Authority.findAll().each { it.removeFromPersons(person) } 55 55 56 //try {57 person.delete( flush:true)56 try { 57 person.delete() 58 58 flash.message = "Person $params.id deleted." 59 // } 60 // catch(Exception e) { 61 // flash.message = "Could not delete '$person.loginName' due to database constraints, but all authorities have been removed." 62 // redirect action: edit, id: person.id 63 // } 64 59 redirect(action:list) 60 } 61 catch(org.springframework.dao.DataIntegrityViolationException e) { 62 flash.message = "Could not delete '$person.loginName' due to database constraints, but all authorities have been removed." 63 redirect(action:show,id:params.id) 64 } 65 65 } 66 66 } … … 68 68 flash.message = "Person not found with id $params.id" 69 69 } 70 71 redirect action: list72 70 } 73 71 … … 100 98 person.errors.rejectValue 'version', "person.optimistic.locking.failure", 101 99 "Another user has updated this Person while you were editing." 102 100 render view: 'edit', model: buildPersonModel(person) 103 101 return 104 102 } … … 106 104 person.properties = params 107 105 108 if (person.pass != "") { 109 if (!person.hasErrors()) { 106 if(params.pass == "") { 107 person.pass = "InsertNothingToClearValidation" 108 } 109 else { 110 if (person.validate()) { 110 111 person.password = authenticateService.encodePassword(params.pass) 111 112 } 112 }113 else {114 person.pass = "NothingToClearValidation"115 113 } 116 114 … … 118 116 Authority.findAll().each { it.removeFromPersons(person) } 119 117 addRoles(person) 118 flash.message = "Person '$params.id - $params.loginName' updated." 120 119 redirect action: show, id: person.id 121 120 }
Note: See TracChangeset
for help on using the changeset viewer.