Beispiel #1
0
        // Token: 0x06000161 RID: 353 RVA: 0x00009948 File Offset: 0x00007B48
        public InPlaceHoldConfiguration(PolicyDefinitionConfig definition, PolicyRuleConfig rule, RuleParser parser, Trace tracer)
        {
            this.Name     = definition.Name;
            this.Identity = ExMailboxComplianceItemContainer.GetHoldId(definition.Identity);
            this.Enabled  = (definition.Mode == Mode.Enforce);
            this.IsValid  = false;
            PolicyRule rule2 = parser.GetRule(rule.RuleBlob);

            if (rule2 != null)
            {
                this.QueryString = string.Empty;
                string text = KqlHelpers.GenerateHoldKeepQuery(rule2, ExPropertyNameMapping.Mapping);
                if (string.IsNullOrEmpty(text))
                {
                    this.QueryFilter = null;
                }
                else
                {
                    this.QueryFilter = KqlParser.ParseAndBuildQuery(text, KqlParser.ParseOption.DisablePrefixMatch | KqlParser.ParseOption.AllowShortWildcards | KqlParser.ParseOption.EDiscoveryMode, CultureInfo.InvariantCulture, null, null);
                }
                this.IsValid = true;
            }
        }
        // Token: 0x06000153 RID: 339 RVA: 0x00008BFC File Offset: 0x00006DFC
        private Dictionary <string, InPlaceHoldConfiguration> LoadInPlaceHoldConfigurationInOrg(OrganizationId orgId, StatisticsLogEntry logEntry)
        {
            this.TraceInformation("Load All hold policy Objects in Organization " + orgId);
            new List <InPlaceHoldConfiguration>();
            DiscoverySearchDataProvider                   discoverySearchDataProvider = new DiscoverySearchDataProvider(orgId);
            IEnumerable <MailboxDiscoverySearch>          all        = discoverySearchDataProvider.GetAll <MailboxDiscoverySearch>();
            Dictionary <string, InPlaceHoldConfiguration> dictionary = new Dictionary <string, InPlaceHoldConfiguration>();

            foreach (MailboxDiscoverySearch mailboxDiscoverySearch in all)
            {
                if (!dictionary.ContainsKey(mailboxDiscoverySearch.InPlaceHoldIdentity))
                {
                    InPlaceHoldConfiguration value = new InPlaceHoldConfiguration(mailboxDiscoverySearch);
                    dictionary.Add(mailboxDiscoverySearch.InPlaceHoldIdentity, value);
                }
            }
            bool flag = false;

            try
            {
                flag = discoverySearchDataProvider.Mailbox.GetConfiguration().MailboxAssistants.UnifiedPolicyHold.Enabled;
            }
            catch (CannotDetermineExchangeModeException)
            {
                this.TraceInformation("Failed to load unifiedHold flight information");
            }
            if (flag)
            {
                try
                {
                    PolicyConfigProvider policyConfigProvider = PolicyConfigProviderManager <ExPolicyConfigProviderManager> .Instance.CreateForProcessingEngine(orgId);

                    if (policyConfigProvider != null)
                    {
                        ExComplianceServiceProvider          exComplianceServiceProvider = new ExComplianceServiceProvider();
                        IEnumerable <PolicyDefinitionConfig> enumerable = policyConfigProvider.FindByName <PolicyDefinitionConfig>("*");
                        if (enumerable != null && exComplianceServiceProvider != null)
                        {
                            foreach (PolicyDefinitionConfig policyDefinitionConfig in enumerable)
                            {
                                string holdId = ExMailboxComplianceItemContainer.GetHoldId(policyDefinitionConfig.Identity);
                                if (policyDefinitionConfig.Mode == Mode.Enforce && policyDefinitionConfig.Scenario == PolicyScenario.Hold)
                                {
                                    IEnumerable <PolicyRuleConfig> enumerable2 = policyConfigProvider.FindByPolicyDefinitionConfigId <PolicyRuleConfig>(policyDefinitionConfig.Identity);
                                    if (enumerable2 == null)
                                    {
                                        continue;
                                    }
                                    using (IEnumerator <PolicyRuleConfig> enumerator3 = enumerable2.GetEnumerator())
                                    {
                                        while (enumerator3.MoveNext())
                                        {
                                            PolicyRuleConfig rule = enumerator3.Current;
                                            if (dictionary.ContainsKey(holdId))
                                            {
                                                this.TraceInformation(string.Format("Hold Id contained twice.  HoldId: {0}", holdId));
                                                break;
                                            }
                                            InPlaceHoldConfiguration value2 = new InPlaceHoldConfiguration(policyDefinitionConfig, rule, exComplianceServiceProvider.GetRuleParser(), DiscoveryHoldQueryCache.Tracer);
                                            dictionary.Add(holdId, value2);
                                        }
                                        continue;
                                    }
                                }
                                this.TraceInformation(string.Format("Hold not loaded. HoldId: {0} Mode: {1} Scenario: {2}", holdId, policyDefinitionConfig.Mode.ToString(), policyDefinitionConfig.Scenario.ToString()));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    DiscoveryHoldQueryCache.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "Failed to load hold queries from PolicyConfigProvider.  Exception: {0}", ex);
                    if (logEntry != null)
                    {
                        logEntry.FailedToLoadUnifiedPolicies = ex.Message;
                    }
                }
            }
            return(dictionary);
        }