|
@@ -28,9 +28,7 @@ import org.elasticsearch.xpack.security.authz.store.NativeRolesStore;
|
|
|
import org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
|
|
|
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|
|
|
|
@@ -41,8 +39,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|
|
public class RestGetBuiltinPrivilegesAction extends SecurityBaseRestHandler {
|
|
|
|
|
|
private static final Logger logger = LogManager.getLogger(RestGetBuiltinPrivilegesAction.class);
|
|
|
- // TODO remove this once we can update docs tests again
|
|
|
- private static final Set<String> FAILURE_STORE_PRIVILEGES_TO_EXCLUDE = Set.of("read_failure_store", "manage_failure_store");
|
|
|
private final GetBuiltinPrivilegesResponseTranslator responseTranslator;
|
|
|
|
|
|
public RestGetBuiltinPrivilegesAction(
|
|
@@ -75,7 +71,7 @@ public class RestGetBuiltinPrivilegesAction extends SecurityBaseRestHandler {
|
|
|
final var translatedResponse = responseTranslator.translate(response);
|
|
|
builder.startObject();
|
|
|
builder.array("cluster", translatedResponse.getClusterPrivileges());
|
|
|
- builder.array("index", filterOutFailureStorePrivileges(translatedResponse));
|
|
|
+ builder.array("index", translatedResponse.getIndexPrivileges());
|
|
|
String[] remoteClusterPrivileges = translatedResponse.getRemoteClusterPrivileges();
|
|
|
if (remoteClusterPrivileges.length > 0) { // remote clusters are not supported in stateless mode, so hide entirely
|
|
|
builder.array("remote_cluster", remoteClusterPrivileges);
|
|
@@ -83,12 +79,6 @@ public class RestGetBuiltinPrivilegesAction extends SecurityBaseRestHandler {
|
|
|
builder.endObject();
|
|
|
return new RestResponse(RestStatus.OK, builder);
|
|
|
}
|
|
|
-
|
|
|
- private static String[] filterOutFailureStorePrivileges(GetBuiltinPrivilegesResponse translatedResponse) {
|
|
|
- return Arrays.stream(translatedResponse.getIndexPrivileges())
|
|
|
- .filter(p -> false == FAILURE_STORE_PRIVILEGES_TO_EXCLUDE.contains(p))
|
|
|
- .toArray(String[]::new);
|
|
|
- }
|
|
|
}
|
|
|
);
|
|
|
}
|