Skip to content

URD: User Management

ModuleCORE-01Versionv0.4
StatusIn-progressDate2026-05-29

1. Purpose

Define what User Management must do for users: how they create accounts, authenticate, and manage profiles, and how business owners manage employees and customers within their organizations. It is the platform's foundation — every other module trusts the identity and scope issued here.

2. Scope

IncludedExcluded
Account creation (sign-up) and authentication (sign-in)Custom role creation → Permissions
Password management (change, forgot / reset)OAuth / OAuth2 login flow
OTP verification for email and phone; link accountSession management and remote revocation
Eight fixed system roles and role-based accessUser invitation system
Employee lifecycle (create, assign, deactivate, remove)Audit / login history
Customer lifecycle (create, update, soft-delete, promote)Multi-organization access for one user
User profile, identifier, and per-user configuration managementTwo-factor enforcement

3. Definitions

TermDefinition
UserAn authenticated identity — internal (operator) or external (owner, employee, customer).
CredentialA secret used to authenticate — a hashed password today; 2FA / OAuth schemes are defined but not enforced.
IdentifierA login value tied to a user — username, email, or phone. Each is globally unique within its type.
User ProfilePersonal info attached to a user — name, birthday, locale, contact details. One per user.
User ConfigurationA per-user key-value setting, grouped by code. A default set is created on registration.
RoleA classification that determines access level and data scope. Eight fixed roles exist.
OwnerThe user who creates a business during onboarding; has full access to their organization.
CashierA merchant-level staff role for cashiers, scoped to specific merchants (same tier as Employee).
EmployeeA staff member scoped to specific merchants within an organization.
CustomerAn end-customer linked to an organization; can be promoted from sale-level data to a full user.
GuestAn unauthenticated-style global role with no backend permissions; lowest priority.
OTPA one-time code delivered via email or SMS for identifier verification or password reset.
Session Token (JWT)Issued on sign-in; carries user ID, roles, organization IDs, and merchant IDs for stateless authorization.

4. Conceptual Model

Conceptual only — full schema lives in the developer domain model.

5. Functional Requirements

One table per functional area. <AREA> codes match the test-case IDs. Priority = MoSCoW (Must / Should / Could / Won't).

5.1 Authentication (AUTH)

IDPRequirement
URD-AUTH-001MUser can sign up with a username and password
URD-AUTH-002MSign-up creates account, profile, identifiers, and default settings in one operation
URD-AUTH-003MIf any part of sign-up fails, nothing is created (all-or-nothing)
URD-AUTH-004MUser can sign in with any verified identifier (username / email / phone) + password
URD-AUTH-005MSuccessful sign-in returns a session token carrying roles and organization / merchant scope
URD-AUTH-006MPasswords are securely hashed before storage and never stored in plain text
URD-AUTH-007MUser can change their password (current password verified first)
URD-AUTH-008MUser can verify their email via OTP (request → receive code → submit)
URD-AUTH-009MUser can verify their phone via OTP (same flow)
URD-AUTH-010MUser can reset a forgotten password (request → verify code → set new password)
URD-AUTH-011SUser can add (link) a verified email or phone to an authenticated account
URD-AUTH-012SSystem records the last sign-in timestamp
URD-AUTH-013CTwo-factor authentication is enforced Planned
URD-AUTH-014COAuth / third-party login is supported Planned

5.2 User Account (USR)

IDPRequirement
URD-USR-001MEach user has a unique system-generated ID
URD-USR-002MA user can have multiple identifiers (username, emails, phones)
URD-USR-003MEach identifier is globally unique within its type
URD-USR-004MUsername is required and automatically considered verified
URD-USR-005MEmail and phone identifiers start unverified and require OTP to verify
URD-USR-006MUser can view and update their own profile (name, birthday, locale, contacts)
URD-USR-007MAuthorized users can change a user's status (activate, deactivate, block, archive)
URD-USR-008MDeactivated and blocked users cannot sign in
URD-USR-009MUser data is always preserved — accounts are never permanently deleted (soft-delete)
URD-USR-010SUser can set a language / locale preference
URD-USR-011CARCHIVED is a terminal status and cannot be reactivated

5.3 Roles & Scoping (ROLE)

IDPRequirement
URD-ROLE-001MSystem provides eight fixed roles: Super Admin, Admin, Operator, Owner, Cashier, Employee, Customer, Guest
URD-ROLE-002MRoles have a priority hierarchy; higher priority means broader access
URD-ROLE-003MSuper Admin and Admin bypass all data filtering
URD-ROLE-004MOwner sees only their own organization and its merchants
URD-ROLE-005MEmployee / Cashier see only merchants they are assigned to
URD-ROLE-006MList and count operations are filtered by the requesting user's scope
URD-ROLE-007MUsers cannot manage roles equal to or higher than their own priority
URD-ROLE-008MOwner role is automatically assigned during sign-up

5.4 Employee Management (EMP)

IDPRequirement
URD-EMP-001MOwner can create employee accounts
URD-EMP-002MEmployee is linked to an organization and one or more merchants
URD-EMP-003MEmployee can access only merchants they are assigned to
URD-EMP-004MEmployee can sign in with their own credentials
URD-EMP-005MData queries for an employee are filtered by their merchant assignments
URD-EMP-006MOwner can update employee merchant assignments (replaces all previous assignments)
URD-EMP-007MOwner can deactivate or remove an employee account
URD-EMP-008MSystem validates that the owner actually owns the organization and all listed merchants

5.5 Customer Management (CUS)

IDPRequirement
URD-CUS-001MOwner can create customer accounts
URD-CUS-002MCustomer is linked to an organization and receives the Customer role automatically
URD-CUS-003MCustomer profile includes name and contact details
URD-CUS-004MCustomer information can be updated and soft-deleted
URD-CUS-005SA sale-level customer can be promoted to a full user account
URD-CUS-006SPromotion checks for identifier conflicts before creating the user

5.6 User Configuration (CFG)

IDPRequirement
URD-CFG-001MDefault configurations are created automatically when a user registers
URD-CFG-002MConfigurations are grouped and uniquely identified by code per user
URD-CFG-003SUser can view and update their own configurations

6. Acceptance Criteria

AC-AUTH-01: Sign-in
GivenWhenThen
Valid credentials, verified identifierUser signs inSession token issued with roles and scope
Invalid passwordUser signs inAuthentication rejected
Unverified identifierUser signs inSign-in rejected — identifier not verified
Deactivated / blocked userUser signs inAccess denied
Successful sign-inLast sign-in timestamp updated
AC-AUTH-02: Sign-up
GivenWhenThen
New username + password + profileUser signs upAccount created with Owner role
Username already existsUser signs upConflict error
Successful registrationDefault settings auto-created
Any step failsEntire registration rolls back
AC-AUTH-03: OTP verification
GivenWhenThen
Unverified email or phoneUser requests OTPCode delivered, session token returned
Valid session + correct codeUser submitsIdentifier marked verified
Expired codeUser submitsError — code expired
Too many attemptsUser retriesError — max attempts exceeded
AC-AUTH-04: Forgot password
GivenWhenThen
User forgot passwordRequests resetReset session created
Valid reset codeUser verifiesSession confirmed
Verified sessionUser sets new passwordPassword updated (hashed)
AC-EMP-01: Employee creation
GivenWhenThen
OwnerCreates employee with merchant listAccount created with Employee role, linked to org + merchants
Owner does not own the organizationCreates employeeForbidden
Merchant not under owner's organizationIncluded in listValidation error
AC-EMP-02: Merchant reassignment
GivenWhenThen
Existing employeeOwner updates assignmentsPrevious assignments replaced with new ones
Employee sees only the new merchants
AC-CUS-01: Customer promotion
GivenWhenThen
Sale-level customerPromotion triggeredFull user created with Customer role
Identifier conflictPromotion attemptedBlocked with conflict error

7. Constraints & Non-Goals

Constraints

IDConstraint
C-01Passwords must be securely hashed; plain-text storage is forbidden
C-02The eight fixed roles are pre-seeded and cannot be modified or deleted
C-03Role priority is enforced — no user can manage a role at their level or above
C-04Account creation is atomic — partial creation is not allowed
C-05All records use soft-delete — physical deletion is never performed
C-06Each identifier type is globally unique (one email belongs to only one user)
C-07Employees must be linked to both an organization and at least one merchant
C-08Session tokens are stateless — permission changes take effect on next sign-in
C-09All operations except sign-in / sign-up require authentication

Non-Goals

  • Custom role creation and dynamic permission management → Permissions
  • OAuth / OAuth2 third-party login flow
  • Session management and remote revocation
  • User invitation via email or phone
  • Login history and audit logging
  • Multi-organization access for a single user
  • MFA enforcement policies

8. Version History

DateAuthorDescriptionVer
2026-02-26P. Do — Product OwnerInitial user storiesv0.1
2026-04-16ProductRestructured into URD with requirement IDsv0.3
2026-05-29ProductMigrated to module-docs convention; corrected status (BLOCKED, no IDSAFE), added link-account + status-honest gapsv0.4

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.