public List <WorkflowStateInfo> GetAvailiableWorkflowStateToSet(ApiCommandArgument arg) { var infos = new List <WorkflowStateInfo>(); AuthenticationService.Authenticate(arg.SecurityToken); if (!AuthenticationService.IsAuthenticated()) { return(infos); } if (!SecurityEntityService.CheckTrusteeWithIdIsInRole(AuthenticationService.GetCurrentIdentity().Id, BudgetRole.FullControl)) { var permissions = SecurityEntityService.GetAlPermissionsForTrusteeAndworkflow(arg.SecurityToken) .Where(p => p.LinkedStateToSet != null) .Select(p => p.LinkedStateToSet); if (permissions.Count() < 1) { return(infos); } infos = WorkflowStateService.GetAllAvailiableStates(arg.InstanceId) .Where(i => permissions.Count(p => p.WorkflowStateName == i.StateSystemName && p.Type.Id == i.WorkflowTypeId) > 0) .ToList(); } else { infos = WorkflowStateService.GetAllAvailiableStates(arg.InstanceId); } return(infos); }