Skip to content

Commit

Permalink
[fix](auth) Fix ResourceTypeEnum Compatibility Upgrade (#39288)
Browse files Browse the repository at this point in the history
  • Loading branch information
dataroaring committed Aug 13, 2024
1 parent 7beb965 commit 3099edf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,9 @@ public void gsonPostProcess() throws IOException {
if ("*".equals(resourceName)) {
resourceName = "%";
}
// 2.x -> 3.0 compatibility logic
if (resourceType == null) {
resourceType = ResourceTypeEnum.GENERAL;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public Role(String roleName, TablePattern tablePattern, PrivBitSet privs,
public Role(String roleName, ResourcePattern resourcePattern, PrivBitSet privs) throws DdlException {
this.roleName = roleName;
// grant has trans privs
// 2.x -> 3.0 compatibility logic
if (resourcePattern.getResourceType() == null) {
// 2.x not have cloud auth, so just transfer to ResourceTypeEnum.GENERAL
resourcePattern.setResourceType(ResourceTypeEnum.GENERAL);
}
switch (resourcePattern.getResourceType()) {
case GENERAL:
this.resourcePatternToPrivs.put(resourcePattern, privs);
Expand Down

0 comments on commit 3099edf

Please sign in to comment.