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

jackietien pushed a commit to branch auth
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/auth by this push:
     new 69015e28035 fix some when read & write schema
69015e28035 is described below

commit 69015e2803510bf982f19b066537acd645c4f24d
Author: Weihao Li <[email protected]>
AuthorDate: Wed Sep 6 17:50:51 2023 +0800

    fix some when read & write schema
---
 .../java/org/apache/iotdb/confignode/persistence/AuthorInfo.java     | 3 ++-
 .../src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java     | 2 +-
 .../main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java  | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
index c50d706b2d1..6904b2ac2a5 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
@@ -131,7 +131,6 @@ public class AuthorInfo implements SnapshotProcessor {
         for (PartialPath path : paths) {
           if (!checkOnePath(username, path, permission)) {
             failedList.add(pos);
-            continue;
           }
           pos++;
         }
@@ -386,6 +385,7 @@ public class AuthorInfo implements SnapshotProcessor {
     pPtree.constructTree();
     resp.setUsername(username);
     resp.setPrivilegeId(permission);
+    resp.setStatus(new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
     ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
     DataOutputStream dataOutputStream = new 
DataOutputStream(byteArrayOutputStream);
     try {
@@ -554,6 +554,7 @@ public class AuthorInfo implements SnapshotProcessor {
     }
     result.setUserInfo(tUserResp);
     result.setRoleInfo(tRoleRespMap);
+    result.setStatus(new 
TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
     return result;
   }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
index c08d6f0c0fb..39680c183d2 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
@@ -125,7 +125,7 @@ public class AuthorityChecker {
       List<Integer> noPermissionIndexList,
       List<PartialPath> pathList,
       PrivilegeType neededPrivilege) {
-    if (noPermissionIndexList.isEmpty()) {
+    if (noPermissionIndexList == null || noPermissionIndexList.isEmpty()) {
       return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
     }
 
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java
index a482c9f568a..48acf3d8c92 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java
@@ -92,7 +92,6 @@ public class ClusterAuthorityFetcher implements 
IAuthorityFetcher {
           if (!user.checkPathPrivilege(path, permission)) {
             if (user.getRoleList().isEmpty()) {
               posList.add(pos);
-              continue;
             }
             boolean status = false;
             for (String rolename : user.getRoleList()) {
@@ -239,7 +238,9 @@ public class ClusterAuthorityFetcher implements 
IAuthorityFetcher {
 
   private PathPatternTree fetchAuthizedPatternTree(String username, int 
permission)
       throws AuthException {
-    TCheckUserPrivilegesReq req = new TCheckUserPrivilegesReq(username, null, 
permission);
+    TCheckUserPrivilegesReq req =
+        new TCheckUserPrivilegesReq(
+            username, 
AuthUtils.serializePartialPathList(Collections.emptyList()), permission);
     TAuthizedPatternTreeResp authizedPatternTree = new 
TAuthizedPatternTreeResp();
     try (ConfigNodeClient configNodeClient =
         
CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {

Reply via email to