Exemple #1
0
 public ExportTransportRuleCollection()
 {
     this.supportedPredicates = TransportRulePredicate.GetAvailablePredicateMappings();
     this.supportedActions    = TransportRuleAction.GetAvailableActionMappings();
     base.RuleCollectionName  = Utils.RuleCollectionNameFromRole();
     this.Format = RuleCollectionFormat.RuleCollectionXML;
 }
Exemple #2
0
        protected override void InternalProcessRecord()
        {
            bool enabled = VariantConfiguration.InvariantNoFlightingSnapshot.CompliancePolicy.ShowSupervisionPredicate.Enabled;
            IConfigDataProvider session = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 49, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\TransportRule\\GetTransportRulePredicate.cs");

            TypeMapping[] availablePredicateMappings = TransportRulePredicate.GetAvailablePredicateMappings();
            if (string.IsNullOrEmpty(this.name))
            {
                foreach (TransportRulePredicate transportRulePredicate in TransportRulePredicate.CreateAllAvailablePredicates(availablePredicateMappings, session))
                {
                    if (enabled || (!(transportRulePredicate is SenderInRecipientListPredicate) && !(transportRulePredicate is RecipientInSenderListPredicate)))
                    {
                        base.WriteObject(transportRulePredicate);
                    }
                }
                return;
            }
            TransportRulePredicate transportRulePredicate2 = TransportRulePredicate.CreatePredicate(availablePredicateMappings, this.name, session);

            if (!enabled && (transportRulePredicate2 is SenderInRecipientListPredicate || transportRulePredicate2 is RecipientInSenderListPredicate))
            {
                transportRulePredicate2 = null;
            }
            if (transportRulePredicate2 == null)
            {
                base.WriteError(new ArgumentException(Strings.InvalidPredicate, "Name"), ErrorCategory.InvalidArgument, this.Name);
                return;
            }
            base.WriteObject(transportRulePredicate2);
        }
Exemple #3
0
 public GetTransportRule()
 {
     this.ruleCollectionName  = Utils.RuleCollectionNameFromRole();
     this.supportedPredicates = TransportRulePredicate.GetAvailablePredicateMappings();
     this.supportedActions    = TransportRuleAction.GetAvailableActionMappings();
     this.State = RuleState.Enabled;
     base.Fields.ResetChangeTracking();
 }
Exemple #4
0
 internal static TransportRulePredicate[] CreateAllAvailablePredicates(TypeMapping[] mappings, IConfigDataProvider session)
 {
     TransportRulePredicate[] array = new TransportRulePredicate[mappings.Length];
     for (int i = 0; i < mappings.Length; i++)
     {
         array[i] = TransportRulePredicate.InternalCreatePredicate(mappings[i].Type, mappings, session);
     }
     return(array);
 }
Exemple #5
0
 internal static TransportRulePredicate CreatePredicate(TypeMapping[] mappings, string name, IConfigDataProvider session)
 {
     foreach (TypeMapping typeMapping in mappings)
     {
         if (name.Equals(typeMapping.Name, StringComparison.OrdinalIgnoreCase))
         {
             return(TransportRulePredicate.InternalCreatePredicate(typeMapping.Type, mappings, session));
         }
     }
     return(null);
 }
Exemple #6
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            TransportRule dataObject = this.DataObject;

            if (dataObject == null)
            {
                ExAssert.RetailAssert(false, "EnableTransportRule.InternalValidate data object is invalid");
            }
            TransportRule rule  = (TransportRule)TransportRuleParser.Instance.GetRule(dataObject.Xml);
            Rule          rule2 = Rule.CreateFromInternalRule(TransportRulePredicate.GetAvailablePredicateMappings(), TransportRuleAction.GetAvailableActionMappings(), rule, dataObject.Priority, dataObject);
            IEnumerable <RightsProtectMessageAction> source = (from action in rule2.Actions
                                                               where action is RightsProtectMessageAction
                                                               select action as RightsProtectMessageAction).ToList <RightsProtectMessageAction>();

            if (source.Any <RightsProtectMessageAction>())
            {
                if (!RmsClientManager.IRMConfig.IsInternalLicensingEnabledForTenant(base.CurrentOrganizationId))
                {
                    base.WriteError(new IrmLicensingIsDisabledException(), ErrorCategory.InvalidArgument, null);
                }
                RmsTemplateIdentity     template = source.First <RightsProtectMessageAction>().Template;
                RmsTemplateDataProvider session  = new RmsTemplateDataProvider((IConfigurationSession)base.DataSession);
                base.GetDataObject <RmsTemplatePresentation>(new RmsTemplateIdParameter(template), session, null, new LocalizedString?(Strings.OutlookProtectionRuleRmsTemplateNotFound(template.TemplateName)), new LocalizedString?(Strings.OutlookProtectionRuleRmsTemplateNotUnique(template.TemplateName)));
            }
            bool flag;

            if (!rule2.Actions.Any((TransportRuleAction action) => action is ApplyOMEAction))
            {
                flag = rule2.Actions.Any((TransportRuleAction action) => action is RemoveOMEAction);
            }
            else
            {
                flag = true;
            }
            bool flag2 = flag;

            if (flag2)
            {
                IRMConfiguration irmconfiguration = IRMConfiguration.Read((IConfigurationSession)base.DataSession);
                if (irmconfiguration == null || !irmconfiguration.InternalLicensingEnabled)
                {
                    base.WriteError(new E4eLicensingIsDisabledExceptionEnableRule(), ErrorCategory.InvalidArgument, null);
                }
                if (RmsClientManager.IRMConfig.GetRmsTemplate(base.CurrentOrganizationId, RmsTemplate.InternetConfidential.Id) == null)
                {
                    base.WriteError(new E4eRuleRmsTemplateNotFoundException(RmsTemplate.InternetConfidential.Name), ErrorCategory.InvalidArgument, null);
                }
            }
        }
Exemple #7
0
 internal static bool TryCreatePredicateFromCondition(TypeMapping[] mappings, Condition condition, out TransportRulePredicate predicate, IConfigDataProvider session)
 {
     foreach (TypeMapping typeMapping in mappings)
     {
         MethodInfo method = typeMapping.Type.GetMethod("CreateFromInternalConditionWithSession", BindingFlags.Static | BindingFlags.NonPublic);
         if (null != method)
         {
             TransportRulePredicate transportRulePredicate = (TransportRulePredicate)method.Invoke(null, new object[]
             {
                 condition,
                 session
             });
             if (transportRulePredicate != null)
             {
                 predicate = transportRulePredicate;
                 predicate.Initialize(mappings);
                 return(true);
             }
         }
         MethodInfo method2 = typeMapping.Type.GetMethod("CreateFromInternalCondition", BindingFlags.Static | BindingFlags.NonPublic);
         if (null != method2)
         {
             TransportRulePredicate transportRulePredicate = (TransportRulePredicate)method2.Invoke(null, new object[]
             {
                 condition
             });
             if (transportRulePredicate != null)
             {
                 predicate = transportRulePredicate;
                 predicate.Initialize(mappings);
                 return(true);
             }
         }
     }
     predicate = null;
     return(false);
 }
 internal static bool TryCreatePredicateFromBifInfo(TypeMapping[] mappings, RuleBifurcationInfo bifInfo1, RuleBifurcationInfo bifInfo2, out TransportRulePredicate predicate, out bool twoBifInfoConverted)
 {
     foreach (TypeMapping typeMapping in mappings)
     {
         if (typeMapping.Type.IsSubclassOf(typeof(BifurcationInfoPredicate)))
         {
             MethodInfo method = typeMapping.Type.GetMethod("CreatePredicateFromBifInfo", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[]
             {
                 typeof(RuleBifurcationInfo)
             }, null);
             TransportRulePredicate transportRulePredicate;
             if (method != null)
             {
                 transportRulePredicate = (TransportRulePredicate)method.Invoke(null, new object[]
                 {
                     bifInfo1
                 });
                 if (transportRulePredicate != null)
                 {
                     twoBifInfoConverted = false;
                     predicate           = transportRulePredicate;
                     predicate.Initialize(mappings);
                     return(true);
                 }
             }
             if (bifInfo2 == null)
             {
                 goto IL_116;
             }
             method = typeMapping.Type.GetMethod("CreatePredicateFromBifInfo", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[]
             {
                 typeof(RuleBifurcationInfo),
                 typeof(RuleBifurcationInfo)
             }, null);
             if (!(method != null))
             {
                 goto IL_116;
             }
             transportRulePredicate = (TransportRulePredicate)method.Invoke(null, new object[]
             {
                 bifInfo1,
                 bifInfo2
             });
             if (transportRulePredicate == null)
             {
                 goto IL_116;
             }
             twoBifInfoConverted = true;
             predicate           = transportRulePredicate;
             predicate.Initialize(mappings);
             return(true);
         }
         IL_116 :;
     }
     predicate           = null;
     twoBifInfoConverted = false;
     return(false);
 }