public virtual IdentityStoreObject CloneObjectForUpdate(List <string> attributeNamesToClone, IdentityStoreObject objectToClone, IdentityStoreObject objectOrignal) { IdentityStoreObject identityStoreObject = new IdentityStoreObject(); identityStoreObject.set_ObjectIdFromIdentityStore(objectToClone.get_ObjectIdFromIdentityStore()); identityStoreObject.set_ObjectName(objectToClone.get_ObjectName()); identityStoreObject.set_ObjectDisplayName(objectToClone.get_ObjectDisplayName()); identityStoreObject.set_ObjectType(objectToClone.get_ObjectType()); identityStoreObject.set_AttributesBusinessObject(new AttributeCollection()); IdentityStoreObject newObject = identityStoreObject; foreach (string attributeName in attributeNamesToClone) { List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> values = this.GetAttributeValues(attributeName, objectToClone.get_AttributesBusinessObject()); if ((values == null ? false : values.Any <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute>())) { if (objectOrignal != null) { List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> origValues = this.GetAttributeValues(attributeName, objectOrignal.get_AttributesBusinessObject()); if ((origValues == null || origValues.Count != 1 ? false : StringUtility.EqualsIgnoreCase(origValues[0].get_Value(), values[0].get_Value()))) { continue; } } newObject.get_AttributesBusinessObject().Add(attributeName, values); } } return(newObject); }
private Dictionary <string, Dictionary <string, IdentityStoreObject> > EnsureChildGroups(int identityStoreId, ServicesGroupServiceClient groupClient, Dictionary <string, Dictionary <string, IdentityStoreObject> > managedGroups) { foreach (KeyValuePair <string, Dictionary <string, IdentityStoreObject> > pair in managedGroups) { try { List <IdentityStoreObject> childGroups = groupClient.GetAllLevelCurrentChildGroups(identityStoreId, pair.Key, null, new List <string>() { "IMSGManagedGroupType", "IMSGObjectParentKey", Helper.KnownProviderAttributes.get_DistinguishedName() }); Dictionary <string, IdentityStoreObject> childDict = pair.Value; IdentityStoreObject[] array = childGroups.ToArray(); for (int i = 0; i < (int)array.Length; i++) { IdentityStoreObject g = array[i]; if (!childDict.ContainsKey(g.get_ObjectIdFromIdentityStore())) { childDict.Add(g.get_ObjectIdFromIdentityStore(), g); } } ILookup <string, IdentityStoreObject> childGroupsLookup = childGroups.ToLookup <IdentityStoreObject, string>((IdentityStoreObject c) => c.get_ObjectIdFromIdentityStore()); KeyValuePair <string, IdentityStoreObject>[] keyValuePairArray = childDict.ToArray <KeyValuePair <string, IdentityStoreObject> >(); for (int j = 0; j < (int)keyValuePairArray.Length; j++) { KeyValuePair <string, IdentityStoreObject> childPair = keyValuePairArray[j]; if (!childGroupsLookup[childPair.Key].Any <IdentityStoreObject>()) { childDict.Remove(childPair.Key); } } } catch (Exception exception) { Exception ex = exception; this.logger.Error(string.Concat("Error occurred in getting child groups after smart group update. ", ex.Message)); continue; } } return(managedGroups); }
private static void AddInNotification(List <MembershipLifecycleGroup> listToModifiy, IdentityStoreObject lObject, MembershipLifecycleMember _notifyObject) { if (!listToModifiy.Any <MembershipLifecycleGroup>((MembershipLifecycleGroup z) => z.get_GUID().Equals(lObject.get_ObjectIdFromIdentityStore()))) { MembershipLifecycleGroup membershipLifecycleGroup = new MembershipLifecycleGroup(); membershipLifecycleGroup.set_GUID(lObject.get_ObjectIdFromIdentityStore()); membershipLifecycleGroup.set_DisplayName(lObject.get_ObjectDisplayName()); membershipLifecycleGroup.set_ObjectType(lObject.get_ObjectType()); membershipLifecycleGroup.set_MembershiplifeCycleMembers(new List <MembershipLifecycleMember>()); listToModifiy.Add(membershipLifecycleGroup); } listToModifiy.First <MembershipLifecycleGroup>((MembershipLifecycleGroup z) => z.get_GUID().Equals(lObject.get_ObjectIdFromIdentityStore())).get_MembershiplifeCycleMembers().Add(_notifyObject); }
private static void AddInNotification(List <MembershipLifecycleGroup> AddMemberGroups, IdentityStoreObject lGroup, MembershipLifecycleMember _notifyMember) { if (!AddMemberGroups.Any <MembershipLifecycleGroup>((MembershipLifecycleGroup z) => z.get_GUID().Equals(lGroup.get_ObjectIdFromIdentityStore()))) { MembershipLifecycleGroup membershipLifecycleGroup = new MembershipLifecycleGroup(); membershipLifecycleGroup.set_GUID(lGroup.get_ObjectIdFromIdentityStore()); membershipLifecycleGroup.set_DisplayName(lGroup.get_ObjectDisplayName()); membershipLifecycleGroup.set_ObjectType(lGroup.get_ObjectType()); membershipLifecycleGroup.set_MembershiplifeCycleMembers(new List <MembershipLifecycleMember>()); AddMemberGroups.Add(membershipLifecycleGroup); } AddMemberGroups.First <MembershipLifecycleGroup>((MembershipLifecycleGroup z) => z.get_GUID().Equals(lGroup.get_ObjectIdFromIdentityStore())).get_MembershiplifeCycleMembers().Add(_notifyMember); }
private Group ConvertToGroup(IdentityStoreObject identityStoreObject) { Group group1; if (!(identityStoreObject is Group)) { Group group = new Group(); group.set_ObjectIdFromIdentityStore(identityStoreObject.get_ObjectIdFromIdentityStore()); group.set_ObjectName(identityStoreObject.get_ObjectName()); group.set_ObjectDisplayName(identityStoreObject.get_ObjectDisplayName()); group.set_DisplayName(identityStoreObject.get_ObjectDisplayName()); group.set_ObjectType(identityStoreObject.get_ObjectType()); group.set_AttributesBusinessObject(identityStoreObject.get_AttributesBusinessObject()); group.set_StopNotification(identityStoreObject.get_StopNotification()); group1 = group; } else { group1 = identityStoreObject as Group; } return(group1); }