/// <summary> /// 将Task的收件人,转换成AclItemCollection /// </summary> /// <returns></returns> public WfAclItemCollection ToAcl() { WfAclItemCollection result = new WfAclItemCollection(); foreach (UserTask task in this) { WfAclItem item = new WfAclItem(); item.ObjectID = task.SendToUserID; item.ObjectName = task.SendToUserName; item.ObjectType = SchemaType.Users.ToString(); //item.ResourceID = task.ResourceID; item.ResourceID = WfRuntime.GetProcessByProcessID(task.ProcessID).SearchID; item.Source = task.ActivityID; result.Add(item); } return(result); }
public void AclAdapterTest() { WfAclAdapter.Instance.ClearAll(); WfAclItem item = new WfAclItem(); item.ResourceID = "resource1"; item.ObjectID = "object1"; item.ObjectType = "dept"; item.Source = "workfolw"; WfAclAdapter.Instance.Update(item); WfAclItemCollection coll = WfAclAdapter.Instance.Load(builder => builder.AppendItem("RESOURCE_ID", "resource1")); Assert.IsTrue(coll.Count > 0); WfAclItemCollection itemColl = WfAclAdapter.Instance.LoadByResourceID("resource1"); Assert.IsTrue(coll.Count > 0); Assert.AreEqual(coll[0].ResourceID, itemColl[0].ResourceID); Assert.AreEqual(coll[0].ObjectID, itemColl[0].ObjectID); }
private static WfAclItemCollection CreateNewAcl(IWfActivity activity, IEnumerable<IUser> targetUsers) { WfAclItemCollection result = new WfAclItemCollection(); foreach (IUser user in targetUsers) { WfAclItem acl = new WfAclItem(); acl.ObjectID = user.ID; acl.ObjectName = user.DisplayName; acl.ObjectType = "Users"; acl.ResourceID = activity.Process.ResourceID; acl.Source = activity.ID; result.Add(acl); } return result; }