public void SetWorkflowState(SetStateApiCommandArgument arg) { if (CheckNotAllowToSetState(arg)) { return; } WorkflowInitService.SetWorkflowState(arg.InstanceId, arg.StateNameToSet, arg.Comment); }
private bool CheckNotAllowToSetState(SetStateApiCommandArgument arg) { AuthenticationService.Authenticate(arg.SecurityToken); if (!AuthenticationService.IsAuthenticated()) { return(true); } if ( !SecurityEntityService.CheckTrusteeWithIdIsInRole(AuthenticationService.GetCurrentIdentity().Id, BudgetRole.FullControl)) { if (SecurityEntityService.GetAlPermissionsForTrusteeAndworkflow(arg.SecurityToken) .Count( p => p.LinkedStateToSet != null && p.LinkedStateToSet.WorkflowStateName == arg.StateNameToSet) < 1) { return(true); } } return(false); }