Changeset 166 for trunk


Ignore:
Timestamp:
Oct 26, 2009, 3:11:18 PM (15 years ago)
Author:
gav
Message:

Add test and message for no granted authority to LoginController.
Correct belongsTo in Person-PersonGroup? relationship.
Re-generate PersonGroup? controller and views.
Add more help balloon messages for Person and Task.
Default ROLE_AppUser to ON when creating a person.

Location:
trunk/grails-app
Files:
10 edited

Legend:

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

    r73 r166  
    144144                def username = session[AuthenticationProcessingFilter.SPRING_SECURITY_LAST_USERNAME_KEY]
    145145                def msg = ''
     146        def person = Person.findByLoginName(username)
    146147                def exception = session[AbstractProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY]
    147148                if (exception) {
     
    149150                                msg = "[$username] is disabled."
    150151                        }
     152            else if (person.authorities.isEmpty()) {
     153                msg = "[$username] has no GrantedAuthority."
     154            }
    151155                        else {
    152156                                msg = "[$username] wrong username/password."
  • trunk/grails-app/controllers/PersonGroupController.groovy

    r122 r166  
    2727        if(personGroupInstance) {
    2828            try {
    29                 personGroupInstance.delete()
     29                personGroupInstance.delete(flush:true)
    3030                flash.message = "PersonGroup ${params.id} deleted"
    3131                redirect(action:list)
     
    7777        else {
    7878            flash.message = "PersonGroup not found with id ${params.id}"
    79             redirect(action:edit,id:params.id)
     79            redirect(action:list)
    8080        }
    8181    }
  • trunk/grails-app/domain/Person.groovy

    r164 r166  
    77                        tasks: Task]
    88
    9     static belongsTo = [Authority, PersonGroup]
     9    static belongsTo = [Authority]
    1010
    1111    Department department
  • trunk/grails-app/domain/PersonGroup.groovy

    r59 r166  
    66
    77    static hasMany = [persons : Person]
     8
     9    static belongsTo = [Person]
    810
    911    static constraints = {
  • trunk/grails-app/i18n/messages.properties

    r155 r166  
    22person.pass.blank=Password cannot be blank
    33person.pass.doesNotMatch=Passwords must match
     4
     5person.personGroups=Person Groups
     6person.personGroups.help=Groups provide no application authorisations and are merely for grouping people for information purposes. Use Ctrl or Shift to select multiple groups.
     7person.loginName=Login Name
     8person.loginName.help=This is the id or name that the person will use to login to the application.
     9person.firstName=First Name
     10person.firstName.help=The person's real first name.
     11person.lastName=Last Name
     12person.lastName.help=The person's real last name.
     13person.password=Password
     14person.password.help=The password that the person will use to login to the appllication (should be changed by them later).
     15person.isActive=Active
     16person.isActive.help=Disable this to prevent a person logging in to the application.
     17
     18person.authorities=Authorities
     19person.authorities.help=To allow login at least the 'ROLE_AppUser' authority must be given. The 'ROLE_AppAdmin' authority is NOT required for daily use and provides full (read as DANGEROUS) access.
    420
    521entry.duration=Duration
     
    2137task.leadPerson=Lead Person
    2238task.leadPerson.help=The primay contact person.
    23    
     39
    2440taskRecurring.startDate.NotInTheFuture=Please select a start date that is not in the past, or use original date.
    2541taskRecurring.startDate=Start Date
    2642taskRecurring.startDate.help=The tartget start date for the first auto generated subTask.
     43
     44task.primaryAsset=Primary Asset
     45task.primaryAsset.help=This is the asset that costs will be assigned to.
     46task.associatedAssets=Associated Assets
     47task.associatedAssets.help=These assets are to be associated with this task, but costs will not be assigned.
    2748
    2849default.doesnt.match.message=Property [{0}] of class [{1}] with value [{2}] does not match the required pattern [{3}]
  • trunk/grails-app/views/person/create.gsp

    r164 r166  
    3232                        <td valign="top" class="value ${hasErrors(bean:person,field:'loginName','errors')}">
    3333                            <input type="text" id="loginName" name="loginName" value="${person.loginName?.encodeAsHTML()}"/>
     34                            <g:helpBalloon class="helpballoon" code="person.loginName" />
    3435                        </td>
    3536                    </tr>
     
    3940                        <td valign="top" class="value ${hasErrors(bean:person,field:'firstName','errors')}">
    4041                            <input type="text" id="firstName" name="firstName" value="${person.firstName?.encodeAsHTML()}"/>
     42                            <g:helpBalloon class="helpballoon" code="person.firstName" />
    4143                        </td>
    4244                    </tr>
     
    4648                        <td valign="top" class="value ${hasErrors(bean:person,field:'lastName','errors')}">
    4749                            <input type="text" id="lastName" name="lastName" value="${person.lastName?.encodeAsHTML()}"/>
     50                            <g:helpBalloon class="helpballoon" code="person.lastName" />
    4851                        </td>
    4952                    </tr>
     
    5457                        <td valign="top" class="value ${hasErrors(bean:person,field:'pass','errors')}">
    5558                            <input type="password" id="pass" name="pass"/>
     59                            <g:helpBalloon class="helpballoon" code="person.password" />
    5660                        </td>
    5761                    </tr>
    5862
    5963                    <tr class="prop">
    60                         <td valign="top" class="name"><label for="isActive">isActive:</label></td>
     64                        <td valign="top" class="name"><label for="isActive">Active:</label></td>
    6165                        <td valign="top" class="value ${hasErrors(bean:person,field:'isActive','errors')}">
    6266                            <g:checkBox name="isActive" value="${person.isActive}" ></g:checkBox>
     67                            <g:helpBalloon class="helpballoon" code="person.isActive" />
    6368                        </td>
    6469                    </tr>
     
    106111                        </td>
    107112                        <td valign="top" class="value ${hasErrors(bean:person,field:'personGroups','errors')}">
    108                             <g:select name="personGroups"
     113                            <g:select id="personGroups" name="personGroups"
    109114                                            from="${PersonGroup.list()}"
    110                                             size="5" multiple="yes" optionKey="id"
    111                                             value="${person?.personGroups}" />
    112 
     115                                            optionKey="id" size="5" multiple="yes"
     116                                            value="${person?.personGroups?.id}" noSelection="['':'--None--']"/>
     117                            <g:helpBalloon class="helpballoon" code="person.personGroups" />
    113118                        </td>
    114119                    </tr>
    115120
    116121                    <tr class="prop">
    117                         <td valign="top" class="name" align="left">Authorities:</td>
     122                        <td valign="top" class="name" align="left">
     123                            Authorities:
     124                        </td>
     125                        <td valign="top" class="name" align="left">
     126                            <g:helpBalloon class="helpballoon" code="person.authorities" />
     127                        </td>
    118128                    </tr>
    119129
     
    121131                    <tr>
    122132                        <td valign="top" class="name" align="left">${it.authority.encodeAsHTML()}</td>
    123                         <td align="left"><g:checkBox name="${it.authority}"/></td>
     133                        <td align="left">
     134                            <g:checkBox name="${it.authority}" value="${it.authority == 'ROLE_AppUser'}"/>
     135                        </td>
    124136                    </tr>
    125137                    </g:each>
  • trunk/grails-app/views/person/edit.gsp

    r164 r166  
    4040                        <td valign="top" class="value ${hasErrors(bean:person,field:'loginName','errors')}">
    4141                            <input type="text" id="loginName" name="loginName" value="${person.loginName?.encodeAsHTML()}"/>
     42                            <g:helpBalloon class="helpballoon" code="person.loginName" />
    4243                        </td>
    4344                    </tr>
     
    4748                        <td valign="top" class="value ${hasErrors(bean:person,field:'firstName','errors')}">
    4849                            <input type="text" id="firstName" name="firstName" value="${person.firstName?.encodeAsHTML()}"/>
     50                            <g:helpBalloon class="helpballoon" code="person.firstName" />
    4951                        </td>
    5052                    </tr>
     
    5456                        <td valign="top" class="value ${hasErrors(bean:person,field:'lastName','errors')}">
    5557                            <input type="text" id="lastName" name="lastName" value="${person.lastName?.encodeAsHTML()}"/>
     58                            <g:helpBalloon class="helpballoon" code="person.lastName" />
    5659                        </td>
    5760                    </tr>
     
    6164                        <td valign="top" class="value ${hasErrors(bean:person,field:'pass','errors')}">
    6265                            <input type="password" id="pass" name="pass"  value="${person.pass?.encodeAsHTML()}"/>
     66                            <g:helpBalloon class="helpballoon" code="person.password" />
    6367                        </td>
    6468                    </tr>
    6569
    6670                    <tr class="prop">
    67                         <td valign="top" class="name"><label for="isActive">isActive:</label></td>
     71                        <td valign="top" class="name"><label for="isActive">Active:</label></td>
    6872                        <td valign="top" class="value ${hasErrors(bean:person,field:'isActive','errors')}">
    6973                            <g:checkBox name="isActive" value="${person.isActive}"/>
     74                            <g:helpBalloon class="helpballoon" code="person.isActive" />
    7075                        </td>
    7176                    </tr>
     
    113118                        </td>
    114119                        <td valign="top" class="value ${hasErrors(bean:person,field:'personGroups','errors')}">
    115                             <g:select name="personGroups"
     120                            <g:select id="personGroups" name="personGroups"
    116121                                            from="${PersonGroup.list()}"
    117                                             size="5" multiple="yes" optionKey="id"
    118                                             value="${person?.personGroups}" />
    119 
     122                                            optionKey="id" size="5" multiple="yes"
     123                                            value="${person?.personGroups.id}" noSelection="['':'--None--']"/>
     124                            <g:helpBalloon class="helpballoon" code="person.personGroups" />
    120125                        </td>
    121126                    </tr>
    122127
    123128                    <tr class="prop">
    124                         <td valign="top" class="name" align="left">Authorities:</td>
     129                        <td valign="top" class="name" align="left">
     130                            Authorities:
     131                        </td>
     132                        <td valign="top" class="name" align="left">
     133                            <g:helpBalloon class="helpballoon" code="person.authorities" />
     134                        </td>
    125135                    </tr>
    126136
  • trunk/grails-app/views/person/list.gsp

    r156 r166  
    3636                    <g:sortableColumn property="firstName" title="First Name" params="${filterParams}" />
    3737                    <g:sortableColumn property="lastName" title="Last Name" params="${filterParams}" />
    38                     <g:sortableColumn property="isActive " title="isActive" params="${filterParams}" />
     38                    <g:sortableColumn property="isActive " title="Active" params="${filterParams}" />
    3939                    <th></th>
    4040                </tr>
  • trunk/grails-app/views/person/show.gsp

    r164 r166  
    4040
    4141                <tr class="prop">
    42                     <td valign="top" class="name">isActive:</td>
     42                    <td valign="top" class="name">Active:</td>
    4343                    <td valign="top" class="value">${person.isActive}</td>
    4444                </tr>
  • trunk/grails-app/views/personGroup/edit.gsp

    r151 r166  
    7171                                </td>
    7272                                <td valign="top" class="value ${hasErrors(bean:personGroupInstance,field:'persons','errors')}">
    73                                     <g:select name="persons"
    74 from="${Person.list()}"
    75 size="5" multiple="yes" optionKey="id"
    76 value="${personGroupInstance?.persons}" />
    77 
     73                                   
    7874                                </td>
    7975                            </tr>
Note: See TracChangeset for help on using the changeset viewer.