Skip to content

Commit a531e5f

Browse files
committed
More fixes
1 parent 793215f commit a531e5f

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/IndicesPermission.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ public Builder(RestrictedIndices restrictedIndices) {
7676
this.restrictedIndices = restrictedIndices;
7777
}
7878

79+
// TODO remove me
80+
public Builder addGroup(
81+
IndexPrivilege privilege,
82+
FieldPermissions fieldPermissions,
83+
@Nullable Set<BytesReference> query,
84+
boolean allowRestrictedIndices,
85+
String... indices
86+
) {
87+
return addGroup(privilege, fieldPermissions, query, allowRestrictedIndices, IndexComponentSelectorPrivilege.DATA, indices);
88+
}
89+
7990
public Builder addGroup(
8091
IndexPrivilege privilege,
8192
FieldPermissions fieldPermissions,

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/user/InternalUsers.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ public class InternalUsers {
162162
IndicesStatsAction.NAME + "*",
163163
TransportUpdateSettingsAction.TYPE.name(),
164164
DownsampleAction.NAME,
165-
TransportAddIndexBlockAction.TYPE.name()
165+
TransportAddIndexBlockAction.TYPE.name(),
166+
IndexPrivilege.MANAGE_FAILURE_STORE_INTERNAL.getSingleName()
166167
)
167168
.allowRestrictedIndices(false)
168169
.build(),
@@ -181,7 +182,8 @@ public class InternalUsers {
181182
IndicesStatsAction.NAME + "*",
182183
TransportUpdateSettingsAction.TYPE.name(),
183184
DownsampleAction.NAME,
184-
TransportAddIndexBlockAction.TYPE.name()
185+
TransportAddIndexBlockAction.TYPE.name(),
186+
IndexPrivilege.MANAGE_FAILURE_STORE_INTERNAL.getSingleName()
185187
)
186188
.allowRestrictedIndices(true)
187189
.build() },
@@ -221,7 +223,8 @@ public class InternalUsers {
221223
TransportBulkAction.NAME,
222224
TransportIndexAction.NAME,
223225
TransportSearchScrollAction.TYPE.name(),
224-
ModifyDataStreamsAction.NAME
226+
ModifyDataStreamsAction.NAME,
227+
IndexPrivilege.MANAGE_FAILURE_STORE_INTERNAL.getSingleName()
225228
)
226229
.allowRestrictedIndices(false)
227230
.build() },

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/privilege/IndexPrivilegeTests.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,32 @@ public void testOrderingOfPrivilegeNames() throws Exception {
5858
}
5959

6060
public void testFindPrivilegesThatGrant() {
61-
assertThat(findPrivilegesThatGrant(TransportSearchAction.TYPE.name()), equalTo(List.of("read", "all")));
61+
assertThat(findPrivilegesThatGrant(TransportSearchAction.TYPE.name()), equalTo(List.of("read", "read_failure_store", "all")));
6262
assertThat(findPrivilegesThatGrant(TransportIndexAction.NAME), equalTo(List.of("create_doc", "create", "index", "write", "all")));
6363
assertThat(findPrivilegesThatGrant(TransportUpdateAction.NAME), equalTo(List.of("index", "write", "all")));
6464
assertThat(findPrivilegesThatGrant(TransportDeleteAction.NAME), equalTo(List.of("delete", "write", "all")));
6565
assertThat(
6666
findPrivilegesThatGrant(IndicesStatsAction.NAME),
67-
equalTo(List.of("monitor", "cross_cluster_replication", "manage", "all"))
67+
equalTo(List.of("monitor", "manage", "manage_failure_store_internal", "cross_cluster_replication", "all"))
68+
);
69+
assertThat(
70+
findPrivilegesThatGrant(RefreshAction.NAME),
71+
equalTo(List.of("maintenance", "manage", "manage_failure_store_internal", "all"))
6872
);
69-
assertThat(findPrivilegesThatGrant(RefreshAction.NAME), equalTo(List.of("maintenance", "manage", "all")));
7073
}
7174

7275
public void testPrivilegesForRollupFieldCapsAction() {
7376
final Collection<String> privileges = findPrivilegesThatGrant(GetRollupIndexCapsAction.NAME);
74-
assertThat(Set.copyOf(privileges), equalTo(Set.of("read", "view_index_metadata", "manage", "all")));
77+
assertThat(
78+
Set.copyOf(privileges),
79+
equalTo(Set.of("manage", "all", "read_failure_store", "view_index_metadata", "read", "manage_failure_store_internal"))
80+
);
7581
}
7682

7783
public void testPrivilegesForGetCheckPointAction() {
7884
assertThat(
7985
findPrivilegesThatGrant(GetCheckpointAction.NAME),
80-
containsInAnyOrder("monitor", "view_index_metadata", "manage", "all")
86+
containsInAnyOrder("monitor", "view_index_metadata", "manage", "manage_failure_store_internal", "all")
8187
);
8288
}
8389

0 commit comments

Comments
 (0)