예제 #1
0
 public override void AddPolicy(PolicyDefinitionConfig definition, PolicyRuleConfig rule)
 {
     if (definition.Scenario == PolicyScenario.Hold)
     {
         this.UpdateHold(definition.Identity, true);
     }
 }
예제 #2
0
        public override UnifiedPolicyStorageBase ConvertToStorage(ExPolicyConfigProvider provider, PolicyConfigBase policyConfig)
        {
            ArgumentValidator.ThrowIfNull("provider", provider);
            ArgumentValidator.ThrowIfNull("storageObject", policyConfig);
            UnifiedPolicyStorageBase unifiedPolicyStorageBase = policyConfig.RawObject as TPolicyStorage;

            if (unifiedPolicyStorageBase == null)
            {
                unifiedPolicyStorageBase = Activator.CreateInstance <TPolicyStorage>();
                unifiedPolicyStorageBase.OrganizationId = provider.GetOrganizationId();
                if (ExPolicyConfigProvider.IsFFOOnline)
                {
                    unifiedPolicyStorageBase.SetId(new ADObjectId(PolicyStorage.PoliciesContainer.GetChildId(policyConfig.Name).DistinguishedName, policyConfig.Identity));
                }
                else
                {
                    PolicyRuleConfig policyRuleConfig      = policyConfig as PolicyRuleConfig;
                    ADObjectId       policyConfigContainer = provider.GetPolicyConfigContainer((policyRuleConfig == null) ? null : new Guid?(policyRuleConfig.PolicyDefinitionConfigId));
                    unifiedPolicyStorageBase.SetId(policyConfigContainer.GetChildId(policyConfig.Name));
                    unifiedPolicyStorageBase.MasterIdentity = policyConfig.Identity;
                }
            }
            else if ((ExPolicyConfigProvider.IsFFOOnline && policyConfig.Identity != unifiedPolicyStorageBase.Guid) || (!ExPolicyConfigProvider.IsFFOOnline && policyConfig.Identity != unifiedPolicyStorageBase.MasterIdentity))
            {
                throw new PolicyConfigProviderPermanentException(ServerStrings.ErrorCouldNotUpdateMasterIdentityProperty(policyConfig.Name));
            }
            if (policyConfig.Version != null)
            {
                unifiedPolicyStorageBase.PolicyVersion = policyConfig.Version.InternalStorage;
            }
            unifiedPolicyStorageBase.Name = policyConfig.Name;
            if (unifiedPolicyStorageBase.Workload != policyConfig.Workload)
            {
                unifiedPolicyStorageBase.Workload = policyConfig.Workload;
            }
            this.copyPropertiesToStorageDelegate((TPolicyConfig)((object)policyConfig), (TPolicyStorage)((object)unifiedPolicyStorageBase));
            return(unifiedPolicyStorageBase);
        }
예제 #3
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;
            }
        }
예제 #4
0
 // Token: 0x06000872 RID: 2162 RVA: 0x00022026 File Offset: 0x00020226
 public override void AddPolicy(PolicyDefinitionConfig definition, PolicyRuleConfig rule)
 {
     throw new NotImplementedException();
 }
        // 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);
        }