Technoboy- commented on code in PR #23372:
URL: https://github.com/apache/pulsar/pull/23372#discussion_r1794452093


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java:
##########
@@ -251,6 +254,68 @@ public CompletableFuture<Void> 
grantPermissionAsync(TopicName topicName, Set<Aut
         });
     }
 
+    public CompletableFuture<Void> 
grantPermissionAsync(List<GrantTopicPermissionOptions> options) {
+        return getPoliciesReadOnlyAsync().thenCompose(readonly -> {
+            if (readonly) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Policies are read-only. Broker cannot do 
read-write operations");
+                }
+                throw new IllegalStateException("policies are in readonly 
mode");
+            }
+            TopicName topicName = TopicName.get(options.get(0).getTopic());
+            return pulsarResources.getNamespaceResources()
+                    .setPoliciesAsync(topicName.getNamespaceObject(), policies 
-> {

Review Comment:
   yes, Lari, should be in the same namespace.
   I have checked it in the Rest Part. I will add the check here.



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