ColinLeeo commented on code in PR #13158:
URL: https://github.com/apache/iotdb/pull/13158#discussion_r1924886315
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/entity/Role.java:
##########
@@ -66,31 +85,164 @@ public List<PathPrivilege> getPathPrivilegeList() {
return pathPrivilegeList;
}
- public Set<Integer> getSysPrivilege() {
+ public Set<PrivilegeType> getSysPrivilege() {
return sysPrivilegeSet;
}
- public Set<Integer> getPathPrivileges(PartialPath path) {
+ private Set<Integer> getPrivilegeIntSet(Set<PrivilegeType> privs) {
+ Set<Integer> res = new HashSet<>();
+ for (PrivilegeType priv : privs) {
+ res.add(priv.ordinal());
+ }
+ return res;
+ }
+
+ public Set<PrivilegeType> getPathPrivileges(PartialPath path) {
return AuthUtils.getPrivileges(path, pathPrivilegeList);
}
- public Set<Integer> getSysPriGrantOpt() {
+ public Set<PrivilegeType> getSysPriGrantOpt() {
return sysPriGrantOpt;
}
- public int getAllSysPrivileges() {
- int privs = 0;
- for (Integer sysPri : sysPrivilegeSet) {
- privs |= 1 << AuthUtils.sysPriTopos(sysPri);
+ public Set<PrivilegeType> getAnyScopePrivilegeGrantOpt() {
+ return anyScopePrivilegeGrantOptSet;
+ }
+
+ public Set<PrivilegeType> getAnyScopePrivilegeSet() {
+ return anyScopePrivilegeSet;
+ }
+
+ public Map<String, DatabasePrivilege> getDBScopePrivilegeMap() {
+ return objectPrivilegeMap;
+ }
+
+ private DatabasePrivilege getObjectPrivilege(String objectName) {
+ return this.objectPrivilegeMap.computeIfAbsent(
+ objectName, k -> new DatabasePrivilege(objectName));
+ }
+
+ public List<TPathPrivilege> getPathPrivilegeInfo() {
+ List<TPathPrivilege> privilegeList = new ArrayList<>();
+ for (PathPrivilege pathPrivilege : pathPrivilegeList) {
+ TPathPrivilege pathPriv = new TPathPrivilege();
+ pathPriv.setPath(pathPrivilege.getPath().getFullPath());
+ pathPriv.setPriSet(pathPrivilege.getPrivilegeIntSet());
+ pathPriv.setPriGrantOpt(pathPrivilege.getGrantOptIntSet());
+ privilegeList.add(pathPriv);
}
- for (Integer sysGrantOpt : sysPriGrantOpt) {
- privs |= 1 << (AuthUtils.sysPriTopos(sysGrantOpt) + 16);
+ return privilegeList;
+ }
+
+ public void loadPathPrivilegeInfo(List<TPathPrivilege> pathPrivilegeInfo)
Review Comment:
Will, Path Privilege means the privileges on one path.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]