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/02 17:35:15 UTC

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

jerrypeng 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_r280523794
 
 

 ##########
 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:
   are you referring ```NamespaceName.get(tenant, namespace)```?  That just returns the correctly formatted name of the namespace

----------------------------------------------------------------
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