|
28 | 28 | import org.elasticsearch.action.admin.indices.get.GetIndexAction;
|
29 | 29 | import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsAction;
|
30 | 30 | import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsAction;
|
| 31 | +import org.elasticsearch.action.admin.indices.mapping.put.TransportAutoPutMappingAction; |
31 | 32 | import org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction;
|
32 | 33 | import org.elasticsearch.action.admin.indices.recovery.RecoveryAction;
|
33 | 34 | import org.elasticsearch.action.admin.indices.resolve.ResolveIndexAction;
|
@@ -3662,6 +3663,9 @@ public void testPredefinedViewerRole() {
|
3662 | 3663 | assertOnlyReadAllowed(role, ".profiling-" + randomIntBetween(0, 5));
|
3663 | 3664 | assertOnlyReadAllowed(role, randomAlphaOfLength(5));
|
3664 | 3665 |
|
| 3666 | + assertOnlyReadAllowed(role, ".slo-observability." + randomIntBetween(0, 5)); |
| 3667 | + assertViewIndexMetadata(role, ".slo-observability." + randomIntBetween(0, 5)); |
| 3668 | + |
3665 | 3669 | assertNoAccessAllowed(role, TestRestrictedIndices.SAMPLE_RESTRICTED_NAMES);
|
3666 | 3670 | assertNoAccessAllowed(role, "." + randomAlphaOfLengthBetween(6, 10));
|
3667 | 3671 | assertNoAccessAllowed(role, "ilm-history-" + randomIntBetween(0, 5));
|
@@ -3740,6 +3744,9 @@ public void testPredefinedEditorRole() {
|
3740 | 3744 | assertReadWriteDocsAndMaintenanceButNotDeleteIndexAllowed(role, ".preview.alerts-" + randomIntBetween(0, 5));
|
3741 | 3745 | assertReadWriteDocsAndMaintenanceButNotDeleteIndexAllowed(role, ".internal.preview.alerts-" + randomIntBetween(0, 5));
|
3742 | 3746 |
|
| 3747 | + assertViewIndexMetadata(role, ".slo-observability." + randomIntBetween(0, 5)); |
| 3748 | + assertReadWriteAndManage(role, ".slo-observability." + randomIntBetween(0, 5)); |
| 3749 | + |
3743 | 3750 | assertNoAccessAllowed(role, TestRestrictedIndices.SAMPLE_RESTRICTED_NAMES);
|
3744 | 3751 | assertNoAccessAllowed(role, "." + randomAlphaOfLengthBetween(6, 10));
|
3745 | 3752 | assertNoAccessAllowed(role, "ilm-history-" + randomIntBetween(0, 5));
|
@@ -3865,6 +3872,41 @@ private void assertReadWriteDocsButNotDeleteIndexAllowed(Role role, String index
|
3865 | 3872 | role.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(mockIndexAbstraction(index)),
|
3866 | 3873 | is(false)
|
3867 | 3874 | );
|
| 3875 | + |
| 3876 | + assertThat(role.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(mockIndexAbstraction(index)), is(true)); |
| 3877 | + assertThat(role.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(mockIndexAbstraction(index)), is(true)); |
| 3878 | + assertThat(role.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(mockIndexAbstraction(index)), is(true)); |
| 3879 | + assertThat(role.indices().allowedIndicesMatcher(TransportUpdateAction.NAME).test(mockIndexAbstraction(index)), is(true)); |
| 3880 | + assertThat(role.indices().allowedIndicesMatcher(TransportDeleteAction.NAME).test(mockIndexAbstraction(index)), is(true)); |
| 3881 | + assertThat(role.indices().allowedIndicesMatcher(TransportBulkAction.NAME).test(mockIndexAbstraction(index)), is(true)); |
| 3882 | + } |
| 3883 | + |
| 3884 | + private void assertReadWriteAndManage(Role role, String index) { |
| 3885 | + assertThat( |
| 3886 | + role.indices().allowedIndicesMatcher(TransportDeleteIndexAction.TYPE.name()).test(mockIndexAbstraction(index)), |
| 3887 | + is(true) |
| 3888 | + ); |
| 3889 | + assertThat( |
| 3890 | + role.indices().allowedIndicesMatcher(TransportFieldCapabilitiesAction.NAME + "*").test(mockIndexAbstraction(index)), |
| 3891 | + is(true) |
| 3892 | + ); |
| 3893 | + assertThat( |
| 3894 | + role.indices().allowedIndicesMatcher(TransportCreateIndexAction.TYPE.name()).test(mockIndexAbstraction(index)), |
| 3895 | + is(true) |
| 3896 | + ); |
| 3897 | + assertThat( |
| 3898 | + role.indices().allowedIndicesMatcher(TransportUpdateSettingsAction.TYPE.name()).test(mockIndexAbstraction(index)), |
| 3899 | + is(true) |
| 3900 | + ); |
| 3901 | + assertThat(role.indices().allowedIndicesMatcher(GetRollupIndexCapsAction.NAME + "*").test(mockIndexAbstraction(index)), is(true)); |
| 3902 | + assertThat(role.indices().allowedIndicesMatcher("indices:admin/*").test(mockIndexAbstraction(index)), is(true)); |
| 3903 | + assertThat(role.indices().allowedIndicesMatcher("indices:monitor/*").test(mockIndexAbstraction(index)), is(true)); |
| 3904 | + assertThat( |
| 3905 | + role.indices().allowedIndicesMatcher(TransportAutoPutMappingAction.TYPE.name()).test(mockIndexAbstraction(index)), |
| 3906 | + is(true) |
| 3907 | + ); |
| 3908 | + assertThat(role.indices().allowedIndicesMatcher(AutoCreateAction.NAME).test(mockIndexAbstraction(index)), is(true)); |
| 3909 | + |
3868 | 3910 | assertThat(role.indices().allowedIndicesMatcher(TransportSearchAction.TYPE.name()).test(mockIndexAbstraction(index)), is(true));
|
3869 | 3911 | assertThat(role.indices().allowedIndicesMatcher(TransportGetAction.TYPE.name()).test(mockIndexAbstraction(index)), is(true));
|
3870 | 3912 | assertThat(role.indices().allowedIndicesMatcher(TransportIndexAction.NAME).test(mockIndexAbstraction(index)), is(true));
|
|
0 commit comments