GRI-2105: let an admin set a new password for a user #256
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!256
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/GRI-2105-admin-set-password"
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?
Summary
PATCH /api/v1/users/{user_id}accepts an optionalpasswordfield: an admin reset of another user's password. Absent leaves the password unchanged, the same "absent = unchanged" conventionname/group_id/campus_idalready use.PasswordHasher(Argon2id), same as account creation.create_user: under 8 characters is400 weak_password, nothing changes.require_users_manage— no new permission, sinceusers.manageis already unscoped and is exactly "may manage that user."auth::delete_sessions_for_user), not only the caller's own — a session acquired before the reset no longer authenticates afterwards.plan/server/rest-api.md.Full shape discussed on forge issue #226 comment 13177.
Test plan
Written myself from the candidate acceptance tests in #226 comment 13177 (no pre-existing QA tests for this), in their own commit before the implementation, in
crates/server/tests/permissions_integration.rs:weak_password), nothing changesusers.managegets 403user_idgets 404passwordfield leaves the password unchangedVerified locally:
SIGNAGE_TEST_DATABASE_URL=... ./scripts/local-gates.sh --rust-only— every gate passed.Correct and well tested. Two non-blocking notes for a follow-up: (1) delete_sessions_for_user runs after the transaction commits, so if it fails the password is changed and old sessions stay; it can go inside users::update's transaction. (2) An admin who resets their own password also ends their own session; fine, but the panel (#258) should expect the 401.
New commits pushed, approval review dismissed automatically according to repository settings