@@ -503,7 +503,8 @@ public static <ConfigType extends Config, GetConfigResponseType extends ActionRe
503
503
Client client ,
504
504
ClusterService clusterService ,
505
505
NamedXContentRegistry xContentRegistry ,
506
- Class <ConfigType > configTypeClass
506
+ Class <ConfigType > configTypeClass ,
507
+ boolean resourceSharingEnabled
507
508
) {
508
509
try {
509
510
if (requestedUser == null || configId == null ) {
@@ -520,7 +521,8 @@ public static <ConfigType extends Config, GetConfigResponseType extends ActionRe
520
521
clusterService ,
521
522
xContentRegistry ,
522
523
filterByEnabled ,
523
- configTypeClass
524
+ configTypeClass ,
525
+ resourceSharingEnabled
524
526
);
525
527
}
526
528
} catch (Exception e ) {
@@ -550,7 +552,8 @@ public static <ConfigType extends Config, GetConfigResponseType extends ActionRe
550
552
ClusterService clusterService ,
551
553
NamedXContentRegistry xContentRegistry ,
552
554
boolean filterByBackendRole ,
553
- Class <ConfigType > configTypeClass
555
+ Class <ConfigType > configTypeClass ,
556
+ boolean resourceSharingEnabled
554
557
) {
555
558
if (clusterService .state ().metadata ().indices ().containsKey (CommonName .CONFIG_INDEX )) {
556
559
GetRequest request = new GetRequest (CommonName .CONFIG_INDEX ).id (configId );
@@ -567,7 +570,8 @@ public static <ConfigType extends Config, GetConfigResponseType extends ActionRe
567
570
function ,
568
571
xContentRegistry ,
569
572
filterByBackendRole ,
570
- configTypeClass
573
+ configTypeClass ,
574
+ resourceSharingEnabled
571
575
),
572
576
exception -> {
573
577
logger .error ("Failed to get config: " + configId , exception );
@@ -610,7 +614,8 @@ public static <ConfigType extends Config, GetConfigResponseType extends ActionRe
610
614
Consumer <ConfigType > function ,
611
615
NamedXContentRegistry xContentRegistry ,
612
616
boolean filterByBackendRole ,
613
- Class <ConfigType > configTypeClass
617
+ Class <ConfigType > configTypeClass ,
618
+ boolean resourceSharingEnabled
614
619
) {
615
620
if (response .isExists ()) {
616
621
try (
@@ -619,7 +624,7 @@ public static <ConfigType extends Config, GetConfigResponseType extends ActionRe
619
624
ensureExpectedToken (XContentParser .Token .START_OBJECT , parser .nextToken (), parser );
620
625
@ SuppressWarnings ("unchecked" )
621
626
ConfigType config = (ConfigType ) Config .parseConfig (configTypeClass , parser );
622
- if ( featureFlagEnabled ) {
627
+ if ( resourceSharingEnabled ) {
623
628
// Permission evaluation will be done at DLS level in security plugin
624
629
function .accept (config );
625
630
} else {
@@ -630,9 +635,12 @@ public static <ConfigType extends Config, GetConfigResponseType extends ActionRe
630
635
} else {
631
636
logger .debug ("User: " + requestUser .getName () + " does not have permissions to access config: " + configId );
632
637
listener
633
- .onFailure (
634
- new OpenSearchStatusException (CommonMessages .NO_PERMISSION_TO_ACCESS_CONFIG + configId , RestStatus .FORBIDDEN )
635
- );
638
+ .onFailure (
639
+ new OpenSearchStatusException (
640
+ CommonMessages .NO_PERMISSION_TO_ACCESS_CONFIG + configId ,
641
+ RestStatus .FORBIDDEN
642
+ )
643
+ );
636
644
}
637
645
}
638
646
0 commit comments