Ignore:
Timestamp:
Oct 8, 2009, 7:58:38 PM (15 years ago)
Author:
gav
Message:

Re-install class-diagram from local svn build with patch to allow war deployment.
Class-diagram overrides removed from Config.groovy since these have all been included upstream.
Tidy comments in SecurityConfig?.groovy
Some work on adding assignedPerson work flow and PersonController?.
Add navAlt and filterPane search to Person and TaskProcedure?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/PersonController.groovy

    r136 r147  
    44class PersonController extends BaseAppAdminController {
    55
    6         def authenticateService
     6    def authenticateService
     7    def filterService
    78
    89        // the delete, save and update actions only accept POST requests
     
    1314        }
    1415
    15         def list = {
    16                 if (!params.max) {
    17                         params.max = 10
    18                 }
    19                 [personList: Person.list(params)]
    20         }
     16    def list = {
     17        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100 )
     18
     19        if(!params.filter)
     20        { return [personList: Person.list(params), personTotal: Person.count()] }
     21
     22        // filterPane:
     23        return[ personList: filterService.filter( params, Person ),
     24            personTotal: filterService.count( params, Person ),
     25            filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
     26            params:params ]
     27    }
    2128
    2229        def show = {
     30
     31        // In the case of an actionSubmit button, rewrite action name from 'index'.
     32        if(params._action_Show)
     33        { params.action='show' }
     34
    2335                def person = Person.get(params.id)
    2436                if (!person) {
     
    4658                if (person) {
    4759                        def authPrincipal = authenticateService.principal()
    48                         //avoid self-delete if the logged-in user is an admin
     60                        // Avoid self-delete.
    4961                        if (!(authPrincipal instanceof String) && authPrincipal.username == person.loginName) {
    50                                 flash.message = "You can not delete yourself, please login as another admin and try again"
     62                                flash.message = "You cannot delete yourself, please login as another manager and try again."
     63                redirect(action:show,id:params.id)
    5164                        }
    5265                        else {
    5366                                //first, delete this person from Persons_Authorities table.
    5467                                Authority.findAll().each { it.removeFromPersons(person) }
    55                
     68                person.isActive = false
     69                person.save(flush: true)
     70
    5671                try {
    57                     person.delete()
     72                    person.delete(flush: true)
    5873                    flash.message = "Person $params.id deleted."
    5974                    redirect(action:list)
     
    7287        def edit = {
    7388
     89        // In the case of an actionSubmit button, rewrite action name from 'index'.
     90        if(params._action_Edit)
     91        { params.action='edit' }
     92
    7493                def person = Person.get(params.id)
    7594                if (!person) {
     
    7897                        return
    7998                }
    80 
     99        flash.message = "To allow login at least the 'ROLE_AppUser' authority must be given."
    81100                return buildPersonModel(person)
    82101        }
     
    126145
    127146        def create = {
     147        flash.message = "To allow login at least the 'ROLE_AppUser' authority must be given."
    128148                [person: new Person(params), authorityList: Authority.list()]
    129149        }
Note: See TracChangeset for help on using the changeset viewer.