[#6786] fix(authz): modify querying roles by user in ROLE_USER_REL relation for JcasbinAuthorizer#7376
Merged
xunliu merged 4 commits intoapache:branch-metadata-authzfrom Jun 19, 2025
Conversation
Contributor
Author
|
@hdygxsj plz help to confirm this, thanks. |
Abyss-lord
reviewed
Jun 18, 2025
Comment on lines
+89
to
+92
| String metalake = NameIdentifierUtil.getMetalake(userIdent); | ||
| Long metalakeId = MetalakeMetaService.getInstance().getMetalakeIdByName(metalake); | ||
| Long userId = | ||
| UserMetaService.getInstance().getUserIdByMetalakeIdAndName(metalakeId, userIdent.name()); |
Contributor
There was a problem hiding this comment.
Just use UserMetaService.getInstance().getUserByIdentifier(nameIdentifier);.
Contributor
|
Actually, we don't need this. UserPO already has role names. |
hdygxsj
pushed a commit
to hdygxsj/gravitino
that referenced
this pull request
Jul 15, 2025
…REL relation for JcasbinAuthorizer (apache#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 apache#6786 ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Ran `./gradlew clean build`
hdygxsj
pushed a commit
to hdygxsj/gravitino
that referenced
this pull request
Jul 15, 2025
…REL relation for JcasbinAuthorizer (apache#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 apache#6786 ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Ran `./gradlew clean build`
jerryshao
pushed a commit
that referenced
this pull request
Jul 15, 2025
…lation for JcasbinAuthorizer (#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`
roryqi
pushed a commit
to qqqttt123/gravitino
that referenced
this pull request
Jul 30, 2025
…REL relation for JcasbinAuthorizer (apache#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 apache#6786 ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Ran `./gradlew clean build`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Currently, the
ROLE_USER_RELrelation inJDBCBackendonly supports querying users by role, but not querying roles by user. This causes issues inJcasbinAuthorizerwhen trying to load user privileges.This PR adds support for querying roles by user in the
ROLE_USER_RELrelation by modifying thelistEntitiesByRelationmethod inJDBCBackend.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