Ejemplo n.º 1
0
        public CountryListKey(string countryListName)
        {
            if (string.IsNullOrEmpty(countryListName))
            {
                throw new ArgumentNullException("countryListName");
            }
            ADObjectId rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();

            this.Key            = rootOrgContainerIdForLocalForest.GetDescendantId(CountryList.RdnContainer.GetChildId(countryListName.ToLower()));
            this.cachedHashCode = this.Key.DistinguishedName.ToLower().GetHashCode();
        }
Ejemplo n.º 2
0
 public ADObjectId GetOrgContainerId()
 {
     if (this.orgContainerId != null)
     {
         return(this.orgContainerId);
     }
     if (Globals.IsDatacenter && (base.SessionSettings.ConfigReadScope == null || base.SessionSettings.ConfigReadScope.Root == null))
     {
         this.orgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(base.SessionSettings.GetAccountOrResourceForestFqdn(), base.DomainController, base.NetworkCredential);
     }
     if (this.orgContainerId == null)
     {
         Organization orgContainer = this.GetOrgContainer();
         this.orgContainerId = orgContainer.Id;
     }
     return(this.orgContainerId);
 }
Ejemplo n.º 3
0
        internal static ADObjectId GetRootOrgContainerId(string partitionFqdn, string domainController, NetworkCredential credential)
        {
            ArgumentValidator.ThrowIfNullOrEmpty("partitionFqdn", partitionFqdn);
            ADObjectId rootOrgContainerId = InternalDirectoryRootOrganizationCache.GetRootOrgContainerId(partitionFqdn);

            if (rootOrgContainerId != null)
            {
                return(rootOrgContainerId);
            }
            Organization rootOrgContainer = ADSystemConfigurationSession.GetRootOrgContainer(partitionFqdn, domainController, credential);

            if (rootOrgContainer == null)
            {
                return(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest());
            }
            return(rootOrgContainer.Id);
        }
Ejemplo n.º 4
0
        public Organization GetOrgContainer()
        {
            ADObjectId adobjectId = null;

            if (base.SessionSettings.ConfigReadScope != null)
            {
                adobjectId = base.SessionSettings.ConfigReadScope.Root;
            }
            Organization[] array;
            if (adobjectId == null)
            {
                if (Globals.IsDatacenter)
                {
                    Organization organization = (Organization)ADSystemConfigurationSession.GetRootOrgContainer(base.SessionSettings.GetAccountOrResourceForestFqdn(), base.DomainController, base.NetworkCredential).Clone();
                    organization.SetIsReadOnly(false);
                    organization.m_Session = this;
                    return(organization);
                }
                array = base.Find <Organization>(null, QueryScope.SubTree, null, null, 2);
            }
            else if (adobjectId.Parent.Parent.Equals(ADSession.GetConfigurationUnitsRoot(base.SessionSettings.GetAccountOrResourceForestFqdn())))
            {
                array = base.Find <ExchangeConfigurationUnit>(adobjectId, QueryScope.Base, null, null, 1);
            }
            else
            {
                array = base.Find <ExchangeConfigurationUnit>(adobjectId, QueryScope.SubTree, null, null, 2);
            }
            if (array == null || array.Length == 0)
            {
                if (adobjectId == null)
                {
                    throw new OrgContainerNotFoundException();
                }
                throw new TenantOrgContainerNotFoundException(adobjectId.ToString());
            }
            else
            {
                if (array.Length > 1)
                {
                    throw new OrgContainerAmbiguousException();
                }
                return(array[0]);
            }
        }
Ejemplo n.º 5
0
        protected override CountryList CreateOnCacheMiss(CountryListKey key, ref bool shouldAdd)
        {
            CountryList countryList = null;

            if (null != key)
            {
                ADObjectId            rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
                ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, OrganizationId.ForestWideOrgId, OrganizationId.ForestWideOrgId, false);
                IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.FullyConsistent, sessionSettings, 145, "CreateOnCacheMiss", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\CountryListIdCache.cs");
                countryList = tenantOrTopologyConfigurationSession.Read <CountryList>(key.Key);
                if (countryList == null)
                {
                    Globals.LogEvent(DirectoryEventLogConstants.Tuple_UMCountryListNotFound, key.ToString(), new object[]
                    {
                        key
                    });
                }
            }
            return(countryList);
        }
Ejemplo n.º 6
0
        internal AddressBookBase GetDefaultGlobalAddressList()
        {
            MultiValuedProperty <ADObjectId> defaultGlobalAddressList = this.DefaultGlobalAddressList;
            AddressBookBase result     = null;
            ADObjectId      adobjectId = null;

            foreach (ADObjectId adobjectId2 in defaultGlobalAddressList)
            {
                adobjectId = adobjectId2;
                if (adobjectId2.IsDescendantOf(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest()))
                {
                    break;
                }
            }
            if (adobjectId != null)
            {
                result = base.Session.Read <AddressBookBase>(adobjectId);
            }
            return(result);
        }
        private static OrganizationContentConversionProperties GetOrganizationContentConversionPropertiesFromAD(OrganizationId organizationId)
        {
            OrganizationContentConversionProperties organizationContentConversionProperties = new OrganizationContentConversionProperties();

            if (organizationId == null)
            {
                organizationId = OrganizationId.ForestWideOrgId;
            }
            ADObjectId            rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, organizationId, organizationId, false);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 147, "GetOrganizationContentConversionPropertiesFromAD", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\OrganizationContentConversionCache.cs");
            ADObjectId            entryId;

            if (organizationId == OrganizationId.ForestWideOrgId)
            {
                Organization orgContainer = tenantOrTopologyConfigurationSession.GetOrgContainer();
                entryId = orgContainer.Id;
            }
            else
            {
                entryId = organizationId.ConfigurationUnit;
            }
            ADRawEntry adrawEntry = tenantOrTopologyConfigurationSession.ReadADRawEntry(entryId, OrganizationContentConversionCache.orgProperties);

            if (adrawEntry == null)
            {
                OrganizationContentConversionCache.Tracer.TraceError <OrganizationId>(0L, "CU for the org '{0}' is not found in AD!", organizationId);
                organizationContentConversionProperties.ValidOrganization = false;
            }
            else
            {
                OrganizationContentConversionCache.Tracer.TraceDebug <OrganizationId>(0L, "CU for '{0}' located in AD.", organizationId);
                organizationContentConversionProperties.ValidOrganization = true;
                organizationContentConversionProperties.PreferredInternetCodePageForShiftJis = Organization.MapIntToPreferredInternetCodePageForShiftJis((int)adrawEntry[OrganizationSchema.PreferredInternetCodePageForShiftJis]);
                organizationContentConversionProperties.RequiredCharsetCoverage        = (int)adrawEntry[OrganizationSchema.RequiredCharsetCoverage];
                organizationContentConversionProperties.ByteEncoderTypeFor7BitCharsets = (int)adrawEntry[OrganizationSchema.ByteEncoderTypeFor7BitCharsets];
            }
            return(organizationContentConversionProperties);
        }
        public OrganizationIdCacheValue(OrganizationId organizationId)
        {
            if (organizationId == null)
            {
                organizationId = OrganizationId.ForestWideOrgId;
            }
            ADObjectId            rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, organizationId, organizationId, false);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.FullyConsistent, sessionSettings, 53, ".ctor", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\OrganizationIdCacheValue.cs");
            ADSessionSettings     adsessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, organizationId, organizationId, false);

            adsessionSettings.IsSharedConfigChecked = true;
            IConfigurationSession tenantOrTopologyConfigurationSession2 = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.FullyConsistent, adsessionSettings, 68, ".ctor", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\OrganizationIdCacheValue.cs");
            IRecipientSession     tenantOrRootOrgRecipientSession       = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, adsessionSettings, 72, ".ctor", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\ConfigurationCache\\OrganizationIdCacheValue.cs");

            this.organizationId = organizationId;
            this.federatedOrganizationIdCache = new OrganizationFederatedOrganizationIdCache(organizationId, tenantOrTopologyConfigurationSession2);
            this.federatedDomainsCache        = new OrganizationFederatedDomainsCache(organizationId, this.federatedOrganizationIdCache, tenantOrTopologyConfigurationSession);
            this.acceptedDomainsCache         = new OrganizationAcceptedDomainsCache(organizationId, tenantOrTopologyConfigurationSession);
            this.organizationRelationshipNonAdPropertiesCache = new OrganizationOrganizationRelationshipCache(organizationId, tenantOrTopologyConfigurationSession);
            this.availabilityConfigCache         = new OrganizationAvailabilityConfigCache(organizationId, tenantOrTopologyConfigurationSession, tenantOrRootOrgRecipientSession);
            this.availabilityAddressSpaceCache   = new OrganizationAvailabilityAddressSpaceCache(organizationId, tenantOrTopologyConfigurationSession);
            this.intraOrganizationConnectorCache = new OrganizationIntraOrganizationConnectorCache(organizationId, tenantOrTopologyConfigurationSession);
        }
Ejemplo n.º 9
0
 internal static ADObjectId GetRootOrgContainerId(string domainController, NetworkCredential credential)
 {
     return(ADSystemConfigurationSession.GetRootOrgContainerId(TopologyProvider.LocalForestFqdn, domainController, credential));
 }
Ejemplo n.º 10
0
 internal static ADObjectId GetRootOrgContainerIdForLocalForest()
 {
     return(ADSystemConfigurationSession.GetRootOrgContainerId(TopologyProvider.LocalForestFqdn, null, null));
 }
Ejemplo n.º 11
0
        internal override bool CheckForAssociatedUsers()
        {
            ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.OrganizationId, null, false);
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 2539, "CheckForAssociatedUsers", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\OwaMailboxPolicy.cs");
            QueryFilter       filter = new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.OwaMailboxPolicy, base.Id);

            ADUser[] array = tenantOrRootOrgRecipientSession.FindADUser(null, QueryScope.SubTree, filter, null, 1);
            return(array != null && array.Length > 0);
        }