Changeset 127


Ignore:
Timestamp:
May 6, 2009, 3:40:07 AM (16 years ago)
Author:
gav
Message:

Logins now route through a welcome action to allow flash message and user environment setup. Session timeout now user configurable and defaults to 12 hours. Work on Planned Maintenance.

Location:
trunk
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/Definitions/TaskTerms.txt

    r116 r127  
     1Intro
     2
     3 * Tasks may have one parent task and many sub tasks.
     4 * Tasks may have a recurring schedule.
     5 * Tasks with an enabled recurring schedule automatically generate subTasks.
     6 * Tasks may have many "work done" or "fault" entries.
     7
    18Task terms and definitions.
    29
     
    5461                - Default = Normal.
    5562                - Of Class TaskPriority.
    56                 - One of Low, Normal, High, Immediate.
     63                - One of Normal, Low, High, Immediate.
    5764                - Automagically set to High if Unscheduled Breakin?
    5865                - Automagically set to ?
  • trunk/grails-app/conf/BootStrap.groovy

    r125 r127  
    242242        def taskPriorityInstance
    243243
     244        taskPriorityInstance = new TaskPriority(name:"Normal")
     245        BootStrapSaveAndTest(taskPriorityInstance)
     246
    244247        taskPriorityInstance = new TaskPriority(name:"Low")
    245         BootStrapSaveAndTest(taskPriorityInstance)
    246 
    247         taskPriorityInstance = new TaskPriority(name:"Normal")
    248248        BootStrapSaveAndTest(taskPriorityInstance)
    249249
  • trunk/grails-app/conf/SecurityConfig.groovy

    r126 r127  
    11security {
     2
     3    def authenticateService
    24
    35        // see DefaultSecurityConfig.groovy for all settable/overridable properties
     
    4648
    4749    //We always want to go to the home page so that bookmarks are not used.
    48     defaultTargetUrl = '/appCore/home'
     50    defaultTargetUrl = '/appCore/welcome'
    4951    alwaysUseDefaultTargetUrl = true
    5052
     
    6163    cacheUsers = false
    6264
     65//    //List for and events and run the closure(s) that follow.
     66//    //Unfortunately the session is not available yet so many things can't be done here, us an defaultTargetUrl and controller.
     67//    useSecurityEventListener = true
     68//
     69//    onAuthenticationSuccessEvent = { e, appCtx ->
     70//        def p = e.source.principal
     71//        def personInstance = Person.findByLoginName(p.username)
     72//        println p.username
     73//        println personInstance.loginName
     74//        println personInstance.firstName
     75//    }
     76
    6377}
  • trunk/grails-app/controllers/AppCoreController.groovy

    r106 r127  
    1010    //def allowedMethods = [delete:'POST', save:'POST', update:'POST']
    1111
     12    def welcome = {
     13        def personInstance = Person.get(authenticateService.userDomain().id)
     14        flash.message = "Welcome, ${personInstance.firstName} ${personInstance.lastName}."
     15
     16        def sess = getSession()
     17        sess.setMaxInactiveInterval(personInstance.sessionTimeout)
     18        redirect(action:home)
     19    }
     20
    1221    def home = {
    1322    }
     
    1524    def options = {
    1625    }
     26
     27    def changeSessionTimeout = {
     28        if (request.method == 'GET') {
     29            def personInstance = Person.get(authenticateService.userDomain().id)
     30            return [ personInstance : personInstance ]       
     31        }
     32        if (request.method == 'POST') {
     33            def personInstance = Person.get(authenticateService.userDomain().id)
     34//             personInstance.sessionTimeout = params.sessionTimeout.toInteger()
     35                personInstance.properties = params
     36                if (!personInstance.hasErrors() && personInstance.save()) {
     37                    def sess = getSession()
     38                    sess.setMaxInactiveInterval(personInstance.sessionTimeout)
     39                    flash.message = "Session timeout changed."
     40                    redirect(action:options)
     41                }
     42                else {
     43                    render(view:'changeSessionTimeout',model:[personInstance:personInstance])
     44                }
     45        }
     46    }         
    1747
    1848    def changePassword = {
  • trunk/grails-app/domain/MaintenanceAction.groovy

    r124 r127  
    1 class MaintenanceAction {
     1class TaskAction {
     2    Task task
    23    MaintenancePolicy maintenancePolicy
    3     PlannedMaintenance plannedMaintenance
    44    SystemSection systemSection
    55    Asset asset
     
    88    SubAssembly subAssembly
    99    ComponentItem componentItem
    10     String maintenanceAction
     10    String action
    1111    String reasoning = ""
    12     Integer pmStepNumber
     12    Integer stepNumber
    1313    boolean isActive = true
    1414
    1515//     static hasMany = []
    1616
    17     static belongsTo = [PlannedMaintenance]
     17//     static belongsTo = []
    1818
    1919    static constraints = {
     
    2424        subAssembly(blank:true, nullable:true)
    2525        componentItem(blank:true, nullable:true)
    26         pmStepNumber(blank:true, nullable:true)
     26        stepNumber(blank:true, nullable:true)
    2727    }
    2828
  • trunk/grails-app/domain/Person.groovy

    r93 r127  
    1313    String lastName
    1414    String employeeID
     15
     16    /* Set after login by 'welcome' action, default to 12 hours, aka "sess.setMaxInactiveInterval(seconds) */
     17    Integer sessionTimeout = 720
    1518
    1619        /** MD5 Password */
     
    4245        //So we need to use pass for validation then encode it for above.
    4346        pass(blank: false, minSize:4)
     47        sessionTimeout(min:60, max:720)
    4448
    4549        }
  • trunk/grails-app/domain/RecurringSchedule.groovy

    r125 r127  
    1 class RecurringSchedule {
     1class TaskRecurringSchedule {
    22
    33    Task task
     4//     Task lastGeneratedSubTask
    45    Period period
    5     PlannedMaintenance plannedMaintenance
    66
    77    Integer recurEvery
    88    Date startDate = new Date()
    9     Date lastExecutedDate
     9    Date lastGeneratedDate
    1010    Date nextDueDate
    1111    boolean isActive = true
     
    1616
    1717    static constraints = {
    18         plannedMaintenance(blank:true, nullable:true)
    19         lastExecutedDate(blank:true, nullable:true)
     18//         lastGeneratedDate(blank:true, nullable:true)
    2019    }
    2120
  • trunk/grails-app/views/appCore/options.gsp

    r73 r127  
    1717            <div class="dialog">
    1818            <a href="${createLink(action:'changePassword')}">Change Password</a>
    19 
     19            <br />
     20            <br />
     21            <a href="${createLink(action:'changeSessionTimeout')}">Change Session Timeout</a>
    2022            </div>
    2123        </div>
Note: See TracChangeset for help on using the changeset viewer.