jerqi commented on code in PR #9384:
URL: https://github.com/apache/gravitino/pull/9384#discussion_r2591872531
##########
core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java:
##########
@@ -229,7 +229,26 @@ public static void
checkDuplicatedNamePrivilege(Collection<Privilege> privileges
"Doesn't support duplicated privilege name %s with different
condition",
privilege.name());
}
- privilegeNameSet.add(privilege.name());
+ privilegeNameSet.add(replaceLegacyPrivilegeName(privilege.name()));
+ }
+ }
+
+ public static Privilege.Name replaceLegacyPrivilegeName(Privilege.Name
privilegeName) {
+ if (privilegeName == Privilege.Name.CREATE_MODEL) {
+ return Privilege.Name.REGISTER_MODEL;
+ } else if (privilegeName == Privilege.Name.CREATE_MODEL_VERSION) {
+ return Privilege.Name.LINK_MODEL_VERSION;
+ } else {
+ return privilegeName;
+ }
+ }
+
+ public static Privilege replaceLegacyPrivilege(
+ Privilege.Name privilege, Privilege.Condition condition) {
+ if (condition == Privilege.Condition.ALLOW) {
+ return Privileges.allow(privilege.name());
+ } else {
+ return Privileges.deny(privilege.name());
Review Comment:
Fixed.
--
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]