michaeljmarshall commented on a change in pull request #12515:
URL: https://github.com/apache/pulsar/pull/12515#discussion_r738015302
##########
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:
Great catch. It looks like `grantPermissionAsync(NamespaceName
namespaceName, Set<AuthAction> actions, String role, String authDataJson)` has
the same issue. I'll follow up with an update to that method separately.
Further, I'd like to update the calling methods to be asynchronous instead of
calling `.get` on the future.
--
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]