// Token: 0x0600032B RID: 811 RVA: 0x0001163C File Offset: 0x0000F83C
        private static TenantPartitionCacheItem SearchForTenantInfoByExternalOrgId(Guid externalOrgId, PartitionId partitionId)
        {
            if (partitionId == null)
            {
                throw new ArgumentNullException("partitionId");
            }
            if (partitionId.PartitionObjectId == null || partitionId.PartitionObjectId.Value == Guid.Empty)
            {
                throw new ArgumentNullException("partitionId.PartitionObjectId");
            }
            ADSessionSettings           sessionSettings                       = ADSessionSettings.FromAllTenantsPartitionId(partitionId);
            ITenantConfigurationSession tenantConfigurationSession            = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 985, "SearchForTenantInfoByExternalOrgId", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADAccountPartitionLocator.cs");
            ExchangeConfigurationUnit   exchangeConfigurationUnitByExternalId = tenantConfigurationSession.GetExchangeConfigurationUnitByExternalId(externalOrgId);

            if (exchangeConfigurationUnitByExternalId != null)
            {
                string name = exchangeConfigurationUnitByExternalId.Id.Parent.Name;
                if (ExchangeConfigurationUnit.IsInactiveRelocationNode(exchangeConfigurationUnitByExternalId))
                {
                    ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "SearchForTenantInfoByExternalOrgId() found organization in partition {0} - inactive due to relocation, skipping.", partitionId.ForestFQDN);
                }
                else
                {
                    if (!string.IsNullOrEmpty(name))
                    {
                        ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "SearchForTenantInfoByExternalOrgId() found organization in partition {0}.", partitionId.ForestFQDN);
                        return(new TenantPartitionCacheItem(partitionId.PartitionObjectId.Value, partitionId.ForestFQDN, PartitionId.LocalForest.ForestFQDN, externalOrgId, name, false));
                    }
                    ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "SearchForTenantInfoByExternalOrgId() found organization in partition {0} - not fully provisioned, ExternalDirectoryOrganizationId or partitionGuid is not populated, skipping.", partitionId.ForestFQDN);
                }
            }
            return(null);
        }
        // Token: 0x06000327 RID: 807 RVA: 0x0001115C File Offset: 0x0000F35C
        private static TenantPartitionCacheItem SearchForTenantInfoByOrganizationName(string organizationName, PartitionId partitionId)
        {
            if (string.IsNullOrEmpty(organizationName))
            {
                throw new ArgumentNullException("organizationName");
            }
            if (partitionId == null)
            {
                throw new ArgumentNullException("partitionId");
            }
            ADSessionSettings adsessionSettings = ADSessionSettings.FromAllTenantsPartitionId(partitionId);

            adsessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants;
            ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, adsessionSettings, 643, "SearchForTenantInfoByOrganizationName", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADAccountPartitionLocator.cs");
            ExchangeConfigurationUnit   exchangeConfigurationUnitByNameOrAcceptedDomain = tenantConfigurationSession.GetExchangeConfigurationUnitByNameOrAcceptedDomain(organizationName);

            if (exchangeConfigurationUnitByNameOrAcceptedDomain != null)
            {
                if (ExchangeConfigurationUnit.IsInactiveRelocationNode(exchangeConfigurationUnitByNameOrAcceptedDomain))
                {
                    ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "SearchForTenantInfoByOrganizationName() found organization in partition {0} - inactive due to relocation, skipping.", partitionId.ForestFQDN);
                }
                else
                {
                    string externalDirectoryOrganizationId = exchangeConfigurationUnitByNameOrAcceptedDomain.ExternalDirectoryOrganizationId;
                    string name = exchangeConfigurationUnitByNameOrAcceptedDomain.Id.Parent.Name;
                    if (!string.IsNullOrEmpty(name))
                    {
                        ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "SearchForTenantInfoByOrganizationName() found organization in partition {0}.", partitionId.ForestFQDN);
                        return(new TenantPartitionCacheItem((partitionId.PartitionObjectId != null) ? partitionId.PartitionObjectId.Value : Guid.Empty, partitionId.ForestFQDN, PartitionId.LocalForest.ForestFQDN, new Guid(externalDirectoryOrganizationId), name, false));
                    }
                    ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "SearchForTenantInfoByOrganizationName() found organization in partition {0} - not fully provisioned, ExternalDirectoryOrganizationId or partitionGuid is not populated, skipping.", partitionId.ForestFQDN);
                }
            }
            return(null);
        }
        // Token: 0x06000328 RID: 808 RVA: 0x00011284 File Offset: 0x0000F484
        private static TenantPartitionCacheItem SearchForTenantInfoByUserNetID(string userNetID, PartitionId partitionId)
        {
            GlsDirectorySession.ThrowIfInvalidNetID(userNetID, "userNetID");
            if (partitionId == null)
            {
                throw new ArgumentNullException("partitionId");
            }
            ADSessionSettings           sessionSettings                      = ADSessionSettings.FromAllTenantsPartitionId(partitionId);
            ITenantConfigurationSession tenantConfigurationSession           = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 711, "SearchForTenantInfoByUserNetID", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADAccountPartitionLocator.cs");
            ExchangeConfigurationUnit   exchangeConfigurationUnitByUserNetID = tenantConfigurationSession.GetExchangeConfigurationUnitByUserNetID(userNetID);

            if (exchangeConfigurationUnitByUserNetID != null)
            {
                string externalDirectoryOrganizationId = exchangeConfigurationUnitByUserNetID.ExternalDirectoryOrganizationId;
                string name = exchangeConfigurationUnitByUserNetID.Id.Parent.Name;
                ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "SearchForTenantInfoByUserNetID() found organization in partition {0}.", partitionId.ForestFQDN);
                return(new TenantPartitionCacheItem((partitionId.PartitionObjectId != null) ? partitionId.PartitionObjectId.Value : Guid.Empty, partitionId.ForestFQDN, PartitionId.LocalForest.ForestFQDN, new Guid(externalDirectoryOrganizationId), name, false));
            }
            return(null);
        }
예제 #4
0
 internal abstract ADSessionSettings FromAllTenantsPartitionId(PartitionId partitionId);
        public static TenantRelocationState GetTenantRelocationState(string tenantName, PartitionId partitionId, out bool isSourceTenant, bool readThrough = false)
        {
            if (string.IsNullOrEmpty(tenantName))
            {
                throw new ArgumentNullException("tenantName");
            }
            if (!ForestTenantRelocationsCache.IsTenantRelocationAllowed(partitionId.ForestFQDN))
            {
                isSourceTenant = true;
                return(new TenantRelocationState(partitionId.ForestFQDN, TenantRelocationStatus.NotStarted));
            }
            TenantRelocationStateCache         tenantRelocationStateCache = TenantRelocationStateCache.GetInstance();
            ExpiringTenantRelocationStateValue expiringTenantRelocationStateValue;

            if (!tenantRelocationStateCache.tenantRelocationStates.TryGetValue(tenantName, out expiringTenantRelocationStateValue) || expiringTenantRelocationStateValue.Expired || readThrough || TenantRelocationStateCache.IgnoreRelocationTimeConstraints())
            {
                TenantRelocationState tenantRelocationState = TenantRelocationStateCache.LoadTenantRelocationState(tenantName, partitionId);
                ExTraceGlobals.TenantRelocationTracer.TraceDebug(0L, "TenantRelocationStateCache::GetTenantRelocationState(): Inserting new TenantRelocationState value for tenant {0} to the cache: SourceForestFQDN={1}, SourceForestState={2}, TargetForestFQDN={3}, TargetForestState={4}, TargetOrganizationId={5}", new object[]
                {
                    tenantName,
                    tenantRelocationState.SourceForestFQDN,
                    tenantRelocationState.SourceForestState,
                    tenantRelocationState.TargetForestFQDN,
                    tenantRelocationState.TargetForestState,
                    (tenantRelocationState.TargetOrganizationId != null) ? tenantRelocationState.TargetOrganizationId.ToString() : "<null>"
                });
                expiringTenantRelocationStateValue = new ExpiringTenantRelocationStateValue(tenantRelocationState);
                tenantRelocationStateCache.AddOrUpdate(tenantName, expiringTenantRelocationStateValue);
            }
            if (expiringTenantRelocationStateValue.Value.TargetOrganizationId == null || expiringTenantRelocationStateValue.Value.TargetOrganizationId.OrganizationalUnit == null)
            {
                isSourceTenant = true;
            }
            else if (expiringTenantRelocationStateValue.Value.TargetOrganizationId.PartitionId != partitionId)
            {
                isSourceTenant = true;
            }
            else if (expiringTenantRelocationStateValue.Value.SourceForestFQDN == expiringTenantRelocationStateValue.Value.TargetForestFQDN)
            {
                isSourceTenant = (tenantName != expiringTenantRelocationStateValue.Value.TargetOrganizationId.OrganizationalUnit.Name);
            }
            else
            {
                isSourceTenant = false;
            }
            return(expiringTenantRelocationStateValue.Value);
        }
예제 #6
0
 internal static ADSessionSettings FromAccountPartitionWideScopeSet(PartitionId partitionId)
 {
     return(ADSessionSettings.InvokeWithAPILogging <ADSessionSettings>(() => ADSessionSettings.SessionSettingsFactory.Default.FromAccountPartitionWideScopeSet(partitionId), "FromAccountPartitionWideScopeSet"));
 }
예제 #7
0
 internal static bool IsForefrontObject(PartitionId id)
 {
     return(DatacenterRegistry.IsForefrontForOffice() && id.ForestFQDN == "FFO.extest.microsoft.com");
 }
예제 #8
0
        private static OrganizationId FromPartition <T>(T lookupKey, Guid externalDirectoryOrganizationId, string tenantContainerCN, PartitionId partitionId, Func <ITenantConfigurationSession, OrganizationId> GetOrgFromAD, Func <Exception> CreateNotFoundException)
        {
            ADSessionSettings           sessionSettings            = ADSessionSettings.FromAllTenantsPartitionId(partitionId);
            ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 561, "FromPartition", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\OrganizationId.cs");

            if (!string.IsNullOrEmpty(tenantContainerCN))
            {
                OrganizationId organizationId = OrganizationId.FromTenantContainerCN(tenantContainerCN, tenantConfigurationSession);
                organizationId.externalDirectoryOrganizationId = new Guid?(externalDirectoryOrganizationId);
                return(organizationId);
            }
            OrganizationId organizationId2 = GetOrgFromAD(tenantConfigurationSession);

            if (organizationId2 != null)
            {
                ExTraceGlobals.GLSTracer.TraceDebug <OrganizationId, T>(0L, "[OrganizationIdConvertor.FromExternalDirectoryOrganizationId]: Found OrganizationId {0} for {1}", organizationId2, lookupKey);
                Guid value = Guid.Empty;
                if (externalDirectoryOrganizationId == Guid.Empty)
                {
                    ADRawEntry adrawEntry = tenantConfigurationSession.ReadADRawEntry(organizationId2.ConfigurationUnit, new PropertyDefinition[]
                    {
                        ExchangeConfigurationUnitSchema.ExternalDirectoryOrganizationId
                    });
                    if (adrawEntry != null)
                    {
                        Guid.TryParse(adrawEntry[ExchangeConfigurationUnitSchema.ExternalDirectoryOrganizationId].ToString(), out value);
                    }
                }
                else
                {
                    value = externalDirectoryOrganizationId;
                }
                organizationId2.externalDirectoryOrganizationId = new Guid?(value);
                return(organizationId2);
            }
            throw CreateNotFoundException();
        }
        // Token: 0x0600117F RID: 4479 RVA: 0x000544FC File Offset: 0x000526FC
        internal static ExchangeConfigurationUnit FindOneSharedConfiguration(SharedConfigurationInfo sci, PartitionId partitionId)
        {
            ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 657, "FindOneSharedConfiguration", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SharedConfiguration.cs");

            ExchangeConfigurationUnit[] array = tenantConfigurationSession.FindSharedConfiguration(sci, true);
            if (array == null || array.Length == 0)
            {
                return(null);
            }
            if (array.Length == 1)
            {
                return(array[0]);
            }
            Random random = new Random();

            return(array[random.Next(array.Length)]);
        }
        internal static ADPagedReader <ExchangeConfigurationUnit> FindAllTempateTenants(string programId, string offerId, PartitionId partitionId)
        {
            ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 236, "FindAllTempateTenants", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\TemplateTenantConfiguration.cs");
            QueryFilter filter = new AndFilter(new QueryFilter[]
            {
                new ExistsFilter(OrganizationSchema.SharedConfigurationInfo),
                new ComparisonFilter(ComparisonOperator.Equal, ExchangeConfigurationUnitSchema.ResellerId, programId + "." + offerId),
                new ComparisonFilter(ComparisonOperator.Equal, ExchangeConfigurationUnitSchema.OrganizationStatus, OrganizationStatus.Active),
                new ComparisonFilter(ComparisonOperator.Equal, OrganizationSchema.EnableAsSharedConfiguration, true)
            });

            return(tenantConfigurationSession.FindPaged <ExchangeConfigurationUnit>(null, QueryScope.SubTree, filter, null, 0));
        }
 public static string RefreshRidMasterName(PartitionId partitionId)
 {
     return(ForestTenantRelocationsCache.RidMastersCache.GetRidMasterName(partitionId, true));
 }
예제 #12
0
        private static TimeSpan CalculateCacheItemExpirationWindow(bool dataFromOfflineService, string tenantName, Guid externalOrgId, PartitionId accountPartitionId)
        {
            if (dataFromOfflineService)
            {
                return(TimeSpan.FromMinutes((double)ConfigBase <AdDriverConfigSchema> .GetConfig <int>("OfflineDataCacheExpirationTimeInMinutes")));
            }
            if (!ForestTenantRelocationsCache.IsTenantRelocationAllowed(accountPartitionId.ForestFQDN))
            {
                return(ExpiringTenantRelocationStateValue.TenantRelocationStateExpirationWindowProvider.DefaultExpirationWindow);
            }
            if (!string.IsNullOrEmpty(tenantName))
            {
                return(TenantRelocationStateCache.GetTenantCacheExpirationWindow(tenantName, accountPartitionId));
            }
            ITenantConfigurationSession tenantConfigurationSession            = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsPartitionId(accountPartitionId), 110, "CalculateCacheItemExpirationWindow", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\TenantPartitionCacheItem.cs");
            ExchangeConfigurationUnit   exchangeConfigurationUnitByExternalId = tenantConfigurationSession.GetExchangeConfigurationUnitByExternalId(externalOrgId);

            if (exchangeConfigurationUnitByExternalId != null)
            {
                tenantName = ((ADObjectId)exchangeConfigurationUnitByExternalId.Identity).Parent.Name;
                return(TenantRelocationStateCache.GetTenantCacheExpirationWindow(tenantName, accountPartitionId));
            }
            return(ExpiringTenantRelocationStateValue.TenantRelocationStateExpirationWindowProvider.DefaultExpirationWindow);
        }
        private static TenantRelocationState LoadTenantRelocationState(string tenantName, PartitionId partitionId)
        {
            ITenantConfigurationSession session = DirectorySessionFactory.NonCacheSessionFactory.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 185, "LoadTenantRelocationState", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\RelocationCache\\TenantRelocationStateCache.cs");
            ExchangeConfigurationUnit   exchangeCUAndThrowIfNotFound = TenantRelocationStateCache.GetExchangeCUAndThrowIfNotFound(tenantName, session);

            if (exchangeCUAndThrowIfNotFound.IsCached)
            {
                ExTraceGlobals.TenantRelocationTracer.TraceDebug <string>(0L, "TenantRelocationStateCache::LoadTenantRelocationState(): Tenant {0} found in cache.", tenantName);
                if ((DateTime.UtcNow - exchangeCUAndThrowIfNotFound.WhenReadUTC).Value.TotalSeconds >= 30.0)
                {
                    ITenantConfigurationSession session2 = DirectorySessionFactory.NonCacheSessionFactory.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 203, "LoadTenantRelocationState", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\RelocationCache\\TenantRelocationStateCache.cs");
                    exchangeCUAndThrowIfNotFound = TenantRelocationStateCache.GetExchangeCUAndThrowIfNotFound(tenantName, session2);
                    ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.CacheSessionFactory.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 206, "LoadTenantRelocationState", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\RelocationCache\\TenantRelocationStateCache.cs");
                    tenantConfigurationSession.Delete(exchangeCUAndThrowIfNotFound);
                    tenantConfigurationSession.Save(exchangeCUAndThrowIfNotFound);
                }
            }
            if ((string.IsNullOrEmpty(exchangeCUAndThrowIfNotFound.TargetForest) && string.IsNullOrEmpty(exchangeCUAndThrowIfNotFound.RelocationSourceForestRaw)) || (!string.IsNullOrEmpty(exchangeCUAndThrowIfNotFound.RelocationSourceForestRaw) && exchangeCUAndThrowIfNotFound.RelocationStateRequested == RelocationStateRequested.Cleanup))
            {
                ExTraceGlobals.TenantRelocationTracer.TraceDebug <string, string, bool>(0L, "TenantRelocationStateCache::LoadTenantRelocationState(): Found tenant {0} on DC {1} Cached {2} - not being relocated.", tenantName, exchangeCUAndThrowIfNotFound.OriginatingServer, exchangeCUAndThrowIfNotFound.IsCached);
                return(new TenantRelocationState(partitionId.ForestFQDN, TenantRelocationStatus.NotStarted));
            }
            if (string.IsNullOrEmpty(exchangeCUAndThrowIfNotFound.ExternalDirectoryOrganizationId))
            {
                ExTraceGlobals.TenantRelocationTracer.TraceDebug <string, string, bool>(0L, "TenantRelocationStateCache::LoadTenantRelocationState(): Found tenant {0} on DC {1} Cached {2} - prepared for deletion.", tenantName, exchangeCUAndThrowIfNotFound.OriginatingServer, exchangeCUAndThrowIfNotFound.IsCached);
                TenantRelocationStatus sourceForestState;
                if (!string.IsNullOrEmpty(exchangeCUAndThrowIfNotFound.TargetForest))
                {
                    sourceForestState = exchangeCUAndThrowIfNotFound.RelocationStatus;
                }
                else
                {
                    sourceForestState = TenantRelocationStatus.NotStarted;
                }
                return(new TenantRelocationState(partitionId.ForestFQDN, sourceForestState));
            }
            if (!string.IsNullOrEmpty(exchangeCUAndThrowIfNotFound.TargetForest))
            {
                TenantRelocationRequest tenantRelocationRequest;
                Exception ex;
                TenantRelocationRequest.LoadOtherForestObjectInternal(null, exchangeCUAndThrowIfNotFound.TargetForest, exchangeCUAndThrowIfNotFound.DistinguishedName, exchangeCUAndThrowIfNotFound.ExternalDirectoryOrganizationId, true, out tenantRelocationRequest, out ex);
                if (ex != null && !(ex is CannotFindTargetTenantException))
                {
                    throw ex;
                }
                ExTraceGlobals.TenantRelocationTracer.TraceDebug <string, string>(0L, "TenantRelocationStateCache::LoadTenantRelocationState(): Found tenant {0} on DC {1} - this is relocation source.", tenantName, (tenantRelocationRequest != null) ? tenantRelocationRequest.OriginatingServer : "<unknown>");
                return(new TenantRelocationState(partitionId.ForestFQDN, exchangeCUAndThrowIfNotFound.RelocationStatus, exchangeCUAndThrowIfNotFound.TargetForest, (RelocationStatusDetailsDestination)((tenantRelocationRequest != null) ? tenantRelocationRequest.RelocationStatusDetailsRaw : RelocationStatusDetails.NotStarted), exchangeCUAndThrowIfNotFound.OrganizationId, (tenantRelocationRequest != null) ? tenantRelocationRequest.OrganizationId : null));
            }
            else
            {
                Exception ex;
                TenantRelocationRequest tenantRelocationRequest2;
                TenantRelocationRequest.LoadOtherForestObjectInternal(null, exchangeCUAndThrowIfNotFound.RelocationSourceForestRaw, exchangeCUAndThrowIfNotFound.DistinguishedName, exchangeCUAndThrowIfNotFound.ExternalDirectoryOrganizationId, false, out tenantRelocationRequest2, out ex);
                if (ex == null)
                {
                    ExTraceGlobals.TenantRelocationTracer.TraceDebug(0L, string.Format("TenantRelocationStateCache::LoadTenantRelocationState(): Found tenant {0} on DC {1} - this is relocation target.", tenantName, (tenantRelocationRequest2 != null) ? tenantRelocationRequest2.OriginatingServer : "<unknown>"));
                    return(new TenantRelocationState(exchangeCUAndThrowIfNotFound.RelocationSourceForestRaw, (tenantRelocationRequest2 != null) ? tenantRelocationRequest2.RelocationStatus : TenantRelocationStatus.NotStarted, partitionId.ForestFQDN, (RelocationStatusDetailsDestination)exchangeCUAndThrowIfNotFound.RelocationStatusDetailsSource, (tenantRelocationRequest2 != null) ? tenantRelocationRequest2.OrganizationId : null, exchangeCUAndThrowIfNotFound.OrganizationId));
                }
                if (ex is CannotFindTargetTenantException)
                {
                    return(new TenantRelocationState(partitionId.ForestFQDN, TenantRelocationStatus.NotStarted));
                }
                throw ex;
            }
        }
        internal static bool TryLoadTenantRelocationStateSourceReplica(string tenantName, PartitionId partitionId, out RelocationStatusDetailsSource status)
        {
            ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 164, "TryLoadTenantRelocationStateSourceReplica", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\RelocationCache\\TenantRelocationStateCache.cs");

            tenantConfigurationSession.SessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants;
            ExchangeConfigurationUnit exchangeConfigurationUnitByName = tenantConfigurationSession.GetExchangeConfigurationUnitByName(tenantName);

            if (exchangeConfigurationUnitByName != null)
            {
                status = exchangeConfigurationUnitByName.RelocationStatusDetailsSource;
                return(true);
            }
            status = RelocationStatusDetailsSource.NotStarted;
            return(false);
        }
        // Token: 0x06000331 RID: 817 RVA: 0x0001196C File Offset: 0x0000FB6C
        private static void RefreshAllAccountPartitions()
        {
            if (!Globals.IsMicrosoftHostedOnly)
            {
                ADAccountPartitionLocator.allAccountPartitionIds = new PartitionId[0];
                ADAccountPartitionLocator.allExplicitlyConfiguredAccountPartitionIds        = new PartitionId[0];
                ADAccountPartitionLocator.allExplicitlyConfiguredPrimaryAccountPartitionIds = new PartitionId[0];
                return;
            }
            AccountPartition[] array = ADAccountPartitionLocator.ReadAccountPartitionsFromAD();
            IOrderedEnumerable <AccountPartition> orderedEnumerable = from x in array
                                                                      orderby x.WhenCreatedUTC descending
                                                                      select x;
            Dictionary <Guid, string> dictionary  = new Dictionary <Guid, string>();
            Dictionary <string, Guid> dictionary2 = new Dictionary <string, Guid>(StringComparer.OrdinalIgnoreCase);
            List <PartitionId>        list        = new List <PartitionId>(array.Length);
            List <PartitionId>        list2       = new List <PartitionId>(array.Length);
            List <PartitionId>        list3       = new List <PartitionId>(array.Length);
            bool        flag        = false;
            PartitionId partitionId = null;

            foreach (AccountPartition accountPartition in orderedEnumerable)
            {
                if (accountPartition.TryGetPartitionId(out partitionId))
                {
                    list.Add(partitionId);
                    dictionary.Add(partitionId.PartitionObjectId.Value, partitionId.ForestFQDN);
                    dictionary2.Add(partitionId.ForestFQDN, partitionId.PartitionObjectId.Value);
                    if (accountPartition.EnabledForProvisioning)
                    {
                        list3.Add(partitionId);
                    }
                    if (!accountPartition.IsSecondary)
                    {
                        list2.Add(partitionId);
                    }
                }
                if (accountPartition.IsLocalForest)
                {
                    flag = true;
                }
            }
            if (list.Count == 0)
            {
                partitionId = new PartitionId(PartitionId.LocalForest.ForestFQDN, ADObjectId.ResourcePartitionGuid);
                list.Add(partitionId);
                list3.Add(partitionId);
            }
            lock (ADAccountPartitionLocator.modifySyncObject)
            {
                ADAccountPartitionLocator.allAccountPartitionIds = list.ToArray();
                ADAccountPartitionLocator.allExplicitlyConfiguredAccountPartitionIds        = list.ToArray();
                ADAccountPartitionLocator.allExplicitlyConfiguredPrimaryAccountPartitionIds = list2.ToArray();
                ADAccountPartitionLocator.allAccountPartitionIdsEnabledForProvisioning      = list3.ToArray();
                ADAccountPartitionLocator.partitionsGuidToFQDN = dictionary;
                ADAccountPartitionLocator.partitionsFQDNToGuid = dictionary2;
                if (!flag)
                {
                    partitionId = new PartitionId(PartitionId.LocalForest.ForestFQDN, ADObjectId.ResourcePartitionGuid);
                    PartitionId[] array2 = new PartitionId[ADAccountPartitionLocator.allAccountPartitionIds.Length + 1];
                    array2[0] = partitionId;
                    Array.Copy(ADAccountPartitionLocator.allAccountPartitionIds, 0, array2, 1, ADAccountPartitionLocator.allAccountPartitionIds.Length);
                    ADAccountPartitionLocator.allAccountPartitionIds = array2;
                    ADAccountPartitionLocator.partitionsFQDNToGuid.Add(partitionId.ForestFQDN, partitionId.PartitionObjectId.Value);
                    ADAccountPartitionLocator.partitionsGuidToFQDN.Add(partitionId.PartitionObjectId.Value, partitionId.ForestFQDN);
                }
            }
            ADAccountPartitionLocator.crossRFLookupCheckEnabled = ADAccountPartitionLocator.UpdateCrossRFLookupCheckEnabled();
        }
        // Token: 0x06001180 RID: 4480 RVA: 0x00054558 File Offset: 0x00052758
        internal static OrganizationId FindOneSharedConfigurationId(SharedConfigurationInfo sci, PartitionId partitionId)
        {
            ExchangeConfigurationUnit exchangeConfigurationUnit = SharedConfiguration.FindOneSharedConfiguration(sci, partitionId);

            if (exchangeConfigurationUnit == null)
            {
                return(null);
            }
            return(exchangeConfigurationUnit.OrganizationId);
        }
예제 #17
0
 private ADSessionSettings(ScopeSet scopeSet, ADObjectId rootOrgId, OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId, ConfigScopes configScopes, PartitionId partitionId)
 {
     if (scopeSet == null)
     {
         throw new ArgumentNullException("scopeSet");
     }
     if (null == currentOrganizationId)
     {
         throw new ArgumentNullException("currentOrganizationId");
     }
     if (executingUserOrganizationId != null && !executingUserOrganizationId.Equals(OrganizationId.ForestWideOrgId) && !executingUserOrganizationId.Equals(currentOrganizationId) && !currentOrganizationId.OrganizationalUnit.IsDescendantOf(executingUserOrganizationId.OrganizationalUnit))
     {
         throw new ArgumentException(DirectoryStrings.ErrorInvalidExecutingOrg(executingUserOrganizationId.OrganizationalUnit.DistinguishedName, currentOrganizationId.OrganizationalUnit.DistinguishedName));
     }
     if (partitionId == null)
     {
         throw new ArgumentNullException("partitionId");
     }
     this.scopeSet                    = scopeSet;
     this.preferredServers            = new SimpleServerSettings();
     this.rootOrgId                   = rootOrgId;
     this.currentOrganizationId       = currentOrganizationId;
     this.executingUserOrganizationId = executingUserOrganizationId;
     this.configScopes                = configScopes;
     this.partitionId                 = partitionId;
     this.tenantConsistencyMode       = ((configScopes == ConfigScopes.AllTenants) ? TenantConsistencyMode.IgnoreRetiredTenants : TenantConsistencyMode.ExpectOnlyLiveTenants);
     if (!ADGlobalConfigSettings.SoftLinkEnabled || this.PartitionId == null || this.PartitionId.IsLocalForestPartition() || ADSessionSettings.IsForefrontObject(this.PartitionId))
     {
         this.PartitionSoftLinkMode = SoftLinkMode.Disabled;
         return;
     }
     if (this.PartitionId.ForestFQDN.EndsWith(TopologyProvider.LocalForestFqdn, StringComparison.OrdinalIgnoreCase))
     {
         this.PartitionSoftLinkMode = SoftLinkMode.Disabled;
         return;
     }
     if (this.ConfigScopes == ConfigScopes.Database || this.ConfigScopes == ConfigScopes.Server || this.ConfigScopes == ConfigScopes.RootOrg)
     {
         this.PartitionSoftLinkMode = SoftLinkMode.Disabled;
         return;
     }
     this.PartitionSoftLinkMode = SoftLinkMode.DualMatch;
 }
        // Token: 0x06001181 RID: 4481 RVA: 0x00054578 File Offset: 0x00052778
        internal static bool DoesSctExistForVersion(ServerVersion version, string programId, string offerId, PartitionId partitionId)
        {
            SharedConfigurationInfo sci = new SharedConfigurationInfo(version, programId, offerId);

            return(SharedConfiguration.FindOneSharedConfigurationId(sci, partitionId) != null);
        }
예제 #19
0
 internal static ADSessionSettings FromAllTenantsPartitionId(PartitionId partitionId)
 {
     return(ADSessionSettings.InvokeWithAPILogging <ADSessionSettings>(() => ADSessionSettings.SessionSettingsFactory.Default.FromAllTenantsPartitionId(partitionId), "FromAllTenantsPartitionId"));
 }
        // Token: 0x06001182 RID: 4482 RVA: 0x0005459C File Offset: 0x0005279C
        internal static OrganizationId FindMostRecentSharedConfigurationInPartition(OrganizationId sourceOrganizationId, PartitionId targetAccountPartitionId, out Exception ex)
        {
            ex = null;
            OrganizationId organizationId = null;

            ExchangeConfigurationUnit[] array = SharedConfiguration.LoadSharedConfigurationsSorted(sourceOrganizationId);
            if (array != null && array.Length > 0)
            {
                int num = array.Length;
                SharedConfigurationInfo sharedConfigurationInfo = array[num - 1].SharedConfigurationInfo;
                organizationId = SharedConfiguration.FindOneSharedConfigurationId(sharedConfigurationInfo, targetAccountPartitionId);
                if (organizationId == null)
                {
                    ex = new InvalidOperationException(DirectoryStrings.ErrorTargetPartitionSctMissing(sourceOrganizationId.ConfigurationUnit.DistinguishedName, targetAccountPartitionId.ForestFQDN, sharedConfigurationInfo.ToString()));
                }
            }
            return(organizationId);
        }
예제 #21
0
 internal virtual ADSessionSettings FromAccountPartitionWideScopeSet(PartitionId partitionId)
 {
     return(ADSessionSettings.SessionSettingsFactory.CreateADSessionSettings(ADSessionSettings.SessionSettingsFactory.GlobalScopeSet, null, OrganizationId.ForestWideOrgId, null, ConfigScopes.Global, partitionId));
 }
        // Token: 0x0600031E RID: 798 RVA: 0x00010DF0 File Offset: 0x0000EFF0
        public static Guid GetExternalDirectoryOrganizationIdByTenantName(string tenantName, PartitionId partitionId)
        {
            if (string.IsNullOrEmpty(tenantName))
            {
                throw new ArgumentNullException("tenantName");
            }
            if (partitionId == null)
            {
                throw new ArgumentNullException("partitionId");
            }
            ADAccountPartitionLocator.LoadPartitionCacheIfNecessary();
            TenantPartitionCacheItem tenantPartitionCacheItem;

            if (!ADAccountPartitionLocator.tenantNamePartitionCache.TryGetValue(tenantName, out tenantPartitionCacheItem))
            {
                tenantPartitionCacheItem = ADAccountPartitionLocator.SearchForTenantInfoByOrganizationName(tenantName, partitionId);
                if (tenantPartitionCacheItem != null)
                {
                    ADAccountPartitionLocator.InsertCacheMaps(tenantPartitionCacheItem, null, null);
                }
            }
            if (tenantPartitionCacheItem != null)
            {
                ADAccountPartitionLocator.EnsureRegisteredAccountPartition(tenantPartitionCacheItem);
                return(tenantPartitionCacheItem.ExternalOrgId);
            }
            throw new CannotResolveTenantNameException(DirectoryStrings.CannotResolveTenantNameByAcceptedDomain(tenantName));
        }
예제 #23
0
            protected static ADSessionSettings CreateADSessionSettings(ScopeSet scopeSet, ADObjectId rootOrgId, OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId, ConfigScopes configScopes, PartitionId partitionId)
            {
                ADSessionSettings adsessionSettings = new ADSessionSettings(scopeSet, rootOrgId, currentOrganizationId, executingUserOrganizationId, configScopes, partitionId);

                if (ADSessionSettings.SessionSettingsFactory.ThreadPostActionForSettings == null)
                {
                    return(adsessionSettings);
                }
                return(ADSessionSettings.SessionSettingsFactory.ThreadPostActionForSettings(adsessionSettings));
            }
 internal override ADSessionSettings FromAllTenantsPartitionId(PartitionId partitionId)
 {
     return(ADSessionSettings.SessionSettingsFactory.CreateADSessionSettings(ScopeSet.GetAllTenantsDefaultScopeSet(partitionId.ForestFQDN), null, OrganizationId.ForestWideOrgId, null, ConfigScopes.AllTenants, partitionId));
 }