protected override IEnumerable <OutlookProtectionRule> Read(IConfigurationSession session)
        {
            ADPagedReader <TransportRule> adpagedReader = session.FindPaged <TransportRule>(PerTenantProtectionRulesCollection.GetProtectionRuleContainerId(session), QueryScope.SubTree, null, PerTenantProtectionRulesCollection.PriorityOrder, 0);

            TransportRule[] array                 = adpagedReader.ReadAllPages();
            List <OutlookProtectionRule> list     = new List <OutlookProtectionRule>(array.Length);
            OutlookProtectionRuleParser  instance = OutlookProtectionRuleParser.Instance;

            foreach (TransportRule transportRule in array)
            {
                try
                {
                    list.Add((OutlookProtectionRule)instance.GetRule(transportRule.Xml));
                }
                catch (ParserException ex)
                {
                    PerTenantProtectionRulesCollection.Tracer.TraceError <ADObjectId, Exception>((long)this.GetHashCode(), "Rule with identity {0} is corrupted and will not be returned to clients.  Details: {1}", transportRule.Id, ex);
                    CachedOrganizationConfiguration.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_CorruptOutlookProtectionRule, transportRule.Id.ToString(), new object[]
                    {
                        transportRule.Id,
                        ex
                    });
                }
            }
            return(list);
        }
        protected override IEnumerable <ClassificationRulePackage> Read(IConfigurationSession session)
        {
            ADPagedReader <TransportRule> adpagedReader = session.FindPaged <TransportRule>(PerTenantClassificationDefinitionCollection.GetClassificationDefinitionsContainerId(session), QueryScope.SubTree, null, PerTenantClassificationDefinitionCollection.PriorityOrder, 0);

            TransportRule[]      source = adpagedReader.ReadAllPages();
            ClassificationParser parser = ClassificationParser.Instance;

            return((from rule in source.Select(delegate(TransportRule adRule)
            {
                try
                {
                    ClassificationRulePackage rulePackage = parser.GetRulePackage(adRule.ReplicationSignature);
                    rulePackage.Version = (adRule.WhenChangedUTC ?? (adRule.WhenCreatedUTC ?? DateTime.MinValue));
                    rulePackage.ID = adRule.Name;
                    return rulePackage;
                }
                catch (ParserException ex)
                {
                    PerTenantClassificationDefinitionCollection.Tracer.TraceError <ADObjectId, Exception>((long)this.GetHashCode(), "Rule with identity {0} is corrupted and will not be returned to clients.  Details: {1}", adRule.Id, ex);
                    CachedOrganizationConfiguration.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_CorruptClassificationDefinition, adRule.Id.ToString(), new object[]
                    {
                        adRule.Id,
                        ex
                    });
                }
                return null;
            })
                    where rule != null
                    select rule).ToList <ClassificationRulePackage>());
        }
        // Token: 0x060009CA RID: 2506 RVA: 0x0002121C File Offset: 0x0001F41C
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            if (typeof(T) != typeof(ExtendedRight))
            {
                throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type");
            }
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (ExtendedRightIdParameter.AllExtendedRights == null)
            {
                ADPagedReader <ExtendedRight> adpagedReader = ((ITopologyConfigurationSession)session).GetAllExtendedRights();
                ExtendedRightIdParameter.allExtendedRights = adpagedReader.ReadAllPages();
            }
            base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason);
            List <T> list = new List <T>();

            foreach (ExtendedRight extendedRight in ExtendedRightIdParameter.AllExtendedRights)
            {
                if (ADObjectId.Equals(extendedRight.Id, base.InternalADObjectId) || (base.InternalADObjectId != null && base.InternalADObjectId.ObjectGuid == extendedRight.RightsGuid) || (base.RawIdentity != null && (string.Compare(extendedRight.DisplayName, base.RawIdentity, StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(extendedRight.Name, base.RawIdentity, StringComparison.OrdinalIgnoreCase) == 0)))
                {
                    list.Add((T)((object)extendedRight));
                    break;
                }
            }
            return(list);
        }
示例#4
0
 // Token: 0x0600075B RID: 1883 RVA: 0x0002B236 File Offset: 0x00029436
 public ClientAccessArray[] GetClientAccessArrays()
 {
     ClientAccessArray[] arrays = null;
     ADNotificationAdapter.TryRunADOperation(delegate()
     {
         ADPagedReader <ClientAccessArray> adpagedReader = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(2, ADSessionSettings.FromRootOrgScopeSet(), 50, "GetClientAccessArrays", "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RpcHttp\\Directory.cs").FindPaged <ClientAccessArray>(null, 2, ClientAccessArray.PriorTo15ExchangeObjectVersionFilter, null, 0, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RpcHttp\\Directory.cs", 53, "GetClientAccessArrays");
         arrays = adpagedReader.ReadAllPages();
     });
     return(arrays);
 }
示例#5
0
 // Token: 0x0600075C RID: 1884 RVA: 0x0002B25B File Offset: 0x0002945B
 public Server[] GetServers()
 {
     Server[] servers = null;
     ADNotificationAdapter.TryRunADOperation(delegate()
     {
         ADPagedReader <Server> adpagedReader = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(2, ADSessionSettings.FromRootOrgScopeSet(), 70, "GetServers", "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RpcHttp\\Directory.cs").FindPaged <Server>(null, 2, null, null, 0, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RpcHttp\\Directory.cs", 73, "GetServers");
         servers = adpagedReader.ReadAllPages();
     });
     return(servers);
 }
示例#6
0
 public ADSite[] GetADSites()
 {
     ADSite[] sites = null;
     ADNotificationAdapter.TryRunADOperation(delegate()
     {
         ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 30, "GetADSites", "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RpcHttp\\Directory.cs");
         ADPagedReader <ADSite> adpagedReader = topologyConfigurationSession.FindPaged <ADSite>(null, QueryScope.SubTree, null, null, 0);
         sites = adpagedReader.ReadAllPages();
     });
     return(sites);
 }
示例#7
0
 public ClientAccessArray[] GetClientAccessArrays()
 {
     ClientAccessArray[] arrays = null;
     ADNotificationAdapter.TryRunADOperation(delegate()
     {
         ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 50, "GetClientAccessArrays", "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RpcHttp\\Directory.cs");
         ADPagedReader <ClientAccessArray> adpagedReader            = topologyConfigurationSession.FindPaged <ClientAccessArray>(null, QueryScope.SubTree, ClientAccessArray.PriorTo15ExchangeObjectVersionFilter, null, 0);
         arrays = adpagedReader.ReadAllPages();
     });
     return(arrays);
 }
示例#8
0
        internal static object[][] GetDirectReportsView(IRecipientSession adSession, IADOrgPerson person, params PropertyDefinition[] returnProperties)
        {
            if (returnProperties == null)
            {
                throw new ArgumentNullException("returnProperties");
            }
            QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADOrgPersonSchema.Manager, person.Id);
            ADPagedReader <ADRawEntry> adpagedReader = adSession.FindPagedADRawEntry(adSession.SearchRoot, QueryScope.SubTree, filter, null, 0, returnProperties);

            ADRawEntry[] recipients = adpagedReader.ReadAllPages();
            return(ADSession.ConvertToView(recipients, returnProperties));
        }
示例#9
0
        protected override PerTenantPolicyNudgeRulesCollection.PolicyNudgeRules Read(IConfigurationSession session)
        {
            ADPagedReader <PolicyTipMessageConfig> adpagedReader           = session.FindPaged <PolicyTipMessageConfig>(PerTenantPolicyNudgeRulesCollection.GetPolicyTipMessageConfigsContainerId(session), QueryScope.SubTree, null, null, 0);
            IEnumerable <PolicyTipMessageConfig>   tenantPolicyTipMessages = adpagedReader.ReadAllPages();
            ADPagedReader <TransportRule>          adpagedReader2          = session.FindPaged <TransportRule>(PerTenantPolicyNudgeRulesCollection.GetPolicyNudgeRuleContainerId(session), QueryScope.SubTree, null, PerTenantPolicyNudgeRulesCollection.PriorityOrder, 0);
            PolicyNudgeRuleParser         parser = PolicyNudgeRuleParser.Instance;
            IEnumerable <PolicyNudgeRule> tenantPolicyNudgeRules = (from rule in adpagedReader2.ReadAllPages()
                                                                    select parser.GetRule(rule.Xml, rule.Name, rule.WhenChangedUTC ?? (rule.WhenCreatedUTC ?? DateTime.MinValue)) into rule
                                                                    where rule != null
                                                                    select rule).ToList <PolicyNudgeRule>();

            return(new PerTenantPolicyNudgeRulesCollection.PolicyNudgeRules(tenantPolicyNudgeRules, new PerTenantPolicyNudgeRulesCollection.PolicyTipMessages(tenantPolicyTipMessages)));
        }
示例#10
0
        // Token: 0x060006E2 RID: 1762 RVA: 0x00014A2C File Offset: 0x00012C2C
        public override void ReadData(IConfigurationSession session)
        {
            ADPagedReader <AcceptedDomain> adpagedReader = session.FindAllPaged <AcceptedDomain>();

            AcceptedDomain[]      source = adpagedReader.ReadAllPages();
            AcceptedDomainEntry[] array  = (from domain in source
                                            select new AcceptedDomainEntry(domain, base.OrganizationId)).ToArray <AcceptedDomainEntry>();
            this.acceptedDomainMap = new AcceptedDomainMap(array);
            int num = 0;

            foreach (AcceptedDomainEntry acceptedDomainEntry in array)
            {
                num += acceptedDomainEntry.EstimatedSize;
            }
            this.estimatedAcceptedDomainEntryArraySize = (long)num;
        }
        public override void ReadData(IConfigurationSession session)
        {
            ADPagedReader <DomainContentConfig> adpagedReader = session.FindAllPaged <DomainContentConfig>();

            DomainContentConfig[] source = adpagedReader.ReadAllPages();
            RemoteDomainEntry[]   array  = (from domain in source
                                            select new RemoteDomainEntry(domain)).ToArray <RemoteDomainEntry>();
            this.remoteDomainMap = new RemoteDomainMap(array);
            int num = 0;

            foreach (RemoteDomainEntry remoteDomainEntry in array)
            {
                num += remoteDomainEntry.EstimateSize;
            }
            this.estimatedRemoteDomainEntryArraySize = (long)num;
        }
        // Token: 0x060014B0 RID: 5296 RVA: 0x00049794 File Offset: 0x00047994
        public override void ReadData(IConfigurationSession session)
        {
            ADPagedReader <PolicyTipMessageConfig> adpagedReader = session.FindPaged <PolicyTipMessageConfig>(session.GetOrgContainerId().GetDescendantId(PolicyTipMessageConfig.PolicyTipMessageConfigContainer), QueryScope.SubTree, null, null, 0);
            IEnumerable <PolicyTipMessageConfig>   source        = adpagedReader.ReadAllPages();

            this.tenantPolicyTipMessageConfigsDictionary = source.ToDictionary((PolicyTipMessageConfig m) => Tuple.Create <string, PolicyTipMessageConfigAction>(m.Locale, m.Action), (PolicyTipMessageConfig m) => m.Value);
            long num = 0L;

            foreach (KeyValuePair <Tuple <string, PolicyTipMessageConfigAction>, string> keyValuePair in this.tenantPolicyTipMessageConfigsDictionary)
            {
                Tuple <string, PolicyTipMessageConfigAction> key = keyValuePair.Key;
                num += (long)key.Item1.Length;
                num += 4L;
                num += (long)keyValuePair.Value.Length;
            }
            this.estimatedTenantPolicyTipMessageConfigsDictionarySize = num;
        }
示例#13
0
        internal static LocalizedException ValidateFQDNInTenantAcceptedDomain(UMIPGateway gateway, IConfigurationSession session)
        {
            if (!CommonConstants.UseDataCenterCallRouting)
            {
                return(null);
            }
            if (gateway == null || gateway.Address == null)
            {
                throw new ArgumentNullException("gateway");
            }
            if (gateway.GlobalCallRoutingScheme == UMGlobalCallRoutingScheme.E164)
            {
                return(null);
            }
            string      text   = gateway.Address.ToString();
            QueryFilter filter = new NotFilter(new BitMaskAndFilter(AcceptedDomainSchema.AcceptedDomainFlags, 1UL));
            ADPagedReader <AcceptedDomain> adpagedReader = session.FindPaged <AcceptedDomain>(session.GetOrgContainerId(), QueryScope.SubTree, filter, null, 0);

            AcceptedDomain[] array = adpagedReader.ReadAllPages();
            bool             flag  = false;

            foreach (AcceptedDomain acceptedDomain in array)
            {
                string domain = acceptedDomain.DomainName.Domain;
                if (text.EndsWith(domain, StringComparison.OrdinalIgnoreCase))
                {
                    string text2 = text.Substring(0, text.Length - domain.Length);
                    if (text2.Length == 0)
                    {
                        flag = true;
                        break;
                    }
                    int num = text2.IndexOf('.');
                    if (num == text2.Length - 1)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                return(new GatewayFqdnNotInAcceptedDomainException());
            }
            return(null);
        }
示例#14
0
        internal static void AdjustPriorities(IConfigurationSession session, TDataObject newProvider, bool providerAlreadyExists)
        {
            ADPagedReader <TDataObject> adpagedReader = session.FindAllPaged <TDataObject>();

            TDataObject[] array = adpagedReader.ReadAllPages();
            int           num   = int.MaxValue;

            if (providerAlreadyExists)
            {
                foreach (TDataObject tdataObject in array)
                {
                    if (tdataObject.Id.ObjectGuid.Equals(newProvider.Id.ObjectGuid))
                    {
                        num = tdataObject.Priority;
                        break;
                    }
                }
            }
            int num2 = 0;

            foreach (TDataObject tdataObject2 in array)
            {
                if (tdataObject2.Priority > num2)
                {
                    num2 = tdataObject2.Priority;
                }
                if (tdataObject2.Priority >= newProvider.Priority && tdataObject2.Priority < num)
                {
                    tdataObject2.Priority++;
                    session.Save(tdataObject2);
                }
                else if (tdataObject2.Priority <= newProvider.Priority && tdataObject2.Priority > num)
                {
                    tdataObject2.Priority--;
                    session.Save(tdataObject2);
                }
            }
            if (num2 < newProvider.Priority)
            {
                newProvider.Priority = (providerAlreadyExists ? num2 : (num2 + 1));
            }
        }
        // Token: 0x060012F6 RID: 4854 RVA: 0x0003E1EC File Offset: 0x0003C3EC
        internal static IEnumerable <SmtpDomainWithSubdomains> GetAcceptedDomains(OrganizationId organizationId, OrganizationId executingOrganizationId)
        {
            ProvisioningCache provisioningCache = ProvisioningCache.Instance;

            return(provisioningCache.TryAddAndGetOrganizationData <IEnumerable <SmtpDomainWithSubdomains> >(CannedProvisioningCacheKeys.OrganizationAcceptedDomains, organizationId, delegate()
            {
                ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), organizationId, executingOrganizationId, false);
                IConfigurationSession cfgSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 245, "GetAcceptedDomains", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\rbac\\AuthZPluginHelper.cs");
                ADObjectId rootId = organizationId.ConfigurationUnit ?? provisioningCache.TryAddAndGetGlobalData <ADObjectId>(CannedProvisioningCacheKeys.FirstOrgContainerId, () => cfgSession.GetOrgContainerId());
                QueryFilter filter = new NotFilter(new BitMaskAndFilter(AcceptedDomainSchema.AcceptedDomainFlags, 1UL));
                ADPagedReader <AcceptedDomain> adpagedReader = cfgSession.FindPaged <AcceptedDomain>(rootId, QueryScope.SubTree, filter, null, 0);
                AcceptedDomain[] array = adpagedReader.ReadAllPages();
                SmtpDomainWithSubdomains[] array2 = new SmtpDomainWithSubdomains[array.Length];
                for (int i = 0; i < array2.Length; i++)
                {
                    array2[i] = array[i].DomainName;
                }
                return array2;
            }));
        }
示例#16
0
        private void FetchDatabases(ITopologyConfigurationSession topologyConfigSession, DatabaseAvailabilityGroup dag, Server localServer, out List <MailboxDatabase> localDatabases, out List <MailboxDatabase> remoteDatabases)
        {
            QueryFilter queryFilter;

            if (this.IsWarmupCall())
            {
                dag         = null;
                queryFilter = new ComparisonFilter(ComparisonOperator.Equal, DatabaseSchema.Server, localServer.Id);
            }
            else
            {
                queryFilter = new AndFilter(new QueryFilter[]
                {
                    new ComparisonFilter(ComparisonOperator.Equal, MailboxDatabaseSchema.IsExcludedFromProvisioning, false),
                    new ComparisonFilter(ComparisonOperator.Equal, MailboxDatabaseSchema.IsExcludedFromInitialProvisioning, false),
                    new ComparisonFilter(ComparisonOperator.Equal, MailboxDatabaseSchema.IsExcludedFromProvisioningBySpaceMonitoring, false)
                });
                if (dag != null)
                {
                    queryFilter = new AndFilter(new QueryFilter[]
                    {
                        queryFilter,
                        new ComparisonFilter(ComparisonOperator.Equal, DatabaseSchema.MasterServerOrAvailabilityGroup, dag.Id)
                    });
                }
                else
                {
                    queryFilter = new AndFilter(new QueryFilter[]
                    {
                        queryFilter,
                        new ComparisonFilter(ComparisonOperator.Equal, DatabaseSchema.Server, localServer.Id)
                    });
                }
            }
            this.stopWatch.Restart();
            ADPagedReader <MailboxDatabase> adpagedReader = topologyConfigSession.FindPaged <MailboxDatabase>(null, QueryScope.SubTree, queryFilter, null, 0);
            List <MailboxDatabase>          list          = new List <MailboxDatabase>(adpagedReader.ReadAllPages());

            this.WriteDebugInfo("Found {0} databases on {1}. Time took:{2} sec", new object[]
            {
                list.Count,
                (dag != null) ? dag.Name : localServer.Name,
                this.stopWatch.Elapsed.TotalSeconds.ToString("n2")
            });
            if (list.Count == 0)
            {
                dag = null;
                MailboxDatabase executingUserDatabase = this.GetExecutingUserDatabase(topologyConfigSession);
                if (executingUserDatabase != null)
                {
                    list.Add(executingUserDatabase);
                }
                else
                {
                    this.WriteError(new GroupMailboxFailedToFindDatabaseException(Strings.ErrorDatabaseUnavailableForProvisioning), ExchangeErrorCategory.ServerTransient, null, true);
                }
            }
            if (dag != null)
            {
                localDatabases  = new List <MailboxDatabase>(10);
                remoteDatabases = new List <MailboxDatabase>(list.Count);
                foreach (MailboxDatabase mailboxDatabase in list)
                {
                    if (localServer.Name.Equals(mailboxDatabase.ServerName, StringComparison.OrdinalIgnoreCase))
                    {
                        localDatabases.Add(mailboxDatabase);
                    }
                    else
                    {
                        remoteDatabases.Add(mailboxDatabase);
                    }
                }
                if (localDatabases.Count == 0)
                {
                    this.WriteDebugInfo("No local database found", new object[0]);
                    return;
                }
            }
            else
            {
                localDatabases  = list;
                remoteDatabases = new List <MailboxDatabase>(0);
            }
        }
        protected override AcceptedDomain[] Read(IConfigurationSession session)
        {
            ADPagedReader <AcceptedDomain> adpagedReader = session.FindAllPaged <AcceptedDomain>();

            return(adpagedReader.ReadAllPages());
        }
示例#18
0
        private void InternalRefresh()
        {
            Exception ex = null;

            Server[] array = null;
            try
            {
                ITopologyConfigurationSession configurationSession = DirectoryHelper.GetConfigurationSession();
                ADPagedReader <Server>        adpagedReader        = configurationSession.FindPaged <Server>(null, QueryScope.SubTree, DownLevelServerManager.ServerVersionFilter, null, 0);
                array = adpagedReader.ReadAllPages();
            }
            catch (ADTransientException ex2)
            {
                ex = ex2;
            }
            catch (DataValidationException ex3)
            {
                ex = ex3;
            }
            catch (DataSourceOperationException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                ExTraceGlobals.VerboseTracer.TraceError <Exception>((long)this.GetHashCode(), "[DownLevelServerManager::RefreshServerMap]: Active Directory exception: {0}", ex);
                Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_ErrorRefreshDownLevelServerMap, null, new object[]
                {
                    HttpProxyGlobals.ProtocolType.ToString(),
                    ex.ToString()
                });
                return;
            }
            Dictionary <string, List <DownLevelServerStatusEntry> > downLevelServerMap = this.GetDownLevelServerMap();
            Dictionary <string, List <DownLevelServerStatusEntry> > dictionary         = new Dictionary <string, List <DownLevelServerStatusEntry> >(downLevelServerMap.Count, StringComparer.OrdinalIgnoreCase);

            Server[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                Server server = array2[i];
                if ((server.CurrentServerRole & ServerRole.ClientAccess) > ServerRole.None && server.ServerSite != null)
                {
                    List <DownLevelServerStatusEntry> list = null;
                    if (!dictionary.TryGetValue(server.ServerSite.DistinguishedName, out list))
                    {
                        list = new List <DownLevelServerStatusEntry>();
                        dictionary.Add(server.ServerSite.DistinguishedName, list);
                    }
                    DownLevelServerStatusEntry        downLevelServerStatusEntry = null;
                    List <DownLevelServerStatusEntry> list2 = null;
                    if (downLevelServerMap.TryGetValue(server.ServerSite.DistinguishedName, out list2))
                    {
                        downLevelServerStatusEntry = list2.Find((DownLevelServerStatusEntry x) => x.BackEndServer.Fqdn.Equals(server.Fqdn, StringComparison.OrdinalIgnoreCase));
                    }
                    if (downLevelServerStatusEntry == null)
                    {
                        downLevelServerStatusEntry = new DownLevelServerStatusEntry
                        {
                            BackEndServer = new BackEndServer(server.Fqdn, server.VersionNumber),
                            IsHealthy     = true
                        };
                    }
                    list.Add(downLevelServerStatusEntry);
                    list.Sort((DownLevelServerStatusEntry x, DownLevelServerStatusEntry y) => x.BackEndServer.Fqdn.CompareTo(y.BackEndServer.Fqdn));
                }
            }
            this.downLevelServers = dictionary;
            if (dictionary.Count > 0 && DownLevelServerManager.DownLevelServerPingEnabled.Value && this.pingManager == null)
            {
                this.pingManager = new DownLevelServerPingManager(new Func <Dictionary <string, List <DownLevelServerStatusEntry> > >(this.GetDownLevelServerMap));
            }
        }
        protected override DomainContentConfig[] Read(IConfigurationSession session)
        {
            ADPagedReader <DomainContentConfig> adpagedReader = session.FindAllPaged <DomainContentConfig>();

            return(adpagedReader.ReadAllPages());
        }
示例#20
0
 internal static int PreparePriorityOfEapObjects(OrganizationId organizationId, EmailAddressPolicy policy, IConfigDataProvider session, TaskExtendedErrorLoggingDelegate writeError, out EmailAddressPolicy[] policiesAdjusted, out EmailAddressPolicyPriority[] originalPriorities)
 {
     policiesAdjusted   = null;
     originalPriorities = null;
     try
     {
         QueryFilter queryFilter = new AndFilter(new QueryFilter[]
         {
             new ComparisonFilter(ComparisonOperator.LessThan, EmailAddressPolicySchema.Priority, EmailAddressPolicyPriority.Lowest),
             new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, EmailAddressPolicySchema.Priority, EmailAddressPolicyPriority.Highest)
         });
         if (policy.ObjectState != ObjectState.New)
         {
             queryFilter = new AndFilter(new QueryFilter[]
             {
                 queryFilter,
                 new ComparisonFilter(ComparisonOperator.NotEqual, ADObjectSchema.Id, new ADObjectId(null, policy.Guid))
             });
         }
         IConfigurationSession configurationSession       = (IConfigurationSession)session;
         ADPagedReader <EmailAddressPolicy> adpagedReader = configurationSession.FindPaged <EmailAddressPolicy>(EmailAddressPolicyIdParameter.GetRootContainerId(configurationSession, organizationId), QueryScope.OneLevel, queryFilter, new SortBy(EmailAddressPolicySchema.Priority, SortOrder.Ascending), 0);
         EmailAddressPolicy[] array = adpagedReader.ReadAllPages();
         Array.Sort <EmailAddressPolicy>(array, EmailAddressPolicy.PriorityComparer);
         if (policy.Priority != EmailAddressPolicyPriority.Lowest)
         {
             if (policy.ObjectState == ObjectState.New)
             {
                 if ((array.Length == 0 && policy.Priority != EmailAddressPolicyPriority.Highest) || (array.Length > 0 && policy.Priority > 1 + array[array.Length - 1].Priority))
                 {
                     writeError(new ArgumentException(Strings.ErrorInvalidEapNewPriority(policy.Priority.ToString()), "Priority"), ErrorCategory.InvalidArgument, policy.Id, true);
                 }
             }
             else if ((array.Length == 0 && policy.Priority != EmailAddressPolicyPriority.Highest) || (array.Length > 0 && policy.Priority > array[array.Length - 1].Priority))
             {
                 writeError(new ArgumentException(Strings.ErrorInvalidEapSetPriority(policy.Priority.ToString()), "Priority"), ErrorCategory.InvalidArgument, policy.Id, true);
             }
         }
         List <EmailAddressPolicy>         list  = new List <EmailAddressPolicy>();
         List <EmailAddressPolicyPriority> list2 = new List <EmailAddressPolicyPriority>();
         bool flag = false;
         for (int i = 0; i < array.Length; i++)
         {
             int num = i + (flag ? 1 : 0) + EmailAddressPolicyPriority.Highest;
             if (!flag && num == policy.Priority)
             {
                 flag = true;
                 num++;
             }
             EmailAddressPolicyPriority priority = array[i].Priority;
             UpdateEmailAddressPolicy.CheckEapVersion(array[i]);
             array[i].Priority = (EmailAddressPolicyPriority)num;
             if (array[i].IsChanged(EmailAddressPolicySchema.Priority))
             {
                 list.Add(array[i]);
                 list2.Add(priority);
             }
         }
         if (!flag)
         {
             UpdateEmailAddressPolicy.CheckEapVersion(policy);
             policy.Priority = (EmailAddressPolicyPriority)(array.Length + EmailAddressPolicyPriority.Highest);
         }
         foreach (EmailAddressPolicy emailAddressPolicy in list)
         {
             ValidationError[] array2 = emailAddressPolicy.Validate();
             int num2 = 0;
             while (array2.Length > num2)
             {
                 writeError(new InvalidOperationException(Strings.ErrorInvalidOperationOnEapObject(emailAddressPolicy.Id.ToString(), array2[num2].Description)), ErrorCategory.InvalidData, policy.Id, array2.Length - 1 == num2);
                 num2++;
             }
         }
         policiesAdjusted   = list.ToArray();
         originalPriorities = list2.ToArray();
         return(list.Count);
     }
     catch (DataSourceTransientException exception)
     {
         writeError(exception, ErrorCategory.ReadError, policy.Id, true);
     }
     return(-1);
 }