michaeljmarshall commented on code in PR #20068:
URL: https://github.com/apache/pulsar/pull/20068#discussion_r1164298751
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java:
##########
@@ -84,7 +84,18 @@ public void initialize(ServiceConfiguration conf,
PulsarResources pulsarResource
@Override
public CompletableFuture<Boolean> canProduceAsync(TopicName topicName,
String role,
AuthenticationDataSource authenticationData) {
- return checkAuthorization(topicName, role, AuthAction.produce);
+ return validateTenantAdminAccess(topicName.getTenant(), role,
authenticationData)
+ .thenCompose(isSuperUserOrAdmin -> {
+ if (log.isDebugEnabled()) {
+ log.debug("Verify if role {} is allowed to produce
topic {}: isSuperUserOrAdmin={}",
+ role, topicName, isSuperUserOrAdmin);
+ }
+ if (isSuperUserOrAdmin) {
+ return CompletableFuture.completedFuture(true);
+ } else {
+ return checkAuthorization(topicName, role,
AuthAction.produce);
+ }
+ });
Review Comment:
@dragonls - I just noticed the rest of the conversation above. What I don't
see is an answer explaining why we don't migrate from `canProduceAsync` to
`allowTopicOperationAsync`. Do you mind addressing that point? Thanks!
--
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]