You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/05/01 23:57:28 UTC

[GitHub] [pulsar] srkukarni commented on a change in pull request #4188: provide better error handling logic for function authorization when a tenant doesn't exist

srkukarni commented on a change in pull request #4188: provide better error handling logic for function authorization when a tenant doesn't exist
URL: https://github.com/apache/pulsar/pull/4188#discussion_r280257173
 
 

 ##########
 File path: pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java
 ##########
 @@ -1694,9 +1694,13 @@ public boolean isAuthorizedRole(String tenant, String namespace, String clientRo
             }
 
             if (clientRole != null) {
-                TenantInfo tenantInfo = worker().getBrokerAdmin().tenants().getTenantInfo(tenant);
-                if (tenantInfo.getAdminRoles() != null && tenantInfo.getAdminRoles().contains(clientRole)) {
-                    return true;
+                try {
+                    TenantInfo tenantInfo = worker().getBrokerAdmin().tenants().getTenantInfo(tenant);
+                    if (tenantInfo != null && tenantInfo.getAdminRoles() != null && tenantInfo.getAdminRoles().contains(clientRole)) {
+                        return true;
+                    }
+                } catch (PulsarAdminException.NotFoundException e) {
+
 
 Review comment:
   dont really understand whats the intention here? if the tenant doesn't exist, won';t it fail in the next call for getting namespaces in that tenant?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services