Files
co-lite/openspec/changes/add-company-scoping/specs/admin-users/spec.md
T

2.1 KiB

MODIFIED Requirements

Requirement: Company membership

Every admin user other than a super admin SHALL belong to exactly one company. A company user's new user SHALL belong to the creating user's company, whatever the request says. A super admin SHALL choose the company of a new user, or no company to create another super admin.

Scenario: Company in the request is ignored

  • WHEN an INS user's create-user request carries the CV company id
  • THEN the new user belongs to INS

Scenario: Super admin chooses the company

  • WHEN a super admin creates a user and chooses CV
  • THEN the new user belongs to CV

Requirement: Create user

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 within the user's company, so the same username or email may exist in another company. A username SHALL NOT contain @. The password SHALL match its confirmation and pass the admin password rules. The new user SHALL be saved with a pending password change and SHALL NOT be sent an email.

Scenario: New user

  • WHEN an INS admin creates user sales1 with email sales1@example.com, role Sales and a valid initial password
  • THEN the user is saved as active in INS with a pending password change
  • AND sales1 can sign in with company ins and that password and must choose a new password before anything else
  • AND no email is sent

Scenario: Duplicate username

  • GIVEN a user sales1 exists in INS
  • WHEN an admin creates another INS user with username sales1
  • THEN the save is refused and the form shows that the username is taken

Scenario: Same username in another company

  • GIVEN a user sales1 exists in INS
  • WHEN a CV admin creates user sales1 in CV
  • THEN the user is created

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