This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.3.2
in repository https://gitbox.apache.org/repos/asf/linkis.git


The following commit(s) were added to refs/heads/dev-1.3.2 by this push:
     new bf4fb143a fix: Tenant label management module check label mapping 
error.(#4241) (#4242)
bf4fb143a is described below

commit bf4fb143a87d171cd84e236093adf8868d926d71
Author: CharlieYan <[email protected]>
AuthorDate: Mon Feb 20 11:49:36 2023 +0800

    fix: Tenant label management module check label mapping error.(#4241) 
(#4242)
    
    Co-authored-by: CharlieYan <[email protected]>
---
 .../restful/api/TenantConfigrationRestfulApi.java             |  4 ++--
 .../linkis/configuration/service/TenantConfigService.java     |  3 +--
 .../configuration/service/impl/TenantConfigServiceImpl.java   | 11 ++++++++---
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git 
a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/restful/api/TenantConfigrationRestfulApi.java
 
b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/restful/api/TenantConfigrationRestfulApi.java
index 2db570ab8..e399849be 100644
--- 
a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/restful/api/TenantConfigrationRestfulApi.java
+++ 
b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/restful/api/TenantConfigrationRestfulApi.java
@@ -75,7 +75,7 @@ public class TenantConfigrationRestfulApi {
       if (!Configuration.isAdmin(userName)) {
         return Message.error("Failed to create-tenant,msg: only administrators 
can configure");
       }
-      if (tenantConfigService.checkUserCteator(tenantVo.getUser(), 
tenantVo.getCreator(), null)) {
+      if (tenantConfigService.userExists(tenantVo.getUser(), 
tenantVo.getCreator(), null)) {
         throw new ConfigurationException("User-creator is existed");
       }
       parameterVerification(tenantVo);
@@ -243,7 +243,7 @@ public class TenantConfigrationRestfulApi {
       if (!Configuration.isAdmin(userName)) {
         return Message.error("Failed to check-user-creator,msg: only 
administrators can configure");
       }
-      result = tenantConfigService.checkUserCteator(user, creator, 
tenantValue);
+      result = tenantConfigService.userExists(user, creator, tenantValue);
     } catch (ConfigurationException e) {
       return Message.error("Failed to check-user-creator,msg:" + 
e.getMessage());
     }
diff --git 
a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/TenantConfigService.java
 
b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/TenantConfigService.java
index 3e6ba85a8..3d07ad676 100644
--- 
a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/TenantConfigService.java
+++ 
b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/TenantConfigService.java
@@ -33,8 +33,7 @@ public interface TenantConfigService {
 
   void createTenant(TenantVo tenantVo) throws ConfigurationException;
 
-  Boolean checkUserCteator(String user, String creator, String tenantValue)
-      throws ConfigurationException;
+  Boolean userExists(String user, String creator, String tenantValue) throws 
ConfigurationException;
 
   TenantVo queryTenant(String user, String creator);
 }
diff --git 
a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/impl/TenantConfigServiceImpl.java
 
b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/impl/TenantConfigServiceImpl.java
index 932c10e48..8f1cd7f6e 100644
--- 
a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/impl/TenantConfigServiceImpl.java
+++ 
b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/impl/TenantConfigServiceImpl.java
@@ -61,6 +61,12 @@ public class TenantConfigServiceImpl implements 
TenantConfigService {
       String user, String creator, String tenantValue, Integer pageNow, 
Integer pageSize) {
     Map<String, Object> result = new HashMap<>(2);
     List<TenantVo> tenantVos = null;
+    if (Objects.isNull(pageNow)) {
+      pageNow = 1;
+    }
+    if (Objects.isNull(pageSize)) {
+      pageSize = 20;
+    }
     PageHelper.startPage(pageNow, pageSize);
     try {
       tenantVos = userTenantMapper.queryTenantList(user, creator, tenantValue);
@@ -155,11 +161,10 @@ public class TenantConfigServiceImpl implements 
TenantConfigService {
   }
 
   @Override
-  public Boolean checkUserCteator(String user, String creator, String 
tenantValue)
-      throws ConfigurationException {
+  public Boolean userExists(String user, String creator, String tenantValue) {
     boolean result = true;
     Map<String, Object> resultMap =
-        queryTenantList(user.toLowerCase(), creator.toLowerCase(), null, null, 
null);
+        queryTenantList(user.toLowerCase(), creator.toLowerCase(), null, 1, 
20);
     Object tenantList = 
resultMap.getOrDefault(JobRequestConstants.TOTAL_PAGE(), 0);
     int total = Integer.parseInt(tenantList.toString());
     if (total == 0) result = false;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to