feat(users): admin user lifecycle (VAPP-11) #16
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/user-management"
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?
Closes VAPP-11.
What
Replace the read-only Users table (the old "edit" link was
href="#", with no create or remove) with a full admin user lifecycle backed by the control channel. Every mutation goes through a#[server]fn that proxies one vervain-server control action and renders the server's result inline on failure.Server fns
control.rsgrowsrequest_ack(): send a write-style action and resolve its{action:"ack", for, result, id}frame, treatingresult == "ok"as success and mapping known result codes (not-authorized,user-exists,bad-username,bad-password,not-found) to UI messages while passing unknown codes through verbatim.create_user(admin checkbox maps to the full0xFFFFFFFFsiteadmin mask, matchinglist_users' role mapping;adduser),remove_user(deleteuser),set_user_password(changeuserpass),set_mesh_membership(addmeshuser/removemeshuser).list_usersnow also surfaces each account's mesh grants from thelinksmap (mesh entries only), which survive the server's clone-safe scrub.UI
MESHRIGHT_*bitmap in vervain-server'srights.rs).Acceptance criteria mapping
create_user->adduser.set_user_password->changeuserpass(server rehashes and stampspasschange, so the old credential stops working).set_mesh_membership->addmeshuser/removemeshuser.deleteuserremoves the account doc.not-authorized(and other) result codes, surfaced inline byrequest_ack+ the dialogs.Notes
addmeshuser/removemeshusergate on the actor'sMANAGE_USERSright on the target mesh (no site-admin bypass on the server), so an admin without that mesh right gets a not-authorized message inline. The mesh select only lists meshes the actor can already see.rights.rsand a free-form bitmap editor can grow later without a schema change.Verification
Not verified end to end here (no live vervain-server in this environment).
cargo check(server +wasm32-unknown-unknown),cargo clippy --features server -- -D warnings,cargo fmt --check, andcargo test --features serverall pass.🤖 Generated with Claude Code
Replace the read-only Users table (the old "edit" link was href="#", with no create or remove) with a full admin lifecycle backed by the control channel. Each mutation goes through a #[server] fn that proxies one vervain-server control action and renders the server's result inline on failure, so the admin-only gates surface as friendly messages rather than silent no-ops. - control.rs grows request_ack(): send a write-style action and resolve its `{action:"ack", for, result, id}` frame, treating result == "ok" as success and mapping known result codes (not-authorized, user-exists, bad-username, bad-password, not-found) to UI messages while passing unknown codes through verbatim. - New server fns: create_user (admin checkbox maps to the full 0xFFFFFFFF siteadmin mask, matching list_users' role mapping; adduser), remove_user (deleteuser), set_user_password (changeuserpass), set_mesh_membership (addmeshuser / removemeshuser). list_users now also surfaces each account's mesh grants from the `links` map (mesh entries only), which survive the server's clone-safe scrub. - New model: MeshMembership { mesh_id, rights }; User gains a memberships vec. User, MeshMembership and Mesh gain PartialEq so they can be passed as component props. - Users page: "New user" dialog (username, initial password, site-admin checkbox; states passwords are handed over out of band since there is no invite email yet); per-row edit drawer with reset-password plus a mesh-membership editor (current grants with remove, an add row offering a mesh select and a rights preset: full / desktop-no-tools / read-only, mapping to the MESHRIGHT_* bitmap in vervain-server's rights.rs); per-row remove dialog requiring the login name typed to confirm. Behavior note: addmeshuser / removemeshuser gate on the actor's MANAGE_USERS right on the target mesh (no site-admin bypass on the server), so an admin without that mesh right gets a not-authorized message inline. The mesh select only lists meshes the actor can already see. Not verified end to end here (no live vervain-server in this environment); cargo check (server + wasm32), clippy -D warnings, fmt, and tests all pass. #VAPP-11 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>