ColinLeeo commented on code in PR #13158:
URL: https://github.com/apache/iotdb/pull/13158#discussion_r1924987342
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java:
##########
@@ -81,9 +85,61 @@ public ClusterAuthorityFetcher(IAuthorCache iAuthorCache) {
this.iAuthorCache = iAuthorCache;
}
+ /** -- check user privileges SYSTEM, TREE, RELATIONAL-- * */
+ private TSStatus checkPrivilege(
+ String username,
+ PrivilegeUnion union,
+ BiFunction<Role, PrivilegeUnion, Boolean> privilegeCheck,
+ TCheckUserPrivilegesReq req) {
+ User user = iAuthorCache.getUserCache(username);
+ if (user != null) {
+ if (privilegeCheck.apply(user, union)) {
+ return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
+ }
+ boolean remoteCheck = false;
+ for (String rolename : user.getRoleSet()) {
+ Role role = iAuthorCache.getRoleCache(rolename);
+ if (role == null) {
+ remoteCheck = true;
Review Comment:
Just make sure all data are same with remote.
--
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]