@@ -200,8 +200,8 @@ public void testIsReserved() {
200
200
assertThat (ReservedRolesStore .isReserved (RemoteMonitoringUser .COLLECTION_ROLE_NAME ), is (true ));
201
201
assertThat (ReservedRolesStore .isReserved (RemoteMonitoringUser .INDEXING_ROLE_NAME ), is (true ));
202
202
assertThat (ReservedRolesStore .isReserved ("snapshot_user" ), is (true ));
203
- assertThat (ReservedRolesStore .isReserved ("code_admin" ), is (true ));
204
- assertThat (ReservedRolesStore .isReserved ("code_user" ), is (true ));
203
+ assertThat (ReservedRolesStore .isReserved ("code_admin" ), is (false ));
204
+ assertThat (ReservedRolesStore .isReserved ("code_user" ), is (false ));
205
205
}
206
206
207
207
public void testSnapshotUserRole () {
@@ -1383,60 +1383,4 @@ public void testLogstashAdminRole() {
1383
1383
assertThat (logstashAdminRole .indices ().allowedIndicesMatcher (MultiSearchAction .NAME ).test (index ), is (true ));
1384
1384
assertThat (logstashAdminRole .indices ().allowedIndicesMatcher (UpdateSettingsAction .NAME ).test (index ), is (true ));
1385
1385
}
1386
-
1387
- public void testCodeAdminRole () {
1388
- RoleDescriptor roleDescriptor = new ReservedRolesStore ().roleDescriptor ("code_admin" );
1389
- assertNotNull (roleDescriptor );
1390
- assertThat (roleDescriptor .getMetadata (), hasEntry ("_reserved" , true ));
1391
-
1392
- Role codeAdminRole = Role .builder (roleDescriptor , null ).build ();
1393
-
1394
- assertThat (codeAdminRole .cluster ().check (DelegatePkiAuthenticationAction .NAME , mock (TransportRequest .class ),
1395
- mock (Authentication .class )), is (false ));
1396
-
1397
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (IndexAction .NAME ).test ("foo" ), is (false ));
1398
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (IndexAction .NAME ).test (".reporting" ), is (false ));
1399
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (IndexAction .NAME ).test (".code-" ), is (true ));
1400
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher ("indices:foo" ).test (randomAlphaOfLengthBetween (8 , 24 )),
1401
- is (false ));
1402
-
1403
- final String index = ".code-" + randomIntBetween (0 , 5 );
1404
-
1405
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (DeleteAction .NAME ).test (index ), is (true ));
1406
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (DeleteIndexAction .NAME ).test (index ), is (true ));
1407
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (CreateIndexAction .NAME ).test (index ), is (true ));
1408
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (IndexAction .NAME ).test (index ), is (true ));
1409
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (GetAction .NAME ).test (index ), is (true ));
1410
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (SearchAction .NAME ).test (index ), is (true ));
1411
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (MultiSearchAction .NAME ).test (index ), is (true ));
1412
- assertThat (codeAdminRole .indices ().allowedIndicesMatcher (UpdateSettingsAction .NAME ).test (index ), is (true ));
1413
- }
1414
-
1415
- public void testCodeUserRole () {
1416
- RoleDescriptor roleDescriptor = new ReservedRolesStore ().roleDescriptor ("code_user" );
1417
- assertNotNull (roleDescriptor );
1418
- assertThat (roleDescriptor .getMetadata (), hasEntry ("_reserved" , true ));
1419
-
1420
- Role codeUserRole = Role .builder (roleDescriptor , null ).build ();
1421
-
1422
- assertThat (codeUserRole .cluster ().check (DelegatePkiAuthenticationAction .NAME , mock (TransportRequest .class ),
1423
- mock (Authentication .class )), is (false ));
1424
-
1425
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (SearchAction .NAME ).test ("foo" ), is (false ));
1426
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (SearchAction .NAME ).test (".reporting" ), is (false ));
1427
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (SearchAction .NAME ).test (".code-" ), is (true ));
1428
- assertThat (codeUserRole .indices ().allowedIndicesMatcher ("indices:foo" ).test (randomAlphaOfLengthBetween (8 , 24 )),
1429
- is (false ));
1430
-
1431
- final String index = ".code-" + randomIntBetween (0 , 5 );
1432
-
1433
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (DeleteAction .NAME ).test (index ), is (false ));
1434
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (DeleteIndexAction .NAME ).test (index ), is (false ));
1435
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (CreateIndexAction .NAME ).test (index ), is (false ));
1436
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (IndexAction .NAME ).test (index ), is (false ));
1437
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (GetAction .NAME ).test (index ), is (true ));
1438
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (SearchAction .NAME ).test (index ), is (true ));
1439
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (MultiSearchAction .NAME ).test (index ), is (true ));
1440
- assertThat (codeUserRole .indices ().allowedIndicesMatcher (UpdateSettingsAction .NAME ).test (index ), is (false ));
1441
- }
1442
1386
}
0 commit comments