Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2.8 KiB
Spec Delta
Purpose
Admins with the Users module manage staff accounts: who can log in, which roles they hold, and which company they belong to.
ADDED Requirements
Requirement: User list
The system SHALL list admin users only (never members), paginated on the server, searchable by name, username or email, filterable by active state, and sortable by column.
Scenario: Search
- GIVEN admin users
sales1andsales2and a memberm100 - WHEN an admin with
BO_USERSsearches forsales - THEN the list shows
sales1andsales2and notm100
Requirement: Create user
The system SHALL let an admin with BO_USERS create an admin user with name, username, email and one or more roles. Username and email SHALL be unique. The new user SHALL receive a temporary password by email and SHALL belong to the creating admin's company.
Scenario: New user
- WHEN an admin creates user
sales1with emailsales1@example.comand role Sales - THEN the user is saved as active with a pending password change
- AND a temporary password is emailed to
sales1@example.com - AND the user's company is the creating admin's company
Scenario: Duplicate username
- GIVEN a user
sales1exists - WHEN an admin creates another user with username
sales1 - THEN the save is refused and the form shows that the username is taken
Requirement: Edit and deactivate user
The system SHALL let an admin with BO_USERS change a user's name, email, roles and active state. A deactivated user SHALL NOT be able to log in, and a session they already hold SHALL be refused on its next /api/admin/** call. An admin SHALL NOT be able to deactivate their own account.
Scenario: Deactivate
- GIVEN user
sales1is signed in - WHEN an admin deactivates
sales1 - THEN
sales1's next/api/admin/**call responds 401 - AND
sales1can no longer log in
Scenario: Self-deactivation
- WHEN an admin tries to deactivate their own account
- THEN the save is refused with a message
Requirement: Admin-triggered password reset
The system SHALL let an admin with BO_USERS reset another user's password, which emails the user a temporary password and requires a change at next login.
Scenario: Reset
- WHEN an admin resets
sales1's password - THEN
sales1's old password stops working - AND a temporary password is emailed to
sales1's email address
Requirement: Company membership
Every admin user SHALL belong to exactly one company. The company SHALL be set by the system from the creating admin, never from the request.
Scenario: Company in the request is ignored
- WHEN a create-user request carries a company id different from the admin's own
- THEN the new user gets the admin's company