Changeset 631 for trunk


Ignore:
Timestamp:
Jul 15, 2010, 4:22:04 PM (14 years ago)
Author:
gav
Message:

Check for authorisation on recurring tasks.

Location:
trunk/grails-app
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/i18n/messages.properties

    r622 r631  
    136136task.operationNotPermittedOnCompleteTask=This operation is not permitted on a complete task.
    137137task.operationNotPermittedOnTaskInTrash=This operation is not permitted on a task that is in the trash.
     138task.operationNotPermittedOnRecurringTaskWithoutAuth=This operation is not permitted on a recurring task without authorisation.
    138139task.failedToSave=Could not complete operation, task failed to save.
    139140task.modifications.failedToSave=Could not complete operation, as task modification record failed to save.
  • trunk/grails-app/services/InventoryMovementService.groovy

    r407 r631  
    44
    55    def authService
     6    def authenticateService
    67
    78    def reverseMove(params) {
     
    3435                if(result.inventoryMovementInstance.task?.taskStatus?.id == 3)
    3536                    return fail(field:"task", code:"task.operationNotPermittedOnCompleteTask")
     37
     38                // Check for authorisation on recurring tasks.
     39                if(result.inventoryMovementInstance.task?.taskRecurringSchedule) {
     40                    if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager,ROLE_InventoryManager'))
     41                        return fail(field:"task", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     42                }
     43
    3644            }
    3745
     
    95103                if(result.inventoryMovementInstance.task.taskStatus.id == 3)
    96104                    return fail(field:"task", code:"task.operationNotPermittedOnCompleteTask")
     105
     106                // Check for authorisation on recurring tasks.
     107                if(result.inventoryMovementInstance.task.taskRecurringSchedule) {
     108                    if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager,ROLE_InventoryManager'))
     109                        return fail(field:"task", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     110                }
    97111            }
    98112
  • trunk/grails-app/services/TaskService.groovy

    r601 r631  
    1111    def authService
    1212    def dateUtilService
     13    def authenticateService
    1314    def assignedGroupService
    1415    def assignedPersonService
     
    325326                return fail(field:"task", code:"task.operationNotPermittedOnCompleteTask")
    326327
     328            // Check for authorisation on recurring tasks.
     329            if(taskInstance.taskRecurringSchedule) {
     330                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     331                    return fail(field:"task", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     332            }
     333
    327334            // If task status is "Not Started" and entry type is "Work Done" and time has been booked.
    328335            // Then we create the started modification and set task status.
     
    379386            }
    380387
     388            // Check for authorisation on recurring tasks.
     389            if(result.taskInstance.taskRecurringSchedule) {
     390                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     391                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     392            }
     393
    381394            result.taskInstance.properties = params
    382395
     
    425438            }
    426439
     440            // Check for authorisation on recurring tasks.
     441            if(result.taskInstance.taskRecurringSchedule) {
     442                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     443                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     444            }
     445
    427446            result.taskInstance.taskStatus = TaskStatus.get(3)
    428447            result.taskInstance.attentionFlag = false
     
    474493            }
    475494
     495            // Check for authorisation on recurring tasks.
     496            if(result.taskInstance.taskRecurringSchedule) {
     497                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     498                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     499            }
     500
    476501            result.taskInstance.attentionFlag = true
    477502
     
    520545            }
    521546
     547            // Check for authorisation on recurring tasks.
     548            if(result.taskInstance.taskRecurringSchedule) {
     549                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     550                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     551            }
     552
    522553            result.taskInstance.attentionFlag = false
    523554
     
    566597            }
    567598
     599            // Check for authorisation on recurring tasks.
     600            if(result.taskInstance.taskRecurringSchedule) {
     601                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     602                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     603            }
     604
    568605            def isInProgress = false
    569606            result.taskInstance.entries.each() {
     
    621658            }
    622659
     660            // Check for authorisation on recurring tasks.
     661            if(result.taskInstance.taskRecurringSchedule) {
     662                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     663                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     664            }
     665
    623666            result.taskInstance.trash = true
    624667            result.taskInstance.attentionFlag = false
     
    669712            }
    670713
     714            // Check for authorisation on recurring tasks.
     715            if(result.taskInstance.taskRecurringSchedule) {
     716                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     717                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     718            }
     719
    671720            result.taskInstance.trash = false
    672721
     
    715764            }
    716765
     766            // Check for authorisation on recurring tasks.
     767            if(result.taskInstance.taskRecurringSchedule) {
     768                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     769                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
     770            }
     771
    717772            result.taskInstance.approved = true
    718773
     
    759814                if(result.taskInstance.version > params.version.toLong())
    760815                    return fail(field:"version", code:"default.optimistic.locking.failure")
     816            }
     817
     818            // Check for authorisation on recurring tasks.
     819            if(result.taskInstance.taskRecurringSchedule) {
     820                if(!authenticateService.ifAnyGranted('ROLE_AppAdmin,ROLE_Manager,ROLE_TaskManager'))
     821                    return fail(field:"taskRecurringSchedule", code:"task.operationNotPermittedOnRecurringTaskWithoutAuth")
    761822            }
    762823
Note: See TracChangeset for help on using the changeset viewer.