CLI
dagster_authkit.cli.main
Dagster AuthKit CLI Entry Point - v1.0
Main orchestrator that: 1. Intercepts management commands (user, init-db, etc.) 2. Performs environment & compatibility checks. 3. Applies authentication monkey-patches. 4. Delegates execution to the official Dagster webserver CLI.
main
main()
Primary entry point for dagster-authkit.
Orchestrates the full startup sequence:
- Initialise structured logging.
- Intercept management commands (add-user, list-users, etc.) and
delegate to
cli_tools.handle_user_management(). - Print startup banner and configuration summary.
- Verify Dagster API compatibility (exits on failure).
- Apply monkey-patches to DagsterWebserver (middleware, routes, UI). Verify patches were applied successfully.
- Bootstrap the SQL backend if configured (create tables, admin user).
- Delegate normal webserver invocation to Dagster's own CLI
(
dagster_webserver.cli.mainor legacydagit.cli.main). - Trap
SystemExitfor user-friendly error messages on missing args.
This function calls sys.exit(); it does not return normally.
dagster_authkit.cli.cli_tools
CLI tools for managing users in SQL databases via Peewee. Supports unified SQL backends (SQLite, PostgreSQL, MySQL).
init_db_command
init_db_command(args)
Initialise a new database and create necessary tables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
|
required |
Returns:
| Type | Description |
|---|---|
|
0 on success, 1 on failure. |
add_user_command
add_user_command(args)
Add a new user to the SQL database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
|
required |
Returns:
| Type | Description |
|---|---|
|
0 on success, 1 on failure (user may already exist). |
change_password_command
change_password_command(args)
Update a user's password and revoke all their active sessions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
|
required |
Returns:
| Type | Description |
|---|---|
|
0 on success, 1 if user not found. |
list_users_command
list_users_command(args)
List all registered users from the SQL database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
|
required |
Returns:
| Type | Description |
|---|---|
|
0 always (lists users or prints "No users found"). |
delete_user_command
delete_user_command(args)
Deactivate a user (soft delete) — sets is_active=False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
|
required |
Returns:
| Type | Description |
|---|---|
|
0 on success (or cancellation), 1 if user not found. |
list_permissions_command
list_permissions_command(args)
Display the full RBAC permissions matrix for all roles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Unused (for CLI dispatch consistency). |
required |
Returns:
| Type | Description |
|---|---|
|
0 always. |