protected void SetCurrentOrganizationWithScopeSet(OrganizationId orgId) { if (orgId != null && !orgId.Equals(OrganizationId.ForestWideOrgId)) { base.CurrentTaskContext.ScopeSet = ScopeSet.ResolveUnderScope(orgId, base.CurrentTaskContext.ScopeSet); } base.CurrentOrganizationId = orgId; }
// Token: 0x06000AFC RID: 2812 RVA: 0x00023724 File Offset: 0x00021924 internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { TaskLogger.LogEnter(); if (session == null) { throw new ArgumentNullException("session"); } if (!(session is IConfigurationSession)) { throw new ArgumentException(Strings.ErrorInvalidType(session.GetType().Name), "session"); } if (((typeof(T) == typeof(ADOrganizationalUnit) && session.UseConfigNC) || (typeof(T) == typeof(ExchangeConfigurationUnit) && !session.UseConfigNC)) && !Environment.StackTrace.Contains("Microsoft.Exchange.Management.Deployment.OrganizationTaskHelper.GetExchangeConfigUnitFromOrganizationId")) { throw new ArgumentException("Session is using the wrong Naming Context for the desired search"); } notFoundReason = null; EnumerableWrapper <T> result = EnumerableWrapper <T> .Empty; if (base.IsMultitenancyEnabled()) { if (this.IsWildcardDefined(base.RawIdentity)) { if (null == this.AccountPartition) { notFoundReason = new LocalizedString?(Strings.ErrorOrganizationWildcard); return(result); } IEnumerable <ExchangeConfigurationUnit> configurationUnits = this.GetConfigurationUnits((IConfigurationSession)session, base.RawIdentity); return(EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) configurationUnits, this.GetEnumerableFilter <T>())); } else { OrganizationId organizationId = this.ResolveOrganizationId(session.SessionSettings.CurrentOrganizationId); if (!OrganizationId.ForestWideOrgId.Equals(organizationId)) { ADSessionSettings adsessionSettings = ADSessionSettings.FromCustomScopeSet(ScopeSet.ResolveUnderScope(organizationId, session.SessionSettings.ScopeSet), session.SessionSettings.RootOrgId, organizationId, session.SessionSettings.ExecutingUserOrganizationId, true); adsessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants; bool flag = TaskHelper.ShouldPassDomainControllerToSession(session.DomainController, adsessionSettings); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(flag ? session.DomainController : null, session.ReadOnly, session.ConsistencyMode, flag ? session.NetworkCredential : null, adsessionSettings, 314, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\organizationidparameter.cs"); tenantConfigurationSession.UseConfigNC = session.UseConfigNC; tenantConfigurationSession.UseGlobalCatalog = session.UseGlobalCatalog; if (typeof(ExchangeConfigurationUnit) == typeof(T) && organizationId.ConfigurationUnit != null) { List <ExchangeConfigurationUnit> list = new List <ExchangeConfigurationUnit>(); ExchangeConfigurationUnit exchangeConfigurationUnit = tenantConfigurationSession.Read <ExchangeConfigurationUnit>(organizationId.ConfigurationUnit); if (exchangeConfigurationUnit != null) { list.Add(exchangeConfigurationUnit); result = EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) list, this.GetEnumerableFilter <T>()); } } else if (organizationId.OrganizationalUnit != null) { List <ADOrganizationalUnit> list2 = new List <ADOrganizationalUnit>(); ADOrganizationalUnit adorganizationalUnit = tenantConfigurationSession.Read <ADOrganizationalUnit>(organizationId.OrganizationalUnit); if (adorganizationalUnit != null) { list2.Add(adorganizationalUnit); result = EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) list2, this.GetEnumerableFilter <T>()); } } } } } TaskLogger.LogExit(); return(result); }
// Token: 0x06000C7A RID: 3194 RVA: 0x00027404 File Offset: 0x00025604 internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { TaskLogger.LogEnter(); if (session == null) { throw new ArgumentNullException("session"); } if (!(session is IConfigurationSession)) { throw new ArgumentException(Strings.ErrorInvalidType(session.GetType().Name), "type"); } notFoundReason = null; EnumerableWrapper <T> result = EnumerableWrapper <T> .Empty; if (this.IsWildcardDefined(base.RawIdentity)) { notFoundReason = new LocalizedString?(Strings.ErrorOrganizationWildcard); return(result); } OrganizationId organizationId = this.ResolveOrganizationId(); if (!OrganizationId.ForestWideOrgId.Equals(organizationId)) { ADSessionSettings adsessionSettings = ADSessionSettings.FromCustomScopeSet(ScopeSet.ResolveUnderScope(organizationId, session.SessionSettings.ScopeSet), session.SessionSettings.RootOrgId, organizationId, session.SessionSettings.ExecutingUserOrganizationId, false); adsessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants; ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(session.DomainController, session.ReadOnly, session.ConsistencyMode, session.NetworkCredential, adsessionSettings, 257, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\TenantRelocationRequestIdParameter.cs"); tenantConfigurationSession.UseConfigNC = session.UseConfigNC; tenantConfigurationSession.UseGlobalCatalog = session.UseGlobalCatalog; if (typeof(TenantRelocationRequest).Equals(typeof(T)) && organizationId.ConfigurationUnit != null) { List <TenantRelocationRequest> list = new List <TenantRelocationRequest>(); TenantRelocationRequest[] array = tenantConfigurationSession.Find <TenantRelocationRequest>(organizationId.ConfigurationUnit, QueryScope.SubTree, TenantRelocationRequest.TenantRelocationRequestFilter, null, 1); if (array != null && array.Length > 0) { list.Add(array[0]); result = EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) list, this.GetEnumerableFilter <T>()); } } } TaskLogger.LogExit(); return(result); }