// Token: 0x06000459 RID: 1113 RVA: 0x0000F8C0 File Offset: 0x0000DAC0 internal static void VerifyIsWithinConfigWriteScope(ADSessionSettings sessionSettings, ADObject obj, Task.ErrorLoggerDelegate errorHandler) { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 481, "VerifyIsWithinConfigWriteScope", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\MapiTaskHelper.cs"); ADScopeException ex; if (!tenantOrTopologyConfigurationSession.TryVerifyIsWithinScopes(obj, true, out ex)) { errorHandler(new IsOutofConfigWriteScopeException(obj.GetType().ToString(), obj.Name), ExchangeErrorCategory.Client, null); } }
public static IADObjectCommon CreateWrapper(ADObject adObject) { if (adObject == null) { return(null); } if (adObject is Database) { return(ADObjectWrapperFactory.CreateWrapper((Database)adObject)); } if (adObject is MiniDatabase) { return(ADObjectWrapperFactory.CreateWrapper((MiniDatabase)adObject)); } if (adObject is DatabaseCopy) { return(ADObjectWrapperFactory.CreateWrapper((DatabaseCopy)adObject)); } if (adObject is ADComputer) { return(ADObjectWrapperFactory.CreateWrapper((ADComputer)adObject)); } if (adObject is Server) { return(ADObjectWrapperFactory.CreateWrapper((Server)adObject)); } if (adObject is MiniServer) { return(ADObjectWrapperFactory.CreateWrapper((MiniServer)adObject)); } if (adObject is DatabaseAvailabilityGroup) { return(ADObjectWrapperFactory.CreateWrapper((DatabaseAvailabilityGroup)adObject)); } if (adObject is ClientAccessArray) { return(ADObjectWrapperFactory.CreateWrapper((ClientAccessArray)adObject)); } if (adObject is MiniClientAccessServerOrArray) { return(ADObjectWrapperFactory.CreateWrapper((MiniClientAccessServerOrArray)adObject)); } if (adObject is ADSite) { return(ADObjectWrapperFactory.CreateWrapper((ADSite)adObject)); } ExAssert.RetailAssert(false, "Type '{0}' is not supported by CreateWrapper", new object[] { adObject.GetType() }); return(null); }
private ADObject FixObjectType(ADObject adObject) { if (adObject == null) { throw new ArgumentNullException("The recipient should not be post processed if null.", "recipient"); } Type type = adObject.GetType(); string key = adObject.ObjectClass.First <string>(); Type type2; if (FfoRecipientSession.objectClassTypes.TryGetValue(key, out type2) && type.IsAssignableFrom(type2)) { adObject = (ADObject)Activator.CreateInstance(type2, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, new object[] { this, adObject.propertyBag }, null); } return(adObject); }
public static void FixDistinguishedName(ADObject adObject, string tenantDistinguishedName, Guid tenantGuid, Guid objectGuid, ADObjectId relativeConfigDN = null) { if (adObject == null || string.IsNullOrEmpty(tenantDistinguishedName)) { return; } if (tenantGuid == Guid.Empty || objectGuid == Guid.Empty) { throw new InvalidOperationException(string.Format("Unable to fix distinguished name for ADObject = {0}, TenantGuid = {1}, ObjectGuid = {2}, objectName = {3}.", new object[] { adObject.GetType().Name, tenantGuid, objectGuid, adObject.Name })); } string unescapedCommonName = string.IsNullOrEmpty(adObject.Name) ? objectGuid.ToString() : adObject.Name; ADObjectId adobjectId = new ADObjectId(tenantDistinguishedName, tenantGuid); ADObjectId adobjectId2 = new ADObjectId(adobjectId.GetChildId("Configuration").DistinguishedName, tenantGuid); if (relativeConfigDN != null) { adobjectId2 = new ADObjectId(adobjectId2.GetDescendantId(relativeConfigDN).DistinguishedName, tenantGuid); } ADObjectId id = new ADObjectId(adobjectId2.GetChildId(unescapedCommonName).DistinguishedName, objectGuid); ADObjectId adobjectId3 = (ADObjectId)adObject[ADObjectSchema.ConfigurationUnit]; if (adobjectId3 != null && adobjectId3.Name != null && string.Equals(adobjectId3.Name, adobjectId2.Name, StringComparison.InvariantCultureIgnoreCase)) { return; } adObject[ADObjectSchema.OrganizationalUnitRoot] = adobjectId; adObject[ADObjectSchema.ConfigurationUnit] = adobjectId2; adObject.SetId(id); FfoDirectorySession.FixLegacyExchangeDN(adObject, tenantGuid); FfoDirectorySession.FixDistinguishedNameForADObjectIDs(adObject, tenantDistinguishedName); }
// Token: 0x0600095D RID: 2397 RVA: 0x000299C8 File Offset: 0x00027BC8 internal static List <Tuple <string, KeyType> > GetAddKeysFromObject(ADObject adObject) { ArgumentValidator.ThrowIfNull("adObject", adObject); ObjectType objectTypeFor = CacheUtils.GetObjectTypeFor(adObject.GetType(), true); List <Tuple <string, KeyType> > list = new List <Tuple <string, KeyType> >(); if (!string.IsNullOrEmpty(adObject.DistinguishedName)) { list.Add(new Tuple <string, KeyType>(adObject.DistinguishedName.ToLower(), KeyType.DistinguishedName)); } if (!Guid.Empty.Equals(adObject.Guid)) { list.Add(new Tuple <string, KeyType>(adObject.Guid.ToString(), KeyType.Guid)); } ObjectType objectType = objectTypeFor; if (objectType <= ObjectType.OWAMiniRecipient) { if (objectType <= ObjectType.FederatedOrganizationId) { switch (objectType) { case ObjectType.ExchangeConfigurationUnit: list.Add(new Tuple <string, KeyType>(adObject.Id.Parent.Name, KeyType.Name)); list.Add(new Tuple <string, KeyType>(((ExchangeConfigurationUnit)adObject).ExternalDirectoryOrganizationId, KeyType.ExternalDirectoryOrganizationId)); return(list); case ObjectType.Recipient: { list.AddRange(KeyBuilder.GetSidKeys(adObject)); list.AddRange(KeyBuilder.GetExchangeGuidKeys(adObject)); string text = (string)adObject[ADRecipientSchema.LegacyExchangeDN]; if (!string.IsNullOrEmpty(text)) { list.Add(new Tuple <string, KeyType>(text, KeyType.LegacyExchangeDN)); } list.AddRange(KeyBuilder.GetExchangeEmailAddressesKeys(adObject)); return(list); } case ObjectType.ExchangeConfigurationUnit | ObjectType.Recipient: return(list); case ObjectType.AcceptedDomain: list.Add(new Tuple <string, KeyType>(adObject.Name, KeyType.Name)); return(list); default: if (objectType != ObjectType.FederatedOrganizationId) { return(list); } list.Add(new Tuple <string, KeyType>(adObject.Id.Parent.DistinguishedName, KeyType.OrgCUDN)); return(list); } } else { if (objectType == ObjectType.MiniRecipient) { if ((adObject as MiniRecipient).NetID != null) { list.Add(KeyBuilder.LookupKeysFromNetId((adObject as MiniRecipient).NetID.ToString())); } ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)adObject[ADRecipientSchema.EmailAddresses]; if (proxyAddressCollection != null) { foreach (ProxyAddress proxyAddress in proxyAddressCollection) { list.AddRange(KeyBuilder.LookupKeysFromProxyAddress(proxyAddress)); } } list.AddRange(KeyBuilder.GetSidKeys(adObject)); return(list); } if (objectType != ObjectType.TransportMiniRecipient && objectType != ObjectType.OWAMiniRecipient) { return(list); } } } else if (objectType <= ObjectType.StorageMiniRecipient) { if (objectType != ObjectType.ActiveSyncMiniRecipient && objectType != ObjectType.StorageMiniRecipient) { return(list); } } else if (objectType != ObjectType.LoadBalancingMiniRecipient) { if (objectType == ObjectType.MiniRecipientWithTokenGroups) { list.AddRange(KeyBuilder.GetSidKeys(adObject)); return(list); } if (objectType != ObjectType.FrontEndMiniRecipient) { return(list); } list.AddRange(KeyBuilder.GetExchangeGuidKeys(adObject)); return(list); } ProxyAddressCollection proxyAddressCollection2 = (ProxyAddressCollection)adObject[ADRecipientSchema.EmailAddresses]; if (proxyAddressCollection2 != null) { foreach (ProxyAddress proxyAddress2 in proxyAddressCollection2) { list.AddRange(KeyBuilder.LookupKeysFromProxyAddress(proxyAddress2)); } } list.AddRange(KeyBuilder.GetSidKeys(adObject)); return(list); }