protected override void InternalProcessRecord() { HostedContentFilterRule hostedContentFilterRule = new HostedContentFilterRule(null, base.Name, base.Priority, base.Enabled ? RuleState.Enabled : RuleState.Disabled, base.Comments, base.Conditions, base.Exceptions, new HostedContentFilterPolicyIdParameter(this.policyObject.Name)); if (this.policyObject.EnableEndUserSpamNotifications && !hostedContentFilterRule.IsEsnCompatible) { base.WriteError(new OperationNotAllowedException(Strings.ErrorCannotScopeEsnPolicy(this.policyObject.Name)), ErrorCategory.InvalidOperation, null); } int priority = base.Fields.IsModified("Priority") ? hostedContentFilterRule.Priority : -1; TransportRule transportRule = null; try { TransportRule rule = hostedContentFilterRule.ToInternalRule(); ADRuleStorageManager adruleStorageManager = new ADRuleStorageManager(this.ruleCollectionName, base.DataSession); adruleStorageManager.LoadRuleCollection(); adruleStorageManager.NewRule(rule, this.ResolveCurrentOrganization(), ref priority, out transportRule); FfoDualWriter.SaveToFfo <TransportRule>(this, transportRule, TenantSettingSyncLogType.DUALSYNCTR, null); } catch (RulesValidationException exception) { base.WriteError(exception, ErrorCategory.InvalidArgument, base.Name); } catch (InvalidPriorityException exception2) { base.WriteError(exception2, ErrorCategory.InvalidArgument, null); } catch (ParserException exception3) { base.WriteError(exception3, ErrorCategory.InvalidData, null); } hostedContentFilterRule.Priority = priority; hostedContentFilterRule.SetTransportRule(transportRule); base.WriteObject(hostedContentFilterRule); }
private HostedContentFilterRule GetPolicyScopingRule() { TransportRule transportRule = HygieneUtils.ResolvePolicyRuleObject <HostedContentFilterPolicy>(this.DataObject, this.ConfigurationSession, "HostedContentFilterVersioned"); if (transportRule != null) { TransportRule transportRule2 = this.GetTransportRule(transportRule.Name); return(HostedContentFilterRule.CreateFromInternalRule(transportRule, -1, transportRule2)); } return(null); }
internal override IConfigurable CreateTaskRuleFromInternalRule(TransportRule rule, int priority, TransportRule transportRule) { HostedContentFilterRule result; try { result = HostedContentFilterRule.CreateFromInternalRule(rule, priority, transportRule); } catch (CorruptFilterRuleException ex) { result = HostedContentFilterRule.CreateCorruptRule(priority, transportRule, ex.LocalizedString); } return(result); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); ((IConfigurationSession)base.DataSession).SessionSettings.IsSharedConfigChecked = true; if (!this.IgnoreDehydratedFlag) { SharedConfigurationTaskHelper.VerifyIsNotTinyTenant(base.CurrentOrgState, new Task.ErrorLoggerDelegate(base.WriteError)); } if (this.DataObject.LanguageBlockList != null) { foreach (string text in this.DataObject.LanguageBlockList) { if (!HygieneUtils.IsAntispamFilterableLanguage(text)) { base.WriteError(new ArgumentException(Strings.ErrorUnsupportedBlockLanguage(text)), ErrorCategory.InvalidArgument, text); } } } if (this.DataObject.RegionBlockList != null) { foreach (string text2 in this.DataObject.RegionBlockList) { if (!HygieneUtils.IsValidIso3166Alpha2Code(text2)) { base.WriteError(new ArgumentException(Strings.ErrorInvalidIso3166Alpha2Code(text2)), ErrorCategory.InvalidArgument, text2); } } } if (this.DataObject.IsModified(HostedContentFilterPolicySchema.EnableEndUserSpamNotifications) && this.DataObject.EnableEndUserSpamNotifications) { HostedContentFilterRule policyScopingRule = this.GetPolicyScopingRule(); if (policyScopingRule != null && !policyScopingRule.IsEsnCompatible) { base.WriteError(new OperationNotAllowedException(Strings.ErrorEsnIncompatibleRule(policyScopingRule.Name)), ErrorCategory.InvalidOperation, null); } } TaskLogger.LogExit(); }
internal override IConfigurable CreateCorruptTaskRule(int priority, TransportRule transportRule, string errorMessage) { return(HostedContentFilterRule.CreateCorruptRule(priority, transportRule, Strings.CorruptRule(transportRule.Name, errorMessage))); }