Skip to content

Commit b03a593

Browse files
committed
Fix test
1 parent 4d301c9 commit b03a593

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,6 @@ private static void collatePrivilegesByIndices(
747747
final Set<String> key = newHashSet(indicesPrivilege.getIndices());
748748
indicesPrivilegesMap.compute(key, (k, value) -> {
749749
if (value == null) {
750-
// TODO do we need to worry about FLS and DLS combining incorrectly for different selectors?
751750
return new MergeableIndicesPrivilege(
752751
indicesPrivilege.getIndices(),
753752
indicesPrivilege.getPrivileges(),

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/rest/action/privilege/RestGetBuiltinPrivilegesAction.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.io.IOException;
3232
import java.util.Arrays;
3333
import java.util.List;
34+
import java.util.Set;
3435

3536
import static org.elasticsearch.rest.RestRequest.Method.GET;
3637

@@ -41,6 +42,11 @@
4142
public class RestGetBuiltinPrivilegesAction extends SecurityBaseRestHandler {
4243

4344
private static final Logger logger = LogManager.getLogger(RestGetBuiltinPrivilegesAction.class);
45+
// TODO remove this once we can update docs tests again
46+
private static final Set<String> FAILURE_STORE_PRIVILEGES_TO_EXCLUDE = Set.of(
47+
IndexPrivilege.READ_FAILURE_STORE.getSingleName(),
48+
IndexPrivilege.MANAGE_FAILURE_STORE_INTERNAL.getSingleName()
49+
);
4450
private final GetBuiltinPrivilegesResponseTranslator responseTranslator;
4551

4652
public RestGetBuiltinPrivilegesAction(
@@ -73,7 +79,6 @@ public RestResponse buildResponse(GetBuiltinPrivilegesResponse response, XConten
7379
final var translatedResponse = responseTranslator.translate(response);
7480
builder.startObject();
7581
builder.array("cluster", translatedResponse.getClusterPrivileges());
76-
// TODO remove the filter once we can update docs tests again
7782
builder.array("index", filterOutFailureStorePrivileges(translatedResponse));
7883
String[] remoteClusterPrivileges = translatedResponse.getRemoteClusterPrivileges();
7984
if (remoteClusterPrivileges.length > 0) { // remote clusters are not supported in stateless mode, so hide entirely
@@ -85,10 +90,7 @@ public RestResponse buildResponse(GetBuiltinPrivilegesResponse response, XConten
8590

8691
private static String[] filterOutFailureStorePrivileges(GetBuiltinPrivilegesResponse translatedResponse) {
8792
return Arrays.stream(translatedResponse.getIndexPrivileges())
88-
.filter(
89-
p -> false == (p.equals(IndexPrivilege.READ_FAILURE_STORE.getSingleName())
90-
|| p.equals(IndexPrivilege.MANAGE_FAILURE_STORE_INTERNAL.getSingleName()))
91-
)
93+
.filter(p -> false == FAILURE_STORE_PRIVILEGES_TO_EXCLUDE.contains(p))
9294
.toArray(String[]::new);
9395
}
9496
}

0 commit comments

Comments
 (0)