-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add , , and commands. * Add pre-commit * Add pre-commit * Add pre-commit * Add rich print * Change do_keycloak function * Create two keycloak subcommands Co-authored-by: iameskild <eskild@doublee.io> Co-authored-by: eskild <42120229+iameskild@users.noreply.github.com>
- Loading branch information
1 parent
0e15458
commit ecc5f65
Showing
4 changed files
with
220 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from pathlib import Path | ||
from typing import Tuple | ||
|
||
import typer | ||
|
||
from qhub.keycloak import do_keycloak | ||
|
||
app_keycloak = typer.Typer() | ||
|
||
|
||
@app_keycloak.command() | ||
def add_user( | ||
add_users: Tuple[str, str] = typer.Option( | ||
..., "--user", help="Provide both: <username> <password>" | ||
), | ||
config_filename: str = typer.Option( | ||
..., | ||
"-c", | ||
"--config", | ||
help="qhub configuration file path", | ||
), | ||
): | ||
"""Add a user to Keycloak. User will be automatically added to the [italic]analyst[/italic] group.""" | ||
if isinstance(config_filename, str): | ||
config_filename = Path(config_filename) | ||
|
||
args = ["adduser", add_users[0], add_users[1]] | ||
|
||
do_keycloak(config_filename, *args) | ||
|
||
|
||
@app_keycloak.command() | ||
def list_users( | ||
config_filename: str = typer.Option( | ||
..., | ||
"-c", | ||
"--config", | ||
help="qhub configuration file path", | ||
) | ||
): | ||
"""List the users in Keycloak.""" | ||
if isinstance(config_filename, str): | ||
config_filename = Path(config_filename) | ||
|
||
args = ["listusers"] | ||
|
||
do_keycloak(config_filename, *args) |
This file contains 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
This file contains 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
This file contains 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