JackieTien97 commented on code in PR #10939:
URL: https://github.com/apache/iotdb/pull/10939#discussion_r1307423753


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/user/LocalFileUserManager.java:
##########
@@ -33,6 +35,9 @@ public LocalFileUserManager(String userDirPath) throws 
AuthException {
 
   @Override
   public boolean processTakeSnapshot(File snapshotDir) throws TException, 
IOException {
+    for (Map.Entry<String, User> entry : userMap.entrySet()) {
+      accessor.saveUser(entry.getValue());
+    }

Review Comment:
   you can put this call into snapshot take.



##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java:
##########
@@ -992,6 +994,46 @@ public TPermissionInfoResp checkUserPrivileges(
     }
   }
 
+  public TAuthizedPatternTreeResp fetchAuthizedPatternTree(String username, 
int permission) {
+    TSStatus status = confirmLeader();
+    if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+      try {
+        return permissionManager.fetchAuthizedPTree(username, permission);
+      } catch (AuthException e) {
+        TAuthizedPatternTreeResp resp = new TAuthizedPatternTreeResp();
+        status
+            .setCode(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode())
+            .setMessage(e.getMessage());
+        resp.setStatus(status);
+        return resp;
+      }
+    } else {
+      TAuthizedPatternTreeResp resp = new TAuthizedPatternTreeResp();
+      resp.setStatus(status);
+      return resp;
+    }
+  }
+
+  public TPermissionInfoResp checkUserPrivilegeGrantOpt(
+      String username, PartialPath path, int permission) {
+    TSStatus status = confirmLeader();
+    TPermissionInfoResp resp = new TPermissionInfoResp();
+    if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+      try {
+        resp = permissionManager.checkUserPrivilegeGrantOpt(username, path, 
permission);
+      } catch (AuthException e) {
+        status
+            .setCode(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode())

Review Comment:
   use the statusCode in AuthException



##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/AuthOperationProcedureState.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.confignode.procedure.state;
+
+public enum AuthOperationProcedureState {
+  INIT,
+  CONFIGNODE_AUTH_ALTER,

Review Comment:
   ```suggestion
   ```



-- 
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: reviews-unsubscr...@iotdb.apache.org

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

Reply via email to