abhishekrb19 commented on code in PR #19272:
URL: https://github.com/apache/druid/pull/19272#discussion_r3113323072


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResource.java:
##########
@@ -201,10 +201,20 @@ public Response specGetAll(
   {
     return asLeaderWithSupervisorManager(
         manager -> {
-          Set<String> authorizedSupervisorIds = filterAuthorizedSupervisorIds(
-              req,
-              manager,
-              manager.getSupervisorIds()
+          Function<String, Iterable<ResourceAction>> readRaGenerator = 
supervisorId -> {
+            Optional<SupervisorSpec> supervisorSpecOptional = 
manager.getSupervisorSpec(supervisorId);
+            return supervisorSpecOptional
+                .transform(spec -> SPEC_DATASOURCE_READ_RA_GENERATOR.apply(new 
VersionedSupervisorSpec(spec, null)))

Review Comment:
   Just confirming that applying a transform directly on the optional 
`supervisorSpecOptional` won’t cause any issues without checking 
`.isPresent()`. It seems like it won’t, but I noticed this differs from the 
logic in `filterAuthorizedSupervisorIds()`



##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResource.java:
##########
@@ -201,10 +201,20 @@ public Response specGetAll(
   {
     return asLeaderWithSupervisorManager(
         manager -> {
-          Set<String> authorizedSupervisorIds = filterAuthorizedSupervisorIds(
-              req,
-              manager,
-              manager.getSupervisorIds()
+          Function<String, Iterable<ResourceAction>> readRaGenerator = 
supervisorId -> {
+            Optional<SupervisorSpec> supervisorSpecOptional = 
manager.getSupervisorSpec(supervisorId);
+            return supervisorSpecOptional
+                .transform(spec -> SPEC_DATASOURCE_READ_RA_GENERATOR.apply(new 
VersionedSupervisorSpec(spec, null)))

Review Comment:
   What do you think about adding a function like 
`filterAuthorizedSupervisorIdsForRead()` to make read access explicit? So any 
new read-only APIs know to call this function instead of 
`filterAuthorizedSupervisorIds()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to