Technoboy- commented on code in PR #20496:
URL: https://github.com/apache/pulsar/pull/20496#discussion_r1255441168
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java:
##########
@@ -641,4 +643,131 @@ public CompletableFuture<Boolean>
validateTenantAdminAccess(String tenantName, S
});
}
+ @Override
+ public CompletableFuture<Void> removePermissionsAsync(TopicName topicName)
{
+ 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");
+ }
+ return
pulsarResources.getNamespaceResources().getPoliciesAsync(topicName.getNamespaceObject())
+ .thenCompose(policies -> {
+ if (!policies.isPresent()
+ ||
!policies.get().auth_policies.getTopicAuthentication()
+ .containsKey(topicName.toString())) {
+ return CompletableFuture.completedFuture(null);
+ }
+ return pulsarResources.getNamespaceResources().
+
setPoliciesAsync(topicName.getNamespaceObject(), policies2 -> {
+
policies2.auth_policies.getTopicAuthentication().remove(topicName.toString());
Review Comment:
See line-657
--
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]