This is an automated email from the ASF dual-hosted git repository.
wangchao316 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 5fa8a67f36 [IOTDB-3967]fix-bug for user permission info (#6776)
5fa8a67f36 is described below
commit 5fa8a67f369b21bca5be7b258881464ecf4bbb42
Author: Yifu Zhou <[email protected]>
AuthorDate: Wed Jul 27 10:02:31 2022 +0800
[IOTDB-3967]fix-bug for user permission info (#6776)
[IOTDB-3967]fix-bug for user permission info (#6776)
---
.../java/org/apache/iotdb/confignode/persistence/AuthorInfo.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
index 5520b27a10..e034bb2f2e 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/AuthorInfo.java
@@ -388,10 +388,8 @@ public class AuthorInfo implements SnapshotProcessor {
public TPermissionInfoResp getUserPermissionInfo(String username) throws
AuthException {
TPermissionInfoResp result = new TPermissionInfoResp();
TUserResp tUserResp = new TUserResp();
- TRoleResp tRoleResp = new TRoleResp();
Map<String, TRoleResp> tRoleRespMap = new HashMap();
List<String> userPrivilegeList = new ArrayList<>();
- List<String> rolePrivilegeList = new ArrayList<>();
// User permission information
User user = authorizer.getUser(username);
@@ -411,14 +409,13 @@ public class AuthorInfo implements SnapshotProcessor {
if (user.getRoleList() != null) {
for (String roleName : user.getRoleList()) {
Role role = authorizer.getRole(roleName);
- tRoleResp.setRoleName(roleName);
+ List<String> rolePrivilegeList = new ArrayList<>();
for (PathPrivilege pathPrivilege : role.getPrivilegeList()) {
rolePrivilegeList.add(pathPrivilege.getPath());
String privilegeIdList = pathPrivilege.getPrivileges().toString();
rolePrivilegeList.add(privilegeIdList.substring(1,
privilegeIdList.length() - 1));
}
- tRoleResp.setPrivilegeList(rolePrivilegeList);
- tRoleRespMap.put(roleName, tRoleResp);
+ tRoleRespMap.put(roleName, new TRoleResp(roleName, rolePrivilegeList));
}
}
result.setUserInfo(tUserResp);