internal override ADSessionSettings FromAllTenantsOrRootOrgAutoDetect(ADObjectId id) { if (id == null) { throw new ArgumentNullException("id"); } if (id.DomainId == null) { ExTraceGlobals.GetConnectionTracer.TraceDebug <string>(0L, "FromAllTenantsOrRootOrgAutoDetect(): Value '{0}' passed to id parameter doesn't have DomainId initialized, falling back to RootOrg scope set", id.ToString()); return(ADSessionSettings.FromRootOrgScopeSet()); } PartitionId partitionId = id.GetPartitionId(); if (!ADAccountPartitionLocator.IsKnownPartition(partitionId)) { ExTraceGlobals.GetConnectionTracer.TraceDebug <string>(0L, "FromAllTenantsOrRootOrgAutoDetect(): Value '{0}' passed to id parameter doesn't match any known partition, falling back to RootOrg scope set", id.ToString()); return(ADSessionSettings.FromRootOrgScopeSet()); } ExTraceGlobals.GetConnectionTracer.TraceDebug <string, string>(0L, "FromAllTenantsOrRootOrgAutoDetect(): Value '{0}' passed to id parameter matches partition {1}, returning settings bound to that partition", id.ToString(), partitionId.ToString()); if (ADSession.IsTenantIdentity(id, partitionId.ForestFQDN)) { return(ADSessionSettings.FromAllTenantsObjectId(id)); } if (!TopologyProvider.IsAdamTopology()) { return(ADSessionSettings.FromAccountPartitionRootOrgScopeSet(id.GetPartitionId())); } return(ADSessionSettings.FromRootOrgScopeSet()); }
public static string GetCurrentConfigDC(string partitionFqdn) { ADSessionSettings adsessionSettings; if (PartitionId.IsLocalForestPartition(partitionFqdn)) { adsessionSettings = ADSessionSettings.FromRootOrgScopeSet(); } else { adsessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(new PartitionId(partitionFqdn)); } Fqdn fqdn = adsessionSettings.ServerSettings.ConfigurationDomainController(partitionFqdn); if (fqdn != null) { return(fqdn.ToString()); } return(TopologyProvider.GetInstance().GetConfigDC(partitionFqdn)); }
private static string FindRidMasterNameForPartition(PartitionId partitionId) { string result = null; ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAccountPartitionRootOrgScopeSet(partitionId), 213, "FindRidMasterNameForPartition", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\RelocationCache\\ForestTenantRelocationsCache.cs"); topologyConfigurationSession.UseConfigNC = false; RidManagerContainer[] array = topologyConfigurationSession.Find <RidManagerContainer>(null, QueryScope.SubTree, null, null, 1); if (array != null && array.Length > 0) { ADObjectId fsmoRoleOwner = array[0].FsmoRoleOwner; if (fsmoRoleOwner != null) { topologyConfigurationSession.UseConfigNC = true; ADServer adserver = topologyConfigurationSession.Read <ADServer>(fsmoRoleOwner.Parent); if (adserver != null) { result = adserver.DnsHostName; } } } return(result); }
private static IDirectorySession GetSessionForPartition(string partitionFQDN) { ADSessionSettings sessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(new PartitionId(partitionFQDN)); return(DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, sessionSettings, 28, "GetSessionForPartition", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADObjectIdResolutionHelper.cs")); }