|
20 | 20 | import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesAction; |
21 | 21 | import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateAction; |
22 | 22 | import org.elasticsearch.action.bulk.BulkAction; |
| 23 | +import org.elasticsearch.action.datastreams.GetDataStreamAction; |
23 | 24 | import org.elasticsearch.action.delete.DeleteAction; |
24 | 25 | import org.elasticsearch.action.get.GetAction; |
25 | 26 | import org.elasticsearch.action.get.MultiGetAction; |
|
31 | 32 | import org.elasticsearch.common.Strings; |
32 | 33 | import org.elasticsearch.test.ESTestCase; |
33 | 34 | import org.elasticsearch.transport.TransportRequest; |
| 35 | +import org.elasticsearch.xpack.core.ilm.action.ExplainLifecycleAction; |
34 | 36 | import org.elasticsearch.xpack.core.ilm.action.GetLifecycleAction; |
35 | 37 | import org.elasticsearch.xpack.core.ilm.action.PutLifecycleAction; |
36 | 38 | import org.elasticsearch.xpack.core.ml.action.CloseJobAction; |
@@ -367,6 +369,19 @@ public void testElasticEnterpriseSearchServerAccount() { |
367 | 369 | assertThat(role.indices().allowedIndicesMatcher(RefreshAction.NAME).test(enterpriseSearchIndex), is(true)); |
368 | 370 | assertThat(role.indices().allowedIndicesMatcher("indices:foo").test(enterpriseSearchIndex), is(false)); |
369 | 371 | }); |
| 372 | + |
| 373 | + final IndexAbstraction elasticsearchIndex = mockIndexAbstraction("search-" + randomAlphaOfLengthBetween(1, 20)); |
| 374 | + // read |
| 375 | + assertThat(role.indices().allowedIndicesMatcher(GetAction.NAME).test(elasticsearchIndex), is(true)); |
| 376 | + assertThat(role.indices().allowedIndicesMatcher(MultiGetAction.NAME).test(elasticsearchIndex), is(true)); |
| 377 | + assertThat(role.indices().allowedIndicesMatcher(SearchAction.NAME).test(elasticsearchIndex), is(true)); |
| 378 | + assertThat(role.indices().allowedIndicesMatcher(MultiSearchAction.NAME).test(elasticsearchIndex), is(true)); |
| 379 | + // view_index_metadata |
| 380 | + assertThat(role.indices().allowedIndicesMatcher(GetDataStreamAction.NAME).test(elasticsearchIndex), is(true)); |
| 381 | + assertThat(role.indices().allowedIndicesMatcher(ExplainLifecycleAction.NAME).test(elasticsearchIndex), is(true)); |
| 382 | + // ingestion and delete are forbidden |
| 383 | + assertThat(role.indices().allowedIndicesMatcher(IndexAction.NAME).test(elasticsearchIndex), is(false)); |
| 384 | + assertThat(role.indices().allowedIndicesMatcher(DeleteAction.NAME).test(elasticsearchIndex), is(false)); |
370 | 385 | } |
371 | 386 |
|
372 | 387 | private IndexAbstraction mockIndexAbstraction(String name) { |
|
0 commit comments