You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "nodece (via GitHub)" <gi...@apache.org> on 2023/04/20 05:32:53 UTC

[GitHub] [pulsar] nodece commented on a diff in pull request #20145: [fix][broker] Move superuser/tenantAdmin checks to AuthorizationService from PulsarAuthorizationProvider

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


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/AuthorizationService.java:
##########
@@ -183,7 +183,15 @@ public CompletableFuture<Boolean> canProduceAsync(TopicName topicName, String ro
         if (!this.conf.isAuthorizationEnabled()) {
             return CompletableFuture.completedFuture(true);
         }
-        return provider.allowTopicOperationAsync(topicName, role, TopicOperation.PRODUCE, authenticationData);
+
+        return isSuperUserOrAdmin(topicName.getTenant(), role, authenticationData)

Review Comment:
   > I think our target design should be to let the `AuthorizationProvider` implementation decide what level of permission is required
   
   We have `isTenantAdmin` and `isSuperUser` methods in the `AuthorizationProvider`. The user just overrides that to decide what level of permission is required. When `isTenantAdmin` and `isSuperUser` return `false`, the `AuthorizationService` call to the `AuthorizationProvider`.
   
   There is another reason that I think plugin authors should not pay attention to `isTenantAdmin` and `isSuperUser` details.
   
   
   
   
   
   
   
   
   
   



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org