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

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

commit e70283b719ebdb6efc68de24820eaffa71ddd4cc
Author: peacewong <[email protected]>
AuthorDate: Mon Dec 19 21:04:10 2022 +0800

    Revert "fix user priv (#3977)"
    
    This reverts commit 5cdf8d04adb3018028ba14c3519bc518d6e96019.
---
 .../linkis/bml/dao/impl/BmlProjectMapper.xml       |  2 +-
 .../linkis/bml/restful/BmlProjectRestful.java      | 38 +---------------------
 .../bml/service/impl/BmlProjectServiceImpl.java    | 34 ++-----------------
 3 files changed, 4 insertions(+), 70 deletions(-)

diff --git 
a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/dao/impl/BmlProjectMapper.xml
 
b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/dao/impl/BmlProjectMapper.xml
index f2157c2af..83f8472a0 100644
--- 
a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/dao/impl/BmlProjectMapper.xml
+++ 
b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/dao/impl/BmlProjectMapper.xml
@@ -35,7 +35,7 @@
     </insert>
     <select id="getPrivInProject" resultType="java.lang.Integer">
         select a.priv from linkis_ps_bml_project_user a join 
linkis_ps_bml_project b on
-        a.project_id = b.id and b.name = #{projectName} and a.username = 
#{username} order by a.priv desc limit 1
+        a.project_id = b.id and b.name = #{projectName} and a.username = 
#{username}
     </select>
     <insert id="addProjectResource" >
         insert ignore into linkis_ps_bml_project_resource(project_id, 
resource_id)
diff --git 
a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/restful/BmlProjectRestful.java
 
b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/restful/BmlProjectRestful.java
index 4c6985916..652e393c5 100644
--- 
a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/restful/BmlProjectRestful.java
+++ 
b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/restful/BmlProjectRestful.java
@@ -233,24 +233,6 @@ public class BmlProjectRestful {
     Message message;
     try {
       String projectName = 
bmlProjectService.getProjectNameByResourceId(resourceId);
-      if (StringUtils.isBlank(projectName)) {
-        LOGGER.error(
-            "The project name of user {}'s resourceId: {} is empty.  Contact 
the administrator. (用户{}的资源:{}对应的项目名称为空,请联系管理员。)",
-            username,
-            resourceId,
-            username,
-            resourceId);
-        throw new BmlProjectNoEditException(
-            "The project name of user "
-                + username
-                + "'s resourceId: "
-                + resourceId
-                + " is empty.  Contact the administrator. (用户"
-                + username
-                + "的资源:"
-                + resourceId
-                + "对应的项目名称为空,请联系管理员。)");
-      }
       if (!bmlProjectService.checkEditPriv(projectName, username)) {
         LOGGER.error(
             "{} does not have edit permission on project {}. Upload resource 
failed ({} 对工程 {} 没有编辑权限, 上传资源失败)",
@@ -334,24 +316,6 @@ public class BmlProjectRestful {
             "downloadShareResource,resourceId:{0},version:{1}", resourceId, 
version));
     try {
       String projectName = 
bmlProjectService.getProjectNameByResourceId(resourceId);
-      if (StringUtils.isBlank(projectName)) {
-        LOGGER.error(
-            "The project name of user {}'s resourceId: {} is empty.  Contact 
the administrator. (用户{}的资源:{}对应的项目名称为空,请联系管理员。)",
-            user,
-            resourceId,
-            user,
-            resourceId);
-        throw new BmlProjectNoEditException(
-            "The project name of user "
-                + user
-                + "'s resourceId: "
-                + resourceId
-                + " is empty.  Contact the administrator. (用户"
-                + user
-                + "的资源:"
-                + resourceId
-                + "对应的项目名称为空,请联系管理员。)");
-      }
       if (!bmlProjectService.checkAccessPriv(projectName, user)) {
         LOGGER.error(
             "{} does not have view privileges on project {}. Download resource 
failed({} 对工程 {} 没有查看权限, 下载资源失败)",
@@ -367,7 +331,7 @@ public class BmlProjectRestful {
                 + user
                 + " 对工程 { "
                 + projectName
-                + " }没有编辑权限, 下载资源失败");
+                + " }没有编辑权限,上传资源失败");
       }
       LOGGER.info(
           "user {} begin to downLoad resource resourceId is {}, version is {} 
,ip is {}, 并代理成hadoop ",
diff --git 
a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/service/impl/BmlProjectServiceImpl.java
 
b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/service/impl/BmlProjectServiceImpl.java
index df98a6ad0..086a257e9 100644
--- 
a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/service/impl/BmlProjectServiceImpl.java
+++ 
b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/main/java/org/apache/linkis/bml/service/impl/BmlProjectServiceImpl.java
@@ -75,24 +75,9 @@ public class BmlProjectServiceImpl implements 
BmlProjectService {
   public boolean checkEditPriv(String projectName, String username) {
     try {
       Integer priv = bmlProjectDao.getPrivInProject(projectName, username);
-      if (null == priv) {
-        LOGGER.warn(
-            "The permission of {} is null on project {}, verification failure. 
(用户{}对工程{}的权限为空,权限校验失败。)",
-            username,
-            projectName,
-            username,
-            projectName);
-        return false;
-      }
       return priv >= DEFAULT_EDIT_PRIV;
     } catch (Exception e) {
-      LOGGER.error(
-          "User {} fails to obtain the permission on project {}, verification 
failure. (用户{}获取工程{}权限异常,权限校验失败。)",
-          username,
-          projectName,
-          username,
-          projectName);
-      return false;
+      return true;
     }
   }
 
@@ -100,24 +85,9 @@ public class BmlProjectServiceImpl implements 
BmlProjectService {
   public boolean checkAccessPriv(String projectName, String username) {
     try {
       Integer priv = bmlProjectDao.getPrivInProject(projectName, username);
-      if (null == priv) {
-        LOGGER.warn(
-            "The permission of {} is null on project {}, verification failure. 
(用户{}对工程{}的权限为空,权限校验失败。)",
-            username,
-            projectName,
-            username,
-            projectName);
-        return false;
-      }
       return priv >= DEFAULT_ACCESS_PRIV;
     } catch (Exception e) {
-      LOGGER.error(
-          "User {} fails to obtain the permission on project {}, verification 
failure. (用户{}获取工程{}权限异常,权限校验失败。)",
-          username,
-          projectName,
-          username,
-          projectName);
-      return false;
+      return true;
     }
   }
 


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

Reply via email to