|
1 | | -using NetTools; |
| 1 | +using NetTools; |
2 | 2 | using System.Net; |
3 | 3 | using FWO.Logging; |
4 | 4 | using FWO.Basics; |
@@ -131,24 +131,33 @@ private DynGraphqlQuery ExtractIpFilter(DynGraphqlQuery query, string location, |
131 | 131 | string ipFilterString = |
132 | 132 | $@" obj_ip_end: {{ _gte: ${QueryVarNameFirst1} }} |
133 | 133 | obj_ip: {{ _lte: ${QueryVarNameLast2} }}"; |
| 134 | + string ipFilterStringNegated = |
| 135 | + $@" obj_ip_end: {{ _lt: ${QueryVarNameFirst1} }} |
| 136 | + obj_ip: {{ _gt: ${QueryVarNameLast2} }}"; |
134 | 137 | 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 | + "; |
143 | 155 | 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 | + }}"; |
152 | 161 | ipFilterString = $@" ip_end: {{ _gte: ${QueryVarNameFirst1} }} ip: {{ _lte: ${QueryVarNameLast2} }}"; |
153 | 162 | int conField = location == "src" ? 1 : 2; |
154 | 163 | query.ConnectionWhereStatement += $"nwobject_connections: {{connection_field: {{ _eq: {conField} }}, owner_network: {{ {ipFilterString} }} }}"; |
|
0 commit comments