From 45f40b8195e55abd695fa6ae71144cca4b6342bb Mon Sep 17 00:00:00 2001 From: Nils Bandener Date: Wed, 30 Oct 2024 07:33:35 +0100 Subject: [PATCH] Code restructuring Signed-off-by: Nils Bandener --- .../opensearch/security/configuration/DlsFlsValveImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/opensearch/security/configuration/DlsFlsValveImpl.java b/src/main/java/org/opensearch/security/configuration/DlsFlsValveImpl.java index aef9886cfd..884f05b01c 100644 --- a/src/main/java/org/opensearch/security/configuration/DlsFlsValveImpl.java +++ b/src/main/java/org/opensearch/security/configuration/DlsFlsValveImpl.java @@ -170,15 +170,13 @@ public boolean invoke(PrivilegesEvaluationContext context, final ActionListener< doFilterLevelDls = false; } else { // mode == Mode.ADAPTIVE Mode modeByHeader = getDlsModeHeader(); + dlsRestrictionMap = config.getDocumentPrivileges() + .getRestrictions(context, resolved.getAllIndicesResolved(clusterService, context.getIndexNameExpressionResolver())); if (modeByHeader == Mode.FILTER_LEVEL) { doFilterLevelDls = true; log.debug("Doing filter-level DLS due to header"); - dlsRestrictionMap = config.getDocumentPrivileges() - .getRestrictions(context, resolved.getAllIndicesResolved(clusterService, context.getIndexNameExpressionResolver())); } else { - dlsRestrictionMap = config.getDocumentPrivileges() - .getRestrictions(context, resolved.getAllIndicesResolved(clusterService, context.getIndexNameExpressionResolver())); doFilterLevelDls = dlsRestrictionMap.containsAny(DlsRestriction::containsTermLookupQuery); if (doFilterLevelDls) {