From 5d676e062619d4965edffb097977fdad3e7b1308 Mon Sep 17 00:00:00 2001 From: cliu123 Date: Sat, 9 Apr 2022 21:45:05 -0700 Subject: [PATCH] Add back the isDebugEnabled() check Signed-off-by: cliu123 --- .../security/securityconf/ConfigModelV7.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/opensearch/security/securityconf/ConfigModelV7.java b/src/main/java/org/opensearch/security/securityconf/ConfigModelV7.java index 129e33e94e..be75c20c2d 100644 --- a/src/main/java/org/opensearch/security/securityconf/ConfigModelV7.java +++ b/src/main/java/org/opensearch/security/securityconf/ConfigModelV7.java @@ -387,7 +387,7 @@ public EvaluatedDlsFlsConfig getDlsFls(User user, boolean dfmEmptyOverwritesAll, dlsQueriesByIndex.computeIfAbsent(concreteIndex, (key) -> new HashSet()).add(dls); } } else if (dfmEmptyOverwritesAll) { - noDlsConcreteIndices.addAll(concreteIndices); + noDlsConcreteIndices.addAll(concreteIndices); } Set fls = ip.getFls(); @@ -423,19 +423,20 @@ public EvaluatedDlsFlsConfig getDlsFls(User user, boolean dfmEmptyOverwritesAll, } } } - - if (dfmEmptyOverwritesAll) { - log.debug("Index patterns with no dls queries attached: {} - They will be removed from {}", noDlsConcreteIndices, - dlsQueriesByIndex.keySet()); - log.debug("Index patterns with no fls fields attached: {} - They will be removed from {}", noFlsConcreteIndices, - flsFields.keySet()); - log.debug("Index patterns with no masked fields attached: {} - They will be removed from {}", noMaskedFieldConcreteIndices, - maskedFieldsMap.keySet()); - // removing the indices that do not have D/M/F restrictions - // from the keySet will also modify the underlying map - dlsQueriesByIndex.keySet().removeAll(noDlsConcreteIndices); - flsFields.keySet().removeAll(noFlsConcreteIndices); - maskedFieldsMap.keySet().removeAll(noMaskedFieldConcreteIndices); + if (log.isDebugEnabled()) { + if (dfmEmptyOverwritesAll) { + log.debug("Index patterns with no dls queries attached: {} - They will be removed from {}", noDlsConcreteIndices, + dlsQueriesByIndex.keySet()); + log.debug("Index patterns with no fls fields attached: {} - They will be removed from {}", noFlsConcreteIndices, + flsFields.keySet()); + log.debug("Index patterns with no masked fields attached: {} - They will be removed from {}", noMaskedFieldConcreteIndices, + maskedFieldsMap.keySet()); + // removing the indices that do not have D/M/F restrictions + // from the keySet will also modify the underlying map + dlsQueriesByIndex.keySet().removeAll(noDlsConcreteIndices); + flsFields.keySet().removeAll(noFlsConcreteIndices); + maskedFieldsMap.keySet().removeAll(noMaskedFieldConcreteIndices); + } } return new EvaluatedDlsFlsConfig(dlsQueriesByIndex, flsFields, maskedFieldsMap);