/// <summary> /// 初始化祖先的OUs /// </summary> /// <param name="currentObj">当前对象</param> public void InitAncestorOUs(IOguObject currentObj) { IOguPropertyAccessible wrapper = (IOguPropertyAccessible)currentObj; string parentID = (string)currentObj.Properties["ParentID"]; Debug.Assert(string.IsNullOrEmpty(parentID) == false); Dictionary <string, SCSimpleObjectCollection> parentMap = PC.Adapters.SCSnapshotAdapter.Instance.LoadAllParentsInfo(true, parentID); SCSimpleObjectCollection parents = parentMap[parentID]; List <string> idList = new List <string>(parents.ToIDArray()); //idList.Add(parentID); OguObjectCollection <IOrganization> orgs = this.GetObjects <IOrganization>(SearchOUIDType.Guid, idList.ToArray()); ((IOguPropertyAccessible)currentObj).Parent = orgs.Find(obj => obj.ID == parentID); wrapper = (IOguPropertyAccessible)wrapper.Parent; for (int i = parents.Count - 1; i >= 0; i--) { var org = orgs.Find(obj => obj.ID == parents[i].ID); if (org != null && org.DepartmentType != DepartmentTypeDefine.XuNiJiGou) { wrapper.Parent = orgs.Find(obj => obj.ID == parents[i].ID); wrapper = (IOguPropertyAccessible)wrapper.Parent; } } }
/// <summary> /// 从Ticket token构造Identity /// </summary> /// <param name="tokenContainer"></param> /// <param name="ticket"></param> public DeluxeIdentity(GenericTicketTokenContainer tokenContainer, ITicket ticket) { tokenContainer.NullCheck("tokenContainer"); tokenContainer.User.NullCheck("tokenContainer.User"); tokenContainer.RealUser.NullCheck("tokenContainer.RealUser"); OguObjectCollection <IUser> users = GetUsersInfoFromIDs(tokenContainer.User.ID, tokenContainer.RealUser.ID); this.user = users.Find(u => string.Compare(u.ID, tokenContainer.User.ID, true) == 0); this.realUser = users.Find(u => string.Compare(u.ID, tokenContainer.RealUser.ID, true) == 0); this.user.NullCheck("user"); this.realUser.NullCheck("realUser"); this.ticket = ticket; }