michaeljmarshall commented on a change in pull request #12515:
URL: https://github.com/apache/pulsar/pull/12515#discussion_r738021805



##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java
##########
@@ -274,7 +275,39 @@ public void initialize(ServiceConfiguration conf, 
PulsarResources pulsarResource
     @Override
     public CompletableFuture<Void> grantPermissionAsync(TopicName topicName, 
Set<AuthAction> actions,
             String role, String authDataJson) {
-        return grantPermissionAsync(topicName.getNamespaceObject(), actions, 
role, authDataJson);
+        CompletableFuture<Void> result = new CompletableFuture<>();
+        try {
+            validatePoliciesReadOnlyAccess();
+        } catch (Exception e) {
+            result.completeExceptionally(e);
+            return result;
+        }
+
+        String topicUri = topicName.toString();
+        try {
+            
pulsarResources.getNamespaceResources().setPolicies(topicName.getNamespaceObject(),
 policies -> {

Review comment:
       I've updated it to use the same logic found in the 
`updateSubscriptionPermissionAsync` method.




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