public bool CanDiscardProtocol(ProtocolOperationEnablementContext enablementContext) { // if there is no proc step ref, operation is not available if (enablementContext.ProcedureStepRef == null) { return(false); } var step = this.PersistenceContext.Load <ProcedureStep>(enablementContext.ProcedureStepRef); var isAssignedToMe = (step.State == ActivityStatus.SC && Equals(step.AssignedStaff, this.CurrentUserStaff)) || (step.State == ActivityStatus.IP && Equals(step.PerformingStaff, this.CurrentUserStaff)); if (isAssignedToMe) { // Protocol is assigned to current user, allow cancel only if user has Create or Cancel token if (!Thread.CurrentPrincipal.IsInRole(Extended.Common.AuthorityTokens.Workflow.Protocol.Create) && !Thread.CurrentPrincipal.IsInRole(Extended.Common.AuthorityTokens.Workflow.Protocol.Cancel)) { return(false); } } else { // Protocol not assigned to current user, allow cancel only if user has Cancel token if (!Thread.CurrentPrincipal.IsInRole(Extended.Common.AuthorityTokens.Workflow.Protocol.Cancel)) { return(false); } } return(CanExecuteOperation <ProtocolAssignmentStep>(new ProtocollingOperations.DiscardProtocolOperation(), enablementContext.ProcedureStepRef)); }
public bool CanResubmitProtocol(ProtocolOperationEnablementContext enablementContext) { if (!Thread.CurrentPrincipal.IsInRole(Extended.Common.AuthorityTokens.Workflow.Protocol.Resubmit)) { return(false); } return(CanExecuteOperation(new ProtocollingOperations.ResubmitProtocolOperation(), enablementContext.OrderRef)); }
public bool CanRejectProtocol(ProtocolOperationEnablementContext enablementContext) { if (!Thread.CurrentPrincipal.IsInRole(Extended.Common.AuthorityTokens.Workflow.Protocol.Create)) { return(false); } return(CanExecuteOperation <ProtocolAssignmentStep>(new ProtocollingOperations.RejectProtocolOperation(), enablementContext.ProcedureStepRef)); }
public bool CanSaveProtocol(ProtocolOperationEnablementContext enablementContext) { if (!Thread.CurrentPrincipal.IsInRole(Extended.Common.AuthorityTokens.Workflow.Protocol.Create)) { return(false); } if (enablementContext.ProcedureStepRef == null) { return(false); } var step = this.PersistenceContext.Load <ProcedureStep>(enablementContext.ProcedureStepRef); if (!step.Is <ProtocolAssignmentStep>()) { return(false); } if (step.AssignedStaff != null && !Equals(step.AssignedStaff, this.CurrentUserStaff)) { return(false); } if (step.PerformingStaff != null && !Equals(step.PerformingStaff, CurrentUserStaff)) { return(false); } // items submitted for review should not be editable. var assignmentStep = step.As <ProtocolAssignmentStep>(); if (assignmentStep.Protocol.Status == ProtocolStatus.AA) { if (Equals(assignmentStep.Protocol.Author, this.CurrentUserStaff)) { return(false); } } if (step.IsTerminated) { return(false); } return(true); }