Skip to content

Commit

Permalink
fix APIKeyRestIT
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelandis committed Apr 10, 2024
1 parent f5ace91 commit d418688
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ public void testCreateCrossClusterApiKey() throws IOException {
XContentTestUtils.convertToMap(
new RoleDescriptor(
"cross_cluster",
new String[] { "cross_cluster_search", "cross_cluster_replication" },
new String[] { "cross_cluster_search", "monitor_enrich", "cross_cluster_replication" },
new RoleDescriptor.IndicesPrivileges[] {
RoleDescriptor.IndicesPrivileges.builder()
.indices("metrics")
Expand Down Expand Up @@ -1126,7 +1126,7 @@ public void testUpdateCrossClusterApiKey() throws IOException {
assertThat(updateResponse1.evaluate("updated"), is(true));
final RoleDescriptor updatedRoleDescriptor1 = new RoleDescriptor(
"cross_cluster",
new String[] { "cross_cluster_search", "cross_cluster_replication" },
new String[] { "cross_cluster_search", "monitor_enrich", "cross_cluster_replication" },
new RoleDescriptor.IndicesPrivileges[] {
RoleDescriptor.IndicesPrivileges.builder()
.indices("data")
Expand Down Expand Up @@ -1199,7 +1199,7 @@ public void testUpdateCrossClusterApiKey() throws IOException {
final ObjectPath fetchResponse3 = fetchCrossClusterApiKeyById(apiKeyId);
final RoleDescriptor updatedRoleDescriptors2 = new RoleDescriptor(
"cross_cluster",
new String[] { "cross_cluster_search" },
new String[] { "cross_cluster_search", "monitor_enrich" },
new RoleDescriptor.IndicesPrivileges[] {
RoleDescriptor.IndicesPrivileges.builder()
.indices("blogs")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ public String remoteActionDenied(
String action,
String clusterAlias
) {
assert isIndexAction(action);
String userText = successfulAuthenticationDescription(authentication, authorizationInfo);
String remoteClusterText = remoteClusterText(clusterAlias);
return actionIsUnauthorizedMessage(action, remoteClusterText, userText)
+ " because no remote indices privileges apply for the target cluster";
String message = isIndexAction(action) ? " because no remote indices privileges apply for the target cluster"
: " because no remote cluster privileges apply for the target cluster";
return actionIsUnauthorizedMessage(action, remoteClusterText, userText) + message;
}

protected Collection<String> findClusterPrivilegesThatGrant(
Expand Down

0 comments on commit d418688

Please sign in to comment.