Delete the user.
(username: str,
auth_source: AuthType = AuthType.internal,
auto_confirm: Annotated[Optional[bool],
typer.Option(
"--yes")] = False,
sqlite_path: Optional[str] = None,
)
| 370 | @app.command() |
| 371 | @update_sqlite_path |
| 372 | def delete_user(username: str, |
| 373 | auth_source: AuthType = AuthType.internal, |
| 374 | auto_confirm: Annotated[Optional[bool], |
| 375 | typer.Option( |
| 376 | "--yes")] = False, |
| 377 | sqlite_path: Optional[str] = None, |
| 378 | ): |
| 379 | """Delete the user. """ |
| 380 | |
| 381 | confirm_msg = "Are you sure you want to delete it?" |
| 382 | |
| 383 | if auto_confirm or typer.confirm(confirm_msg): |
| 384 | app = create_app(config.APP_NAME + '-cli') |
| 385 | with app.test_request_context(): |
| 386 | uid = ManageUsers.get_user(username=username, |
| 387 | auth_source=auth_source) |
| 388 | if not uid: |
| 389 | print(USER_NOT_FOUND_STR) |
| 390 | else: |
| 391 | status, msg = delete_user(uid) |
| 392 | if status: |
| 393 | print('User deleted successfully.') |
| 394 | else: |
| 395 | print(SOMETHING_WENT_WRONG + str(msg)) |
| 396 | |
| 397 | @app.command() |
| 398 | @update_sqlite_path |
nothing calls this directly
no test coverage detected