Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#6116] fix(authz): Fix the check of duplicated privileges #6117

Merged
merged 6 commits into from
Jan 7, 2025

Conversation

jerqi
Copy link
Contributor

@jerqi jerqi commented Jan 6, 2025

What changes were proposed in this pull request?

Fix the check of duplicated privileges

Why are the changes needed?

Fix: #6116

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added new UT.

@jerqi jerqi self-assigned this Jan 6, 2025
Lists.newArrayList(Privileges.SelectTable.allow(), Privileges.SelectTable.deny())));
Lists.newArrayList(Privileges.ReadFileset.allow(), Privileges.ReadFileset.deny())));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe we can use Set<Privilge> in the grantPrivilegesToRole(..., ..., Set<Privilge> privileges) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified the implement of server. If we want to change the client side, we should deprecate the API and add new API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changed.

@jerqi jerqi requested a review from xunliu January 7, 2025 03:24
@@ -321,7 +322,7 @@ static SecurableObjectDTO toSecurableObject(SecurableObject securableObject) {
.build();
}

static List<PrivilegeDTO> toPrivileges(List<Privilege> privileges) {
static List<PrivilegeDTO> toPrivileges(Collection<Privilege> privileges) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection<Privilege> or Set<Privilege>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection. Other places I used some collections which are not sets.

@jerqi jerqi added branch-0.8 Automatically cherry-pick commit to branch-0.8 and removed branch-0.8 Automatically cherry-pick commit to branch-0.8 labels Jan 7, 2025
@jerqi jerqi requested a review from xunliu January 7, 2025 07:56
Copy link
Member

@xunliu xunliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xunliu xunliu merged commit 688c1c9 into apache:main Jan 7, 2025
28 checks passed
Abyss-lord pushed a commit to Abyss-lord/gravitino that referenced this pull request Jan 9, 2025
…che#6117)

### What changes were proposed in this pull request?

 Fix the check of duplicated privileges

### Why are the changes needed?

Fix: apache#6116 

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Added new UT.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants