feat(cli): user management commands in hikctl CLI toolkit #38
Labels
No labels
blocked
bug
enhancement
high-priority
low-priority
needs-info
needs-triage
ready-for-agent
ready-for-human
referenced
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gabogg/hikcentral#38
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📌 Problem Statement
Currently, user accounts in HikCentral Gateway are only seeded statically (
adminandoperator) during initial database provisioning (init_db()).There is no dedicated CLI management tool in
hikctlto:Administrators currently have to run custom Python or SQLite shell scripts directly against the database file.
🎯 Proposed Solution & Scope
Integrate a dedicated
hikctl usersubcommand group into the auxiliary CLI toolkit:1. CLI Commands (
hikctl user ...)hikctl user list [--json]:admin/operator), and creation timestamp.--jsonfor machine-readable output.hikctl user add <username> [--role {operator,admin}] [--password PASSWORD]:DATABASE_PATH).getpassif--passwordis omitted (preventing shell history leakage).hikctl user passwd <username> [--password PASSWORD]:getpassif--passwordis omitted.hikctl user remove <username> [--force]:2. Backend Repository Support (
UserRepository)Add clean helper methods to
UserRepository(app/db/user_repository.py):list_users() -> list[dict[str, Any]]create_user(username: str, password: str, role: str) -> dict[str, Any]update_password(username: str, new_password: str) -> booldelete_user(username: str) -> bool✅ Acceptance Criteria
hikctl user listoutputs all users in formatted table or JSON.hikctl user addcreates users with PBKDF2 hashes (interactive prompt by default).hikctl user passwdallows changing password interactively or via flag.hikctl user removedeletes user and prevents deleting the last remaining admin.tests/test_cli_commands.py.feat(auth): basic user management panel in Admin UI and REST APIto feat(cli): user management commands in hikctl CLI toolkitImplemented via Pull Request #39:
hikctl user list [--json]hikctl user add <username> [--role {operator,admin}] [--password PASSWORD]hikctl user passwd <username> [--password PASSWORD]hikctl user remove <username> [--force](alias:delete)All 190 tests passing (100% green).