Esempio n. 1
0
 protected override Value BuildValue(ShortList <string> entries, RulesCreationContext creationContext)
 {
     return(Value.CreateValue(entries.Select(delegate(string protocolString)
     {
         int result;
         if (int.TryParse(protocolString, out result))
         {
             return (ClientAccessProtocol)result;
         }
         if (protocolString != null)
         {
             if (protocolString == "EWS")
             {
                 return ClientAccessProtocol.ExchangeWebServices;
             }
             if (protocolString == "RPS")
             {
                 return ClientAccessProtocol.RemotePowerShell;
             }
             if (protocolString == "OA")
             {
                 return ClientAccessProtocol.OutlookAnywhere;
             }
         }
         return (ClientAccessProtocol)Enum.Parse(typeof(ClientAccessProtocol), protocolString);
     })));
 }
Esempio n. 2
0
 protected override Value BuildValue(ShortList <string> entries, RulesCreationContext creationContext)
 {
     return(Value.CreateValue(entries.Select(delegate(string authenticationTypeString)
     {
         int result;
         if (int.TryParse(authenticationTypeString, out result))
         {
             return (ClientAccessAuthenticationMethod)result;
         }
         return (ClientAccessAuthenticationMethod)Enum.Parse(typeof(ClientAccessAuthenticationMethod), authenticationTypeString);
     })));
 }
        protected override void CreateRuleSubElements(Rule rule, XmlReader reader, RulesCreationContext creationContext)
        {
            OutlookProtectionRule outlookProtectionRule = (OutlookProtectionRule)rule;

            if (base.IsTag(reader, "userOverridable"))
            {
                outlookProtectionRule.UserOverridable = true;
                base.ReadNext(reader);
                return;
            }
            outlookProtectionRule.UserOverridable = false;
        }
        protected override void CreateRuleSubElements(Rule rule, XmlReader reader, RulesCreationContext creationContext)
        {
            PolicyTipRule    policyTipRule = (PolicyTipRule)rule;
            List <Condition> list          = new List <Condition>();

            while (base.IsTag(reader, "fork"))
            {
                list.Add(this.ParseFork(reader, creationContext));
                base.ReadNext(reader);
            }
            if (list.Count > 0)
            {
                policyTipRule.ForkConditions = list;
            }
        }
Esempio n. 5
0
 public AnyOfAuthenticationTypesPredicate(Property property, ShortList <string> valueEntries, RulesCreationContext creationContext) : base(property, valueEntries, creationContext)
 {
     if (!base.Property.IsString && !typeof(ClientAccessAuthenticationMethod).IsAssignableFrom(base.Property.Type))
     {
         throw new RulesValidationException(RulesTasksStrings.ClientAccessRulesAuthenticationTypeRequired(this.Name));
     }
 }
 public RecipientIsPredicate(ShortList <string> entries, RulesCreationContext creationContext) : base(new StringProperty("Message.ToCcBcc"), entries, creationContext)
 {
 }
 protected override Value BuildValue(ShortList <string> entries, RulesCreationContext creationContext)
 {
     return(null);
 }
 // Token: 0x060014CE RID: 5326 RVA: 0x00049E94 File Offset: 0x00048094
 public OwaIsSameUserPredicate(Property property, ShortList <string> entries, RulesCreationContext creationContext) : base(property, entries, creationContext)
 {
 }
Esempio n. 9
0
 // Token: 0x060014CA RID: 5322 RVA: 0x00049CFC File Offset: 0x00047EFC
 public SentToScopePredicate(Property property, ScopeType type, RulesCreationContext creationContext) : base(property, new ShortList <string>(), creationContext)
 {
     this.Type = type;
 }
 public override PredicateCondition CreatePredicate(string name, Property property, ShortList <string> valueEntries, RulesCreationContext creationContext)
 {
     if (name != null)
     {
         if (name == "isSameUser")
         {
             return(new OwaIsSameUserPredicate(property, valueEntries, creationContext));
         }
         if (name == "isMemberOf")
         {
             return(new IsMemberOfPredicate(property, valueEntries, creationContext));
         }
     }
     return(new UnconditionalTruePredicate());
 }
 protected override Value BuildValue(ShortList <string> entries, RulesCreationContext creationContext)
 {
     return(Value.CreateValue(entries.Select(new Func <string, IPRange>(IPRange.Parse))));
 }
 public AnyOfClientIPAddressesOrRangesPredicate(Property property, ShortList <string> valueEntries, RulesCreationContext creationContext) : base(property, valueEntries, creationContext)
 {
     if (!base.Property.IsString && !typeof(IPAddress).IsAssignableFrom(base.Property.Type))
     {
         throw new RulesValidationException(RulesTasksStrings.ClientAccessRulesIpPropertyRequired(this.Name));
     }
 }
Esempio n. 13
0
 public override PredicateCondition CreatePredicate(string name, Property property, ShortList <string> valueEntries, RulesCreationContext creationContext)
 {
     if (name != null)
     {
         if (name == "anyOfClientIPAddressesOrRangesPredicate")
         {
             return(new AnyOfClientIPAddressesOrRangesPredicate(property, valueEntries, creationContext));
         }
         if (name == "anyOfSourceTcpPortNumbersPredicate")
         {
             return(new AnyOfSourceTcpPortNumbersPredicate(property, valueEntries, creationContext));
         }
         if (name == "anyOfProtocolsPredicate")
         {
             return(new AnyOfProtocolsPredicate(property, valueEntries, creationContext));
         }
         if (name == "usernameMatchesAnyOfPatternsPredicate")
         {
             return(new UsernameMatchesAnyOfPatternsPredicate(property, valueEntries, creationContext));
         }
         if (name == "anyOfAuthenticationTypesPredicate")
         {
             return(new AnyOfAuthenticationTypesPredicate(property, valueEntries, creationContext));
         }
         if (name == "UserRecipientFilterPredicate")
         {
             return(new UserRecipientFilterPredicate(property, valueEntries, creationContext));
         }
     }
     return(base.CreatePredicate(name, property, valueEntries, creationContext));
 }
 public override PredicateCondition CreatePredicate(string name, Property property, ShortList <string> valueEntries, RulesCreationContext creationContext)
 {
     if (name != null)
     {
         if (!(name == "recipientIs"))
         {
             if (!(name == "allInternal"))
             {
                 if (name == "is")
                 {
                     if (property == null || !string.Equals(property.Name, "Message.Sender.Department", StringComparison.OrdinalIgnoreCase))
                     {
                         throw new ParserException(RulesStrings.InvalidPropertyName((property != null) ? property.Name : string.Empty));
                     }
                     return(base.CreatePredicate(name, property, valueEntries, creationContext));
                 }
             }
             else
             {
                 if (property == null || !string.Equals(property.Name, "Message.ToCcBcc", StringComparison.OrdinalIgnoreCase))
                 {
                     throw new ParserException(RulesStrings.InvalidPropertyName((property != null) ? property.Name : string.Empty));
                 }
                 return(new AllInternalPredicate());
             }
         }
         else
         {
             if (property == null || !string.Equals(property.Name, "Message.ToCcBcc", StringComparison.OrdinalIgnoreCase))
             {
                 throw new ParserException(RulesStrings.InvalidPropertyName((property != null) ? property.Name : string.Empty));
             }
             return(new RecipientIsPredicate(valueEntries, creationContext));
         }
     }
     return(base.CreatePredicate(name, property, valueEntries, creationContext));
 }
Esempio n. 15
0
 public SentToPredicate(Property property, ShortList <string> addressesToCompare, RulesCreationContext creationContext) : base(property, addressesToCompare, creationContext)
 {
 }
 public override PredicateCondition CreatePredicate(string name, Property property, ShortList <ShortList <KeyValuePair <string, string> > > valueEntries, RulesCreationContext creationContext)
 {
     if (name == "containsDataClassification")
     {
         return(new ContainsDataClassificationPredicate(property, valueEntries, creationContext));
     }
     return(new UnconditionalTruePredicate());
 }
 public UserRecipientFilterPredicate(Property property, ShortList <string> valueEntries, RulesCreationContext creationContext) : base(property, valueEntries, creationContext)
 {
     if (!base.Property.IsString && !typeof(string).IsAssignableFrom(base.Property.Type))
     {
         throw new RulesValidationException(RulesTasksStrings.ClientAccessRulesFilterPropertyRequired(this.Name));
     }
 }
        private Condition ParseFork(XmlReader reader, RulesCreationContext creationContext)
        {
            base.VerifyNotEmptyTag(reader);
            bool   flag      = false;
            string attribute = reader.GetAttribute("exception");

            if (attribute != null)
            {
                bool.TryParse(attribute, out flag);
            }
            ShortList <string> shortList = new ShortList <string>();
            ScopeType          scopeType = ScopeType.None;

            base.ReadNext(reader);
            for (;;)
            {
                if (base.IsTag(reader, "recipient"))
                {
                    string requiredAttribute = base.GetRequiredAttribute(reader, "address");
                    shortList.Add(requiredAttribute);
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "recipient");
                    }
                    base.ReadNext(reader);
                }
                else if (base.IsTag(reader, "external"))
                {
                    scopeType = ScopeType.External;
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "external");
                    }
                    base.ReadNext(reader);
                }
                else if (base.IsTag(reader, "internal"))
                {
                    scopeType = ScopeType.Internal;
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "internal");
                    }
                    base.ReadNext(reader);
                }
                else if (base.IsTag(reader, "externalPartner"))
                {
                    scopeType = ScopeType.ExternalPartner;
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "externalPartner");
                    }
                    base.ReadNext(reader);
                }
                else if (base.IsTag(reader, "externalNonPartner"))
                {
                    scopeType = ScopeType.ExternalNonPartner;
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "externalNonPartner");
                    }
                    base.ReadNext(reader);
                }
                else
                {
                    if (reader.NodeType == XmlNodeType.EndElement && reader.Name.Equals("fork"))
                    {
                        break;
                    }
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (!reader.IsEmptyElement)
                        {
                            base.ReadNext(reader);
                            base.VerifyEndTag(reader, reader.Name);
                        }
                        base.ReadNext(reader);
                    }
                }
            }
            Condition result = new UnconditionalTruePredicate();

            if (shortList.Count > 0)
            {
                SentToPredicate sentToPredicate = new SentToPredicate(MessageProperty.Create("Message.To"), shortList, creationContext);
                result = (flag ? new NotCondition(sentToPredicate) : sentToPredicate);
            }
            else if (scopeType != ScopeType.None)
            {
                SentToScopePredicate sentToScopePredicate = new SentToScopePredicate(MessageProperty.Create("Message.To"), scopeType, creationContext);
                result = (flag ? new NotCondition(sentToScopePredicate) : sentToScopePredicate);
            }
            return(result);
        }
 protected override Value BuildValue(ShortList <string> entries, RulesCreationContext creationContext)
 {
     return(Value.CreateValue(entries.Select(new Func <string, Regex>(ClientAccessRulesUsernamePatternProperty.GetWildcardPatternRegex))));
 }