This is an automated email from the ASF dual-hosted git repository. spricoder pushed a commit to branch refactor/new_auth in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 95fe7c1e32cddd476903510a3d5eb4a4fb632005 Author: spricoder <[email protected]> AuthorDate: Sat Jun 24 23:08:02 2023 +0800 Spotless --- .../iotdb/confignode/persistence/AuthorInfoTest.java | 14 ++++---------- .../iotdb/confignode/it/IoTDBClusterAuthorityIT.java | 6 ++---- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java b/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java index c7188b49bc9..63ff85d1669 100644 --- a/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java +++ b/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java @@ -28,7 +28,6 @@ import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType; import org.apache.iotdb.confignode.consensus.request.auth.AuthorPlan; import org.apache.iotdb.confignode.consensus.response.auth.PermissionInfoResp; -import org.apache.iotdb.confignode.rpc.thrift.TCheckUserPrivilegesReq; import org.apache.iotdb.rpc.TSStatusCode; import org.apache.commons.io.FileUtils; @@ -44,7 +43,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -86,7 +84,6 @@ public class AuthorInfoTest { roleList.add("role1"); AuthorPlan authorPlan; - TCheckUserPrivilegesReq checkUserPrivilegesReq; Set<Integer> privilegeList = new HashSet<>(); privilegeList.add(PrivilegeType.USER.ordinal()); @@ -95,7 +92,6 @@ public class AuthorInfoTest { revokePrivilege.add(PrivilegeType.USER.ordinal()); List<String> privilege = new ArrayList<>(); - privilege.add("root.** : USER"); List<PartialPath> paths = new ArrayList<>(); paths.add(new PartialPath("root.ln")); @@ -310,7 +306,6 @@ public class AuthorInfoTest { permissionInfoResp = authorInfo.executeListRolePrivileges(authorPlan); status = permissionInfoResp.getStatus(); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); - privilege.remove(0); Assert.assertEquals( 0, permissionInfoResp.getPermissionInfo().get(IoTDBConstant.COLUMN_PRIVILEGE).size()); @@ -509,15 +504,14 @@ public class AuthorInfoTest { privilegeList.add(PrivilegeType.WRITE_DATA.ordinal()); privilegeList.add(PrivilegeType.READ_DATA.ordinal()); - Map<String, List<String>> permissionInfo; List<String> userPrivilege = new ArrayList<>(); - userPrivilege.add("root.sg.** : INSERT_TIMESERIES READ_TIMESERIES"); - userPrivilege.add("root.ln.** : INSERT_TIMESERIES READ_TIMESERIES"); + userPrivilege.add("root.sg.** : READ_DATA WRITE_DATA"); + userPrivilege.add("root.ln.** : READ_DATA WRITE_DATA"); Collections.sort(userPrivilege); List<String> rolePrivilege = new ArrayList<>(); - rolePrivilege.add("root.abc.** : INSERT_TIMESERIES READ_TIMESERIES"); - rolePrivilege.add("root.role_1.** : INSERT_TIMESERIES READ_TIMESERIES"); + rolePrivilege.add("root.abc.** : READ_DATA WRITE_DATA"); + rolePrivilege.add("root.role_1.** : READ_DATA WRITE_DATA"); Collections.sort(rolePrivilege); List<String> allPrivilege = new ArrayList<>(); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterAuthorityIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterAuthorityIT.java index 88a977ae76c..77ee9c046b0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterAuthorityIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterAuthorityIT.java @@ -68,8 +68,7 @@ public class IoTDBClusterAuthorityIT { EnvFactory.getEnv().cleanClusterEnvironment(); } - private void cleanUserAndRole(IConfigNodeRPCService.Iface client) - throws TException, IllegalPathException { + private void cleanUserAndRole(IConfigNodeRPCService.Iface client) throws TException { TSStatus status; // clean user @@ -127,8 +126,7 @@ public class IoTDBClusterAuthorityIT { revokePrivilege.add(PrivilegeType.USER.ordinal()); List<String> privilege = new ArrayList<>(); - privilege.add("root.** : CREATE_USER"); - privilege.add("root.** : CREATE_USER"); + privilege.add("root.** : USER"); List<PartialPath> paths = new ArrayList<>(); paths.add(new PartialPath("root.ln.**"));
