You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "KyleLin0927 (via GitHub)" <gi...@apache.org> on 2025/06/11 15:20:32 UTC

[PR] [#6786] fix(authz): modify querying roles by user in ROLE_USER_REL relation for JcasbinAuthorizer [gravitino]

KyleLin0927 opened a new pull request, #7376:
URL: https://github.com/apache/gravitino/pull/7376

   ### What changes were proposed in this pull request?
   
   Currently, the `ROLE_USER_REL` relation in `JDBCBackend` only supports querying users by role, but not querying roles by user. This causes issues in `JcasbinAuthorizer` when trying to load user privileges.
   
   This PR adds support for querying roles by user in the `ROLE_USER_REL` relation by modifying the `listEntitiesByRelation` method in `JDBCBackend`.
   
   ### Why are the changes needed?
   
   Fixes #6786
   
   ### Does this PR introduce any user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Ran `./gradlew clean build`


-- 
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-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6786] fix(authz): modify querying roles by user in ROLE_USER_REL relation for JcasbinAuthorizer [gravitino]

Posted by "xunliu (via GitHub)" <gi...@apache.org>.
xunliu merged PR #7376:
URL: https://github.com/apache/gravitino/pull/7376


-- 
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-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6786] fix(authz): modify querying roles by user in ROLE_USER_REL relation for JcasbinAuthorizer [gravitino]

Posted by "KyleLin0927 (via GitHub)" <gi...@apache.org>.
KyleLin0927 commented on PR #7376:
URL: https://github.com/apache/gravitino/pull/7376#issuecomment-2963249325

   @hdygxsj plz help to confirm this, thanks.


-- 
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-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6786] fix(authz): modify querying roles by user in ROLE_USER_REL relation for JcasbinAuthorizer [gravitino]

Posted by "xunliu (via GitHub)" <gi...@apache.org>.
xunliu closed pull request #7376: [#6786] fix(authz): modify querying roles by user in ROLE_USER_REL relation for JcasbinAuthorizer
URL: https://github.com/apache/gravitino/pull/7376


-- 
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-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6786] fix(authz): modify querying roles by user in ROLE_USER_REL relation for JcasbinAuthorizer [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #7376:
URL: https://github.com/apache/gravitino/pull/7376#discussion_r2153764457


##########
core/src/main/java/org/apache/gravitino/storage/relational/service/RoleMetaService.java:
##########
@@ -85,6 +85,20 @@ public List<RolePO> listRolesByUserId(Long userId) {
         RoleMetaMapper.class, mapper -> mapper.listRolesByUserId(userId));
   }
 
+  public List<RoleEntity> listRolesByUserIdent(NameIdentifier userIdent) {
+    String metalake = NameIdentifierUtil.getMetalake(userIdent);
+    Long metalakeId = MetalakeMetaService.getInstance().getMetalakeIdByName(metalake);
+    Long userId =
+        UserMetaService.getInstance().getUserIdByMetalakeIdAndName(metalakeId, userIdent.name());

Review Comment:
   Just use `UserMetaService.getInstance().getUserByIdentifier(nameIdentifier);`.



-- 
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-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6786] fix(authz): modify querying roles by user in ROLE_USER_REL relation for JcasbinAuthorizer [gravitino]

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on PR #7376:
URL: https://github.com/apache/gravitino/pull/7376#issuecomment-2986491754

   Actually, we don't need this. UserPO already has role names.


-- 
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-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org