roryqi commented on code in PR #10867:
URL: https://github.com/apache/gravitino/pull/10867#discussion_r3140466923
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/jcasbin/JcasbinAuthorizer.java:
##########
@@ -601,4 +609,45 @@ private void loadPolicyByRoleEntity(RoleEntity roleEntity)
{
}
}
}
+
+ /**
+ * Checks whether the given principal is the owner of the metadata object
identified by
+ * metadataId. Supports both user and group ownership.
+ */
+ private boolean checkOwnership(Principal principal, String metalake, Long
metadataId) {
+ Optional<OwnerInfo> ownerOpt = ownerRel.getIfPresent(metadataId);
+ if (ownerOpt == null || !ownerOpt.isPresent()) {
+ return false;
+ }
+ OwnerInfo owner = ownerOpt.get();
+ if (owner.type == Entity.EntityType.USER) {
+ try {
+ UserEntity userEntity = getUserEntity(principal.getName(), metalake);
+ return Objects.equals(userEntity.id(), owner.id);
Review Comment:
We add a user A.
We set a user A to table B's owner.
We remove user A.
We add user A again.
The cache will cache invalid owner data if we use name here.
--
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]