You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/05/31 01:31:19 UTC

[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #10303: [Bug][Api-Server]Fix bug when user without tenant uploads file in resource center

SbloodyS commented on code in PR #10303:
URL: https://github.com/apache/dolphinscheduler/pull/10303#discussion_r885137552


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java:
##########
@@ -651,7 +666,14 @@ private boolean upload(User loginUser, String fullName, MultipartFile file, Reso
             return false;
         }
         // query tenant
-        String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
+        Tenant tenant = tenantMapper.queryById(loginUser.getTenantId());
+        // this could happen when user logs in as admin
+        if (tenant == null) {
+            logger.error("fail to acquire tenant, please set tenant for login user/admin first");

Review Comment:
   It's better to put this message to the result's ```msg``` to improve user friendly.



-- 
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@dolphinscheduler.apache.org

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