Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc3fd6ff76 | ||
|
|
58ed85bdc9 |
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -18,13 +18,14 @@ The system SHALL list admin users only (never members), paginated on the server,
|
|||||||
|
|
||||||
### Requirement: Create user
|
### 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.
|
The system SHALL let an admin with `BO_USERS` create an admin user with name, username, email, one or more roles, and an initial password with its confirmation. Username and email SHALL be unique. The password SHALL match its confirmation and pass the admin password rules. The new user SHALL be saved with a pending password change, SHALL belong to the creating admin's company, and SHALL NOT be sent an email.
|
||||||
|
|
||||||
#### Scenario: New user
|
#### Scenario: New user
|
||||||
|
|
||||||
- **WHEN** an admin creates user `sales1` with email `sales1@example.com` and role Sales
|
- **WHEN** an admin creates user `sales1` with email `sales1@example.com`, role Sales and a valid initial password
|
||||||
- **THEN** the user is saved as active with a pending password change
|
- **THEN** the user is saved as active with a pending password change
|
||||||
- **AND** a temporary password is emailed to `sales1@example.com`
|
- **AND** `sales1` can sign in with that password and must choose a new password before anything else
|
||||||
|
- **AND** no email is sent
|
||||||
- **AND** the user's company is the creating admin's company
|
- **AND** the user's company is the creating admin's company
|
||||||
|
|
||||||
#### Scenario: Duplicate username
|
#### Scenario: Duplicate username
|
||||||
@@ -33,6 +34,12 @@ The system SHALL let an admin with `BO_USERS` create an admin user with name, us
|
|||||||
- **WHEN** an admin creates another user with username `sales1`
|
- **WHEN** an admin creates another user with username `sales1`
|
||||||
- **THEN** the save is refused and the form shows that the username is taken
|
- **THEN** the save is refused and the form shows that the username is taken
|
||||||
|
|
||||||
|
#### Scenario: Weak or mismatched initial password
|
||||||
|
|
||||||
|
- **WHEN** an admin creates a user with a password that fails the admin password rules, or that does not match its confirmation
|
||||||
|
- **THEN** the save is refused with a message on the form
|
||||||
|
- **AND** no user is created
|
||||||
|
|
||||||
### Requirement: Edit and deactivate user
|
### 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. An admin who is not super admin SHALL NOT change the roles on their own account. No admin SHALL assign `ROLE_ADMIN` or `ROLE_MEMBER` when creating or editing a 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. An admin who is not super admin SHALL NOT change the roles on their own account. No admin SHALL assign `ROLE_ADMIN` or `ROLE_MEMBER` when creating or editing a user.
|
||||||
@@ -62,14 +69,27 @@ The system SHALL let an admin with `BO_USERS` change a user's name, email, roles
|
|||||||
|
|
||||||
### Requirement: Admin-triggered password reset
|
### 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. The system SHALL NOT let an admin set another user's password to a value the admin chooses.
|
The system SHALL let an admin with `BO_USERS` give an active admin user a new password in one of two ways: an emailed reset, where the system emails a generated temporary password, or a temporary password the admin types with its confirmation. Either way the user's old password SHALL stop working, and the user SHALL be required to change the password at the next login. A typed password SHALL pass the admin password rules. No password SHALL be logged or returned in a response.
|
||||||
|
|
||||||
#### Scenario: Reset
|
#### Scenario: Reset
|
||||||
|
|
||||||
- **WHEN** an admin resets `sales1`'s password
|
- **WHEN** an admin resets `sales1`'s password by email
|
||||||
- **THEN** `sales1`'s old password stops working
|
- **THEN** `sales1`'s old password stops working
|
||||||
- **AND** a temporary password is emailed to `sales1`'s email address
|
- **AND** a temporary password is emailed to `sales1`'s email address
|
||||||
|
|
||||||
|
#### Scenario: Admin sets a temporary password
|
||||||
|
|
||||||
|
- **GIVEN** an active user `sales1`
|
||||||
|
- **WHEN** an admin sets a temporary password for `sales1` that passes the rules and matches its confirmation
|
||||||
|
- **THEN** `sales1`'s old password stops working
|
||||||
|
- **AND** `sales1` can sign in with the temporary password and must choose a new password before anything else
|
||||||
|
|
||||||
|
#### Scenario: Weak or mismatched temporary password
|
||||||
|
|
||||||
|
- **WHEN** an admin sets a temporary password that fails the admin password rules, or that does not match its confirmation
|
||||||
|
- **THEN** the request is refused with a message
|
||||||
|
- **AND** `sales1`'s password is unchanged
|
||||||
|
|
||||||
#### Scenario: No direct password set
|
#### Scenario: No direct password set
|
||||||
|
|
||||||
- **WHEN** an admin calls `POST /api/admin/users/{id}/changePassword`
|
- **WHEN** an admin calls `POST /api/admin/users/{id}/changePassword`
|
||||||
@@ -83,3 +103,34 @@ Every admin user SHALL belong to exactly one company. The company SHALL be set b
|
|||||||
|
|
||||||
- **WHEN** a create-user request carries a company id different from the admin's own
|
- **WHEN** a create-user request carries a company id different from the admin's own
|
||||||
- **THEN** the new user gets the admin's company
|
- **THEN** the new user gets the admin's company
|
||||||
|
|
||||||
|
### Requirement: Temporary password refusals
|
||||||
|
|
||||||
|
The system SHALL refuse to set a temporary password for a disabled user, for the caller's own account, and for a super admin when the caller is not a super admin, and SHALL leave that user's password unchanged.
|
||||||
|
|
||||||
|
#### Scenario: Disabled user
|
||||||
|
|
||||||
|
- **GIVEN** user `sales2` is deactivated
|
||||||
|
- **WHEN** an admin sets a temporary password for `sales2`
|
||||||
|
- **THEN** the request is refused and `sales2`'s password is unchanged
|
||||||
|
|
||||||
|
#### Scenario: Own account
|
||||||
|
|
||||||
|
- **WHEN** an admin sets a temporary password for their own account
|
||||||
|
- **THEN** the request is refused
|
||||||
|
|
||||||
|
#### Scenario: Super admin target
|
||||||
|
|
||||||
|
- **GIVEN** the caller is not a super admin
|
||||||
|
- **WHEN** they set a temporary password for a super admin
|
||||||
|
- **THEN** the request is refused and the super admin's password is unchanged
|
||||||
|
|
||||||
|
### Requirement: Generated temporary passwords are unpredictable
|
||||||
|
|
||||||
|
Every temporary password the system generates for an admin user SHALL come from a cryptographically secure random source. This covers the emailed admin reset and admin forgot-password.
|
||||||
|
|
||||||
|
#### Scenario: Generated passwords do not repeat
|
||||||
|
|
||||||
|
- **WHEN** the system generates 1,000 temporary passwords of 12 characters
|
||||||
|
- **THEN** all of them are different
|
||||||
|
- **AND** every character comes from the generator's alphabet
|
||||||
Reference in new issue
Block a user