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

refactor keycloak cli command code #2968

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

Conversation

Adam-D-Lewis
Copy link
Member

@Adam-D-Lewis Adam-D-Lewis commented Feb 25, 2025

Reference Issues or PRs

Refactors code in keycloak nebari cli. Adds the ability to add user to groups via the cli command as well.

What does this implement/fix?

Put a x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features not to work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

  • Did you test the pull request locally?
  • Did you add new tests?

How to test this PR?

After a deployment, run nebari keycloak adduser --user my_user my_password --groups developer --groups admin --config nebari-config.yaml and ensure my_user is created and is in the admin and developer groups (as well as the default groups).

Any other comments?

@Adam-D-Lewis Adam-D-Lewis requested a review from a team as a code owner February 25, 2025 18:13
@Adam-D-Lewis Adam-D-Lewis requested review from dcmcand, viniciusdc and soapy1 and removed request for a team February 25, 2025 18:13
@viniciusdc
Copy link
Contributor

based on playwright video, it looks like the env was not ready by the time the kernel started, since there is no wait condition there it ended up failling during the assert with blank vs expected value. I will rerun this

@viniciusdc
Copy link
Contributor

viniciusdc commented Feb 26, 2025

Working like a charm!

image

Since this PR is just to unblock a few related things, might not be worth including here, but it would be nice to have a list_groups as well then, not only helps as a command in itself but we can use it for validating the --group passed is a valid keycloak group....

@viniciusdc
Copy link
Contributor

viniciusdc commented Feb 26, 2025

I took the liberty to include a list_groups subcommand as well that shows the current realm groups and their permissions. This should be helpful for new users when deciding which group to create the user into.

❯ nebari keycloak list-groups -c nebari-config.yaml
name             | permissions                                                     
-----------------------------------------------------------------------------------
admin            | jupyterhub_admin, dask_gateway_admin, allow-group-directory-
                 | creation-role, grafana_admin, argo-admin, conda_store_admin

analyst          | jupyterhub_developer, allow-group-directory-creation-role,
                 | allow-read-access-to-services-role, grafana_viewer, argo-viewer,
                 | conda_store_developer

custom           | conda_store_analyst_admin

developer        | jupyterhub_developer, allow-group-directory-creation-role,
                 | dask_gateway_developer, grafana_developer, argo-developer,
                 | conda_store_developer

superadmin       | realm-admin, conda_store_superadmin

users            | 

Copy link
Contributor

@soapy1 soapy1 left a comment

Choose a reason for hiding this comment

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

Nice, looks like it all works to me! Would be maybe nice to add a few unit tests.

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

Successfully merging this pull request may close these issues.

3 participants