jerqi commented on code in PR #4515: URL: https://github.com/apache/gravitino/pull/4515#discussion_r1721648253
########## api/src/main/java/org/apache/gravitino/authorization/RoleChange.java: ########## @@ -149,7 +189,101 @@ public int hashCode() { */ @Override public String toString() { - return "REMOVESECURABLEOBJECT " + securableObject; + return "REMOVESECURABLEOBJECT " + roleName + " " + securableObject; + } + } + + /** + * A UpdateSecurableObject is to update securable object's privilege from role. <br> + * The securable object's metadata entity must be the same as new securable object's metadata + * entity. <br> + * The securable object's privilege must be different as new securable object's privilege. <br> + */ + final class UpdateSecurableObject implements RoleChange { + private final String roleName; + private final SecurableObject securableObject; + private final SecurableObject newSecurableObject; + + private UpdateSecurableObject( + String roleName, SecurableObject securableObject, SecurableObject newSecurableObject) { + if (!securableObject.fullName().equals(newSecurableObject.fullName())) { + throw new IllegalArgumentException( + "The securable object's metadata entity must be same as new securable object's metadata entity."); + } + if (securableObject.privileges().containsAll(newSecurableObject.privileges())) { Review Comment: Why do we need this limit? -- 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: commits-unsubscr...@gravitino.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org