private bool CanExecuteOperation(Operations.ReportingOperation op, ReportingWorklistItemKey itemKey, bool disableIfSubmitForReview)
        {
            // if there is no proc step ref, operation is not available
            if (itemKey.ProcedureStepRef == null)
            {
                return(false);
            }

            var procedureStep = this.PersistenceContext.Load <ProcedureStep>(itemKey.ProcedureStepRef);

            // for now, all of these operations assume they are operating on a ReportingProcedureStep
            // this may need to change in future
            if (!procedureStep.Is <ReportingProcedureStep>())
            {
                return(false);
            }

            // Special Case:
            // If the user has the SubmitForReview token and the step is unassigned, disable the operation
            if (disableIfSubmitForReview &&
                procedureStep.AssignedStaff == null &&
                Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Workflow.Report.SubmitForReview))
            {
                return(false);
            }

            return(op.CanExecute(procedureStep.As <ReportingProcedureStep>(), this.CurrentUserStaff));
        }
 private bool CanExecuteOperation(Operations.ReportingOperation op, ReportingWorklistItemKey itemKey)
 {
     return(CanExecuteOperation(op, itemKey, false));
 }