示例#1
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("enabled");
     writer.WriteBooleanValue(Enabled);
     writer.WritePropertyName("firewallMode");
     writer.WriteStringValue(FirewallMode.ToString());
     writer.WritePropertyName("ruleSetType");
     writer.WriteStringValue(RuleSetType);
     writer.WritePropertyName("ruleSetVersion");
     writer.WriteStringValue(RuleSetVersion);
     if (DisabledRuleGroups != null)
     {
         writer.WritePropertyName("disabledRuleGroups");
         writer.WriteStartArray();
         foreach (var item in DisabledRuleGroups)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (RequestBodyCheck != null)
     {
         writer.WritePropertyName("requestBodyCheck");
         writer.WriteBooleanValue(RequestBodyCheck.Value);
     }
     if (MaxRequestBodySize != null)
     {
         writer.WritePropertyName("maxRequestBodySize");
         writer.WriteNumberValue(MaxRequestBodySize.Value);
     }
     if (MaxRequestBodySizeInKb != null)
     {
         writer.WritePropertyName("maxRequestBodySizeInKb");
         writer.WriteNumberValue(MaxRequestBodySizeInKb.Value);
     }
     if (FileUploadLimitInMb != null)
     {
         writer.WritePropertyName("fileUploadLimitInMb");
         writer.WriteNumberValue(FileUploadLimitInMb.Value);
     }
     if (Exclusions != null)
     {
         writer.WritePropertyName("exclusions");
         writer.WriteStartArray();
         foreach (var item in Exclusions)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
示例#2
0
        public List <String> GetAllFirewallEntries(FirewallMode firewallMode, FirewallArea area)
        {
            var query = new Sql().Select("IPAddress").From(FortressConstants.TableNames.FortressFirewallEntry);


            query.Append(" WHERE Area =@0", area.ToString());
            query.Append(" AND FirewallMode =@0", firewallMode.ToString());

            var db          = ApplicationContext.Current.DatabaseContext.Database;
            var pageDetails = db.Fetch <string>(query);

            return(pageDetails);
        }
示例#3
0
        public Page <FortressFirewallEntry> GetFirewallEntries(int page, FirewallMode firewallMode, FirewallArea area)
        {
            var query = new Sql().Select("*").From(FortressConstants.TableNames.FortressFirewallEntry);


            query.Append(" WHERE Area =@0", area.ToString());
            query.Append(" AND FirewallMode =@0", firewallMode.ToString());

            query.OrderBy("Id asc");

            var db          = ApplicationContext.Current.DatabaseContext.Database;
            var pageDetails = db.Page <FortressFirewallEntry>(page, 50, query);

            return(pageDetails);
        }