nodece commented on code in PR #16792:
URL: https://github.com/apache/pulsar/pull/16792#discussion_r951134496


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -319,21 +319,10 @@ protected void internalGrantPermissionsOnTopic(final 
AsyncResponse asyncResponse
                                                    Set<AuthAction> actions) {
         // This operation should be reading from zookeeper and it should be 
allowed without having admin privileges
         validateAdminAccessForTenantAsync(namespaceName.getTenant())
-                .thenCompose(__ -> 
validatePoliciesReadOnlyAccessAsync().thenCompose(unused1 ->
-             getPartitionedTopicMetadataAsync(topicName, true, false)
-                  .thenCompose(metadata -> {
-                      int numPartitions = metadata.partitions;
-                      CompletableFuture<Void> future = 
CompletableFuture.completedFuture(null);
-                      if (numPartitions > 0) {
-                          for (int i = 0; i < numPartitions; i++) {
-                              TopicName topicNamePartition = 
topicName.getPartition(i);
-                              future = future.thenCompose(unused -> 
grantPermissionsAsync(topicNamePartition, role,
-                                      actions));
-                          }
-                      }
-                      return future.thenCompose(unused -> 
grantPermissionsAsync(topicName, role, actions))
-                              .thenAccept(unused -> 
asyncResponse.resume(Response.noContent().build()));
-                  }))).exceptionally(ex -> {
+                .thenCompose(__ -> validatePoliciesReadOnlyAccessAsync()
+                        .thenCompose(unused1 -> 
grantPermissionsAsync(topicName, role, actions)

Review Comment:
   Should be `topicName.getPartitionedTopicName()`?



-- 
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]

Reply via email to