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

[#5570] improve(CLI): Add the ability to revoke all roles or groups in the Gravitino CLI. #6240

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Abyss-lord
Copy link
Contributor

What changes were proposed in this pull request?

Add ability to revoke all roles from a user or group in the Gravitino CLI.

  1. Add logic to handle the --all flag in UserCommandHandler#handleRevokeCommand;
  2. Add logic to handle the --all flag in GroupCommandHandler#handleRevokeCommand;
  3. Add new RemoveAllRoles command to handle user revoke --all and group revoke --all;
  4. Add unit tests;

Why are the changes needed?

Fix: #5570

Does this PR introduce any user-facing change?

No

How was this patch tested?

UT + local test.

User test.

# step1: grant roles to testRole
gcli user grant -m demo_metalake --user testRole --role roleA roleB roleC -I
# roleA added to testRole
# roleB added to testRole
# roleC added to testRole
# Add roles roleA, roleB, roleC to user testRole

# step2: get details of testRole 
gcli user details -m demo_metalake --user testRole -I
# roleA,roleC,roleB

# step3: revoke all roles from testRole
gcli user revoke -m demo_metalake --user testRole -i --all
# Remove all roles from user testRole

# step4: get details of testRole
gcli user details -m demo_metalake --user testRole -I
# The user has no roles.

# step5: list exists roles
gcli role list -m demo_metalake -I
# admin,roleA,roleB,roleC

Group test.

# step1: grant roles to test_group
gcli group grant -m demo_metalake --group test_group --role roleA roleB roleC -I
# roleA added to test_group
# roleB added to test_group
# roleC added to test_group
# Grant roles roleA, roleB, roleC to group test_group

# step2: get details of test_group
gcli group details -m demo_metalake --group test_group -I
# admin,roleA,roleC,roleB

# step3: revoke all roles from test_group
gcli group revoke -m demo_metalake --group test_group -i --all
# Remove all roles from group test_group

# step4: get details of test_group
gcli group details -m demo_metalake --group test_group -I
# The group has no roles.

# step5: list exists roles
gcli role list -m demo_metalake -I
# admin,roleA,roleB,roleC

…oups in the Gravitino CLI.

Add ability to revoke all roles from a user or group in the Gravitino CLI.
@Abyss-lord
Copy link
Contributor Author

@justinmclean @tengqm , could you please review this PR when you have time? I’d really appreciate your feedback.

@Abyss-lord
Copy link
Contributor Author

@justinmclean I’ve finished updating the code. Please take a look at the PR again when you have time.

@tengqm
Copy link
Contributor

tengqm commented Jan 15, 2025

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] Add the ability to revoke all roles or groups in the Gravitino CLI
3 participants