You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Implement user management features: - add user creation and deletion with home directory option, password management, and enhance search functionality.
- Update UI for new user modal and password management.
- Add unit tests for search and system operations.
Keyboard‑driven terminal app to view and manage users and groups. Browse accounts, see memberships, search, and make common changes: rename users, update names or shells, adjust group membership. Safe to explore without admin rights; asks for permission to apply changes. Linux‑focused.
5
+
Keyboard‑driven terminal app to view and manage users and groups. Browse accounts, see memberships, search, and make common changes: rename users, update names or shells, adjust group membership. Safe to explore without admin rights; asks for permission to apply changes. Linux‑focused. Written in Rust.
6
6
7
7
## Status
8
-
Alpha. Read‑only browsing is safe; write operations require privileges and are limited (no user deletion yet).
8
+
Alpha. Read‑only browsing is safe; write operations require privileges and are still limited.
9
9
10
10
Alpha means:
11
11
- Interfaces and keybindings may change without notice.
12
-
- Some actions are intentionally missing or guarded (e.g., user deletion not implemented).
12
+
- Some actions are intentionally guarded (e.g., user deletion requires confirmation; optional home removal).
13
13
- Error handling, edge cases, and performance are still being improved.
14
-
- Expect to run with `sudo` for any write operation (`usermod`, `gpasswd`, `groupadd`, `groupdel`).
14
+
- Expect to run with `sudo` for any write operation (`usermod`, `gpasswd`, `groupadd`, `groupdel`, `useradd`, `userdel`).
15
15
16
16
## Install / Build
17
17
---------------
@@ -33,13 +33,24 @@ Alpha means:
33
33
- Open actions on selection: `Enter`
34
34
- In popups: `↑/k`, `↓/j`, `PageUp`, `PageDown`, `Enter`, `Esc`
35
35
36
+
- New user: `n` (toggle "Create home" with `Space`)
- Set/change: masked input with confirm; toggle "must change at next login" with `Space`; select Submit and press `Enter`
40
+
- Reset: expire password immediately (forces change at next login)
41
+
36
42
## What’s implemented
37
43
------------------
38
44
39
45
- Users tab
40
46
- Table of users (from `/etc/passwd`), selection, paging
41
47
- Detail pane: UID, GID, name, home, shell
42
48
- Member‑of pane: primary and supplementary groups
49
+
- Create user (`useradd`; optional `-m` to create home)
50
+
- Delete user (`userdel`; optional `-r` to remove home)
51
+
- Password management:
52
+
- Set/change (masked via `chpasswd`, optional "must change at next login")
53
+
- Reset (expire now via `chage -d 0`)
43
54
- Actions → Modify:
44
55
- Add user to groups (via `gpasswd -a`)
45
56
- Remove user from groups (via `gpasswd -d`, excluding primary group)
@@ -62,14 +73,14 @@ Alpha means:
62
73
--------------------
63
74
64
75
- Linux/BSD only. macOS behavior may differ (Directory Services).
65
-
- Write actions call system tools and require appropriate privileges (root or sudo): `usermod`, `gpasswd`, `groupadd`, `groupdel`.
66
-
- User deletion is not implemented yet (guarded with a confirmation and an informational message).
76
+
- Write actions call system tools and require appropriate privileges (root or sudo): `usermod`, `gpasswd`, `groupadd`, `groupdel`, `useradd`, `userdel`, `chpasswd`, `chage`.
77
+
- User deletion is implemented with confirmation and optional home removal.
67
78
68
79
## TODO (next steps)
69
80
-----------------
70
81
71
82
- Lock/unlock, enable/disable login shell: show status in table; actions in detail view; confirm + dry‑run; apply via `usermod -L/-U` and `chsh` (or edit `/etc/passwd` when in file‑parse mode)
72
-
- Password set/reset with strength checks: masked prompt; basic rules or zxcvbn; optional "must change at next login"; respect PAM; clear error messages
- Fuzzy find users/groups: incremental filtering while typing; highlight matches; toggle fuzzy vs substring; performance guard for large datasets
74
85
- Filters (system vs human, inactive, expired, locked, no home, no password): quick filter menu; combinable chips; persisted per session; NSS‑aware where possible
75
86
- Multi‑select bulk ops (add to groups, lock, shell change, expiry set): selection mode with count; preview + confirmation; batched execution with per‑item results and rollback on failure
@@ -83,6 +94,23 @@ Alpha means:
83
94
- Build: `cargo build --release`
84
95
- Run: `cargo run --release`
85
96
97
+
## Tests
98
+
-----
99
+
100
+
- Run all tests: `cargo test`
101
+
102
+
What’s covered today:
103
+
- Unit tests for parsers in `src/sys/mod.rs` (fake `/etc/passwd` and `/etc/group` files).
104
+
- Unit tests for filtering in `src/search.rs` (case‑insensitive user/group search, membership matching).
105
+
106
+
Guidelines:
107
+
- Keep small unit tests inline next to the code with `#[cfg(test)]` for private helpers and pure logic.
108
+
- For broader or cross‑module tests, add a `src/lib.rs` exposing modules (e.g., `pub mod app; pub mod search; pub mod sys;`) and place integration tests in `tests/`.
109
+
- Avoid invoking privileged commands (`useradd`, `gpasswd`, etc.) in tests. Prefer testing pure parts (parsing, filtering) or introduce a trait to mock `SystemAdapter` in higher‑level tests.
110
+
111
+
Optional:
112
+
- UI snapshot/sanity tests can be written using `ratatui`’s test backend (and, if desired, a snapshot tool like `insta`). These should render minimal views and assert on expected labels/highlights, not terminal specifics.
0 commit comments