Skip to content

Commit 28f2def

Browse files
authored
Merge branch 'develop' into cactus-develop
2 parents d4853e3 + ee78e6f commit 28f2def

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

roles/lib/files/FWO.Report.Filter/Ast/AstNodeFilterNetwork.cs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using NetTools;
1+
using NetTools;
22
using System.Net;
33
using FWO.Logging;
44
using FWO.Basics;
@@ -131,24 +131,33 @@ private DynGraphqlQuery ExtractIpFilter(DynGraphqlQuery query, string location,
131131
string ipFilterString =
132132
$@" obj_ip_end: {{ _gte: ${QueryVarNameFirst1} }}
133133
obj_ip: {{ _lte: ${QueryVarNameLast2} }}";
134+
string ipFilterStringNegated =
135+
$@" obj_ip_end: {{ _lt: ${QueryVarNameFirst1} }}
136+
obj_ip: {{ _gt: ${QueryVarNameLast2} }}";
134137
query.RuleWhereStatement +=
135-
$@" {locationTable}:
136-
{{ object:
137-
{{ objgrp_flats:
138-
{{ objectByObjgrpFlatMemberId:
139-
{{ {ipFilterString} }}
140-
}}
141-
}}
142-
}}";
138+
$@" _or: [
139+
{{
140+
rule_{location}_neg: {{_eq: false}},
141+
{locationTable}: {{
142+
_or: [{{_and: [{{negated: {{_eq: false}}}}, {{object: {{objgrp_flats: {{objectByObjgrpFlatMemberId: {{ {ipFilterString} }}}}}}}}]}},
143+
{{_and: [{{negated: {{_eq: true}}}}, {{object: {{objgrp_flats: {{objectByObjgrpFlatMemberId: {{ {ipFilterStringNegated} }}}}}}}}]}}
144+
]}}
145+
}},
146+
{{
147+
rule_{location}_neg: {{_eq: true}},
148+
{locationTable}: {{
149+
_or: [{{_and: [{{negated: {{_eq: false}}}}, {{object: {{objgrp_flats: {{objectByObjgrpFlatMemberId: {{ {ipFilterStringNegated} }}}}}}}}]}},
150+
{{_and: [{{negated: {{_eq: true}}}}, {{object: {{objgrp_flats: {{objectByObjgrpFlatMemberId: {{ {ipFilterString} }}}}}}}}]}}
151+
]}}
152+
}},
153+
]
154+
";
143155
query.NwObjWhereStatement +=
144-
$@" {locationTable}:
145-
{{ object:
146-
{{ objgrp_flats:
147-
{{ objectByObjgrpFlatMemberId:
148-
{{ {ipFilterString} }}
149-
}}
150-
}}
151-
}}";
156+
$@" {locationTable}: {{
157+
_or: [{{_and: [{{negated: {{_eq: false}}}}, {{object: {{objgrp_flats: {{objectByObjgrpFlatMemberId: {{ {ipFilterString} }}}}}}}}]}},
158+
{{_and: [{{negated: {{_eq: true}}}}, {{object: {{objgrp_flats: {{objectByObjgrpFlatMemberId: {{ {ipFilterStringNegated} }}}}}}}}]}}
159+
]
160+
}}";
152161
ipFilterString = $@" ip_end: {{ _gte: ${QueryVarNameFirst1} }} ip: {{ _lte: ${QueryVarNameLast2} }}";
153162
int conField = location == "src" ? 1 : 2;
154163
query.ConnectionWhereStatement += $"nwobject_connections: {{connection_field: {{ _eq: {conField} }}, owner_network: {{ {ipFilterString} }} }}";

0 commit comments

Comments
 (0)