8686import org .elasticsearch .xpack .core .security .authz .privilege .ApplicationPrivilegeTests ;
8787import org .elasticsearch .xpack .core .security .authz .privilege .ClusterPrivilegeResolver ;
8888import org .elasticsearch .xpack .core .security .authz .privilege .ConfigurableClusterPrivilege ;
89- import org .elasticsearch .xpack .core .security .authz .privilege .IndexComponentSelectorPrivilege ;
9089import org .elasticsearch .xpack .core .security .authz .privilege .IndexPrivilege ;
9190import org .elasticsearch .xpack .core .security .authz .restriction .Workflow ;
9291import org .elasticsearch .xpack .core .security .authz .restriction .WorkflowResolver ;
@@ -1270,7 +1269,6 @@ public void testBuildRoleWithFlsAndDlsInRemoteIndicesDefinition() {
12701269 false ,
12711270 "{\" match\" :{\" field\" :\" a\" }}" ,
12721271 new FieldPermissionsDefinition .FieldGrantExcludeGroup (new String [] { "field" }, null ),
1273- IndexComponentSelectorPrivilege .DATA ,
12741272 "index-1"
12751273 )
12761274 );
@@ -1306,15 +1304,13 @@ public void testBuildRoleWithFlsAndDlsInRemoteIndicesDefinition() {
13061304 false ,
13071305 "{\" match\" :{\" field\" :\" a\" }}" ,
13081306 new FieldPermissionsDefinition .FieldGrantExcludeGroup (new String [] { "field" }, null ),
1309- IndexComponentSelectorPrivilege .DATA ,
13101307 "index-1"
13111308 ),
13121309 indexGroup (
13131310 IndexPrivilege .READ ,
13141311 false ,
13151312 "{\" match\" :{\" field\" :\" b\" }}" ,
13161313 new FieldPermissionsDefinition .FieldGrantExcludeGroup (new String [] { "other" }, null ),
1317- IndexComponentSelectorPrivilege .DATA ,
13181314 "index-1"
13191315 )
13201316 );
@@ -1542,10 +1538,7 @@ public void testBuildRoleWithReadFailureStorePrivilegeOnly() {
15421538 new IndicesPrivileges [] { IndicesPrivileges .builder ().indices (indexPattern ).privileges ("read_failure_store" ).build () }
15431539 )
15441540 );
1545- assertHasIndexGroups (
1546- role .indices (),
1547- indexGroup (IndexPrivilege .READ_FAILURE_STORE , false , IndexComponentSelectorPrivilege .FAILURES , indexPattern )
1548- );
1541+ assertHasIndexGroups (role .indices (), indexGroup (IndexPrivilege .READ_FAILURE_STORE , false , indexPattern ));
15491542 }
15501543
15511544 public void testBuildRoleWithReadFailureStorePrivilegeDuplicatesMerged () {
@@ -1558,10 +1551,7 @@ public void testBuildRoleWithReadFailureStorePrivilegeDuplicatesMerged() {
15581551 IndicesPrivileges .builder ().indices (indexPattern ).privileges ("read_failure_store" ).build () }
15591552 )
15601553 );
1561- assertHasIndexGroups (
1562- role .indices (),
1563- indexGroup (IndexPrivilege .READ_FAILURE_STORE , false , IndexComponentSelectorPrivilege .FAILURES , indexPattern )
1564- );
1554+ assertHasIndexGroups (role .indices (), indexGroup (IndexPrivilege .READ_FAILURE_STORE , false , indexPattern ));
15651555 }
15661556
15671557 public void testBuildRoleWithReadFailureStoreAndReadPrivilegeSplit () {
@@ -1575,8 +1565,8 @@ public void testBuildRoleWithReadFailureStoreAndReadPrivilegeSplit() {
15751565 );
15761566 assertHasIndexGroups (
15771567 role .indices (),
1578- indexGroup (IndexPrivilege .READ_FAILURE_STORE , false , IndexComponentSelectorPrivilege . FAILURES , indexPattern ),
1579- indexGroup (IndexPrivilege .READ , false , IndexComponentSelectorPrivilege . DATA , indexPattern )
1568+ indexGroup (IndexPrivilege .READ_FAILURE_STORE , false , indexPattern ),
1569+ indexGroup (IndexPrivilege .READ , false , indexPattern )
15801570 );
15811571 }
15821572
@@ -1592,8 +1582,8 @@ public void testBuildRoleWithMultipleReadFailureStoreAndReadPrivilegeSplit() {
15921582 );
15931583 assertHasIndexGroups (
15941584 role .indices (),
1595- indexGroup (IndexPrivilege .READ_FAILURE_STORE , false , IndexComponentSelectorPrivilege . FAILURES , indexPattern ),
1596- indexGroup (IndexPrivilege .READ , false , IndexComponentSelectorPrivilege . DATA , indexPattern )
1585+ indexGroup (IndexPrivilege .READ_FAILURE_STORE , false , indexPattern ),
1586+ indexGroup (IndexPrivilege .READ , false , indexPattern )
15971587 );
15981588 }
15991589
@@ -1609,12 +1599,7 @@ public void testBuildRoleWithAllPrivilegeIsNeverSplit() {
16091599 );
16101600 assertHasIndexGroups (
16111601 role .indices (),
1612- indexGroup (
1613- IndexPrivilege .get (Set .of ("read" , "read_failure_store" , "all" )),
1614- false ,
1615- IndexComponentSelectorPrivilege .ALL ,
1616- indexPattern
1617- )
1602+ indexGroup (IndexPrivilege .get (Set .of ("read" , "read_failure_store" , "all" )), false , indexPattern )
16181603 );
16191604 }
16201605
@@ -3470,23 +3455,6 @@ private static Matcher<IndicesPermission.Group> indexGroup(
34703455 allowRestrictedIndices ,
34713456 null ,
34723457 new FieldPermissionsDefinition .FieldGrantExcludeGroup (null , null ),
3473- IndexComponentSelectorPrivilege .DATA ,
3474- indices
3475- );
3476- }
3477-
3478- private static Matcher <IndicesPermission .Group > indexGroup (
3479- final IndexPrivilege privilege ,
3480- final boolean allowRestrictedIndices ,
3481- final IndexComponentSelectorPrivilege selectorPrivilege ,
3482- final String ... indices
3483- ) {
3484- return indexGroup (
3485- privilege ,
3486- allowRestrictedIndices ,
3487- null ,
3488- new FieldPermissionsDefinition .FieldGrantExcludeGroup (null , null ),
3489- selectorPrivilege ,
34903458 indices
34913459 );
34923460 }
@@ -3496,7 +3464,6 @@ private static Matcher<IndicesPermission.Group> indexGroup(
34963464 final boolean allowRestrictedIndices ,
34973465 @ Nullable final String query ,
34983466 final FieldPermissionsDefinition .FieldGrantExcludeGroup flsGroup ,
3499- IndexComponentSelectorPrivilege selectorPrivilege ,
35003467 final String ... indices
35013468 ) {
35023469 return new BaseMatcher <>() {
@@ -3510,7 +3477,6 @@ public boolean matches(Object o) {
35103477 && equalTo (privilege ).matches (group .privilege ())
35113478 && equalTo (allowRestrictedIndices ).matches (group .allowRestrictedIndices ())
35123479 && equalTo (new FieldPermissions (new FieldPermissionsDefinition (Set .of (flsGroup )))).matches (group .getFieldPermissions ())
3513- && equalTo (selectorPrivilege ).matches (group .getSelectorPrivilege ())
35143480 && arrayContaining (indices ).matches (group .indices ());
35153481 }
35163482
@@ -3528,8 +3494,6 @@ public void describeTo(Description description) {
35283494 + query
35293495 + ", fieldGrantExcludeGroup="
35303496 + flsGroup
3531- + ", selectorPrivilege="
3532- + selectorPrivilege
35333497 + '}'
35343498 );
35353499 }
0 commit comments