private static WfProcessStartupParams PrepareStartWorkflowParams(IWfProcessDescriptor processDesp, WfSimulationContext simulationContext) { WfProcessStartupParams startupParams = new WfProcessStartupParams(); startupParams.ProcessDescriptor = processDesp; startupParams.DefaultTaskTitle = startupParams.ProcessDescriptor.DefaultTaskTitle; if (OguUser.IsNotNullOrEmpty(simulationContext.SimulationParameters.Creator)) { startupParams.Creator = simulationContext.SimulationParameters.Creator; } else { if (DeluxePrincipal.IsAuthenticated) { startupParams.Creator = DeluxeIdentity.CurrentUser; } } startupParams.Assignees.Add(startupParams.Creator); startupParams.ResourceID = UuidHelper.NewUuidString(); MergeVariablesToApplicationRuntimeParameters(startupParams.ApplicationRuntimeParameters, simulationContext.SimulationParameters.Variables); return(startupParams); }
private static IEnumerable <IUser> AllElapsedOperators(object callerContext) { List <IUser> result = new List <IUser>(); if (callerContext is WfConditionDescriptor) { WfConditionDescriptor condition = (WfConditionDescriptor)callerContext; if (condition.Owner != null) { foreach (IWfActivity activity in condition.Owner.ProcessInstance.Activities) { if (activity.Status == WfActivityStatus.Completed) { if (OguUser.IsNotNullOrEmpty(activity.Operator)) { if (result.NotExists(u => string.Compare(u.ID, activity.Operator.ID, true) == 0)) { result.Add(activity.Operator); } } } } } } return(result); }
protected internal override void FillUsers(OguDataCollection <IUser> users) { IWfActivity target = TargetActivity; if (target != null) { //如果该环节存在操作人,则使用操作人。否则使用候选人 if (OguUser.IsNotNullOrEmpty(target.Operator)) { users.Add(target.Operator); } else { target.Candidates.ForEach(a => users.Add(a.User)); } } }
/// <summary> /// 用户是否在Acl中 /// </summary> /// <param name="process"></param> /// <param name="user"></param> /// <returns></returns> public static bool IsUserInAcl(this IWfProcess process, IUser user) { bool result = false; if (OguUser.IsNotNullOrEmpty(user)) { InSqlClauseBuilder inBuilder = new InSqlClauseBuilder("RESOURCE_ID"); inBuilder.AppendItem(process.ResourceID, process.ID); WhereSqlClauseBuilder whereBuilder = new WhereSqlClauseBuilder(); whereBuilder.AppendItem("OBJECT_TYPE", "Users"); whereBuilder.AppendItem("OBJECT_ID", user.ID); ConnectiveSqlClauseCollection connective = new ConnectiveSqlClauseCollection(inBuilder, whereBuilder); WfAclItemCollection aclItems = WfAclAdapter.Instance.LoadByBuilder(connective); result = aclItems.Count > 0; } return(result); }