Changeset 97 for trunk/src/grails-app
- Timestamp:
- Apr 1, 2009, 5:07:23 AM (16 years ago)
- Location:
- trunk/src/grails-app
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/grails-app/controllers/AssignedPersonDetailedController.groovy
r96 r97 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 class AssignedPerson Controller extends BaseController {3 class AssignedPersonDetailedController extends BaseController { 4 4 5 5 def index = { redirect(action:list,params:params) } -
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 } -
trunk/src/grails-app/views/person/create.gsp
r73 r97 91 91 92 92 <tr class="prop"> 93 <td valign="top" class="name" align="left">A ssign Roles:</td>93 <td valign="top" class="name" align="left">Authorities:</td> 94 94 </tr> 95 95 -
trunk/src/grails-app/views/person/edit.gsp
r79 r97 59 59 <td valign="top" class="name"><label for="pass">Password:</label></td> 60 60 <td valign="top" class="value ${hasErrors(bean:person,field:'pass','errors')}"> 61 <input type="password" id="pass" name="pass" />61 <input type="password" id="pass" name="pass" value="${person.pass?.encodeAsHTML()}"/> 62 62 </td> 63 63 </tr> … … 98 98 </tr> 99 99 100 <tr class="prop"> 101 <td valign="top" class="name"><label for="authorities">Authorities:</label></td> 102 <td valign="top" class="value ${hasErrors(bean:person,field:'authorities','errors')}"> 103 <ul> 104 <g:each var="entry" in="${roleMap}"> 105 <li>${entry.key.authority.encodeAsHTML()} 106 <g:checkBox name="${entry.key.authority}" value="${entry.value}"/> 107 </li> 108 </g:each> 109 </ul> 110 </td> 111 </tr> 100 <tr class="prop"> 101 <td valign="top" class="name" align="left">Authorities:</td> 102 </tr> 103 104 <g:each var="entry" in="${roleMap}"> 105 <tr> 106 <td valign="top" class="name" align="left">${entry.key.authority.encodeAsHTML()}</td> 107 <td align="left"><g:checkBox name="${entry.key.authority}" value="${entry.value}"/></td> 108 </tr> 109 </g:each> 112 110 113 111 </tbody>
Note: See TracChangeset
for help on using the changeset viewer.