Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the inconsistent variable for DLS #2056

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static boolean handle(String action, ActionRequest request, ActionListene
private final ThreadContext threadContext;
private final IndexNameExpressionResolver resolver;
private BoolQueryBuilder filterLevelQueryBuilder;
private DocumentAllowList documentWhitelist;
private DocumentAllowList documentAllowlist;

DlsFilterLevelActionHandler(String action, ActionRequest request, ActionListener<?> listener, EvaluatedDlsFlsConfig evaluatedDlsFlsConfig,
Resolved resolved, Client nodeClient, ClusterService clusterService, IndicesService indicesService,
Expand Down Expand Up @@ -178,8 +178,8 @@ private boolean handle() {
}

private boolean handle(SearchRequest searchRequest, StoredContext ctx) {
if (documentWhitelist != null) {
documentWhitelist.applyTo(threadContext);
if (documentAllowlist != null) {
documentAllowlist.applyTo(threadContext);
}

String localClusterAlias = LOCAL_CLUSTER_ALIAS_GETTER.apply(searchRequest);
Expand Down Expand Up @@ -225,8 +225,8 @@ public void onFailure(Exception e) {
}

private boolean handle(GetRequest getRequest, StoredContext ctx) {
if (documentWhitelist != null) {
documentWhitelist.applyTo(threadContext);
if (documentAllowlist != null) {
documentAllowlist.applyTo(threadContext);
}

SearchRequest searchRequest = new SearchRequest(getRequest.indices());
Expand Down Expand Up @@ -270,8 +270,8 @@ public void onFailure(Exception e) {
}

private boolean handle(MultiGetRequest multiGetRequest, StoredContext ctx) {
if (documentWhitelist != null) {
documentWhitelist.applyTo(threadContext);
if (documentAllowlist != null) {
documentAllowlist.applyTo(threadContext);
}

Map<String, Set<String>> idsGroupedByIndex = multiGetRequest.getItems().stream()
Expand Down Expand Up @@ -395,7 +395,7 @@ private boolean createQueryExtension(String localClusterAlias) throws IOExceptio
Map<String, Set<String>> filterLevelQueries = evaluatedDlsFlsConfig.getDlsQueriesByIndex();

BoolQueryBuilder dlsQueryBuilder = QueryBuilders.boolQuery().minimumShouldMatch(1);
DocumentAllowList documentWhitelist = new DocumentAllowList();
DocumentAllowList documentAllowlist = new DocumentAllowList();

int queryCount = 0;

Expand Down Expand Up @@ -450,7 +450,7 @@ private boolean createQueryExtension(String localClusterAlias) throws IOExceptio
for (QueryBuilder queryBuilder : queryBuilders) {
TermsQueryBuilder termsQueryBuilder = (TermsQueryBuilder) queryBuilder;

documentWhitelist.add(termsQueryBuilder.termsLookup().index(), termsQueryBuilder.termsLookup().id());
documentAllowlist.add(termsQueryBuilder.termsLookup().index(), termsQueryBuilder.termsLookup().id());
}
}

Expand All @@ -461,7 +461,7 @@ private boolean createQueryExtension(String localClusterAlias) throws IOExceptio
return false;
} else {
this.filterLevelQueryBuilder = dlsQueryBuilder;
this.documentWhitelist = documentWhitelist;
this.documentAllowlist = documentAllowlist;
return true;
}
}
Expand Down