jt2594838 commented on code in PR #16888:
URL: https://github.com/apache/iotdb/pull/16888#discussion_r2604903217
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java:
##########
@@ -169,35 +169,32 @@ public List<Integer> checkUserPathPrivileges(
String username, List<? extends PartialPath> allPath, PrivilegeType
permission) {
checkCacheAvailable();
List<Integer> posList = new ArrayList<>();
- User user = iAuthorCache.getUserCache(username);
- if (user != null) {
- if (user.isOpenIdUser()) {
- return posList;
- }
- int pos = 0;
- for (PartialPath path : allPath) {
- if (!user.checkPathPrivilege(path, permission)) {
- boolean checkFromRole = false;
- for (String rolename : user.getRoleSet()) {
- Role cachedRole = iAuthorCache.getRoleCache(rolename);
- if (cachedRole == null) {
- return checkPathFromConfigNode(username, allPath, permission);
- }
- if (cachedRole.checkPathPrivilege(path, permission)) {
- checkFromRole = true;
- break;
- }
+ User user = getUser(username);
+ if (user.isOpenIdUser()) {
+ return posList;
+ }
+ int pos = 0;
+ for (PartialPath path : allPath) {
+ if (!user.checkPathPrivilege(path, permission)) {
+ boolean checkFromRole = false;
+ for (String rolename : user.getRoleSet()) {
+ Role cachedRole = iAuthorCache.getRoleCache(rolename);
+ if (cachedRole == null) {
+ checkRoleFromConfigNode(username, rolename);
+ cachedRole = iAuthorCache.getRoleCache(rolename);
}
Review Comment:
And what if the role is deleted concurrently? You can still not fetch it.
--
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]