Complete specification for rewriting Swarmops v5 as using.cash v6: - Proposal: scope buckets (Working Rewrite / First Beyond Working / Maybe), non-goals (governance, geography, memberships permanently cut) - Design: 18 architectural decisions including preserved patterns (Basic/Logic, stored procs, credential split), new patterns (repository classes, chain abstraction, rate providers), and operational concerns (Galera awareness, continuation transactions, VAT booking, OOD denormalization) - Specs: 17 capability specifications with SHALL/MUST requirements and WHEN/THEN scenarios, covering accounting core, AP/AR, crypto treasury, exchange rates, organizations, users/auth, documents, comms, dashboard, end-of-month, backend worker, event bus, data migration, API layer, frontend app, and CI/packaging - Tasks: 145 implementation tasks grouped by subsystem, ordered by dependency (migration gates API/frontend work) Two rounds of adversarial review incorporated. Made-with: Cursor
2.8 KiB
ADDED Requirements
Requirement: User identity
The system SHALL maintain user accounts with: name, email, password hash, and active/inactive status. Users replace the v5 "People" and "Members" concepts — there is no membership lifecycle, only user accounts with system access.
Scenario: Create user
- WHEN an administrator creates a new user with name, email, and initial password
- THEN the user account is created and can log in
Scenario: Deactivate user
- WHEN an administrator deactivates a user
- THEN the user can no longer log in but their historical data (transaction authorship, attestations) is preserved
Requirement: Authentication
The system SHALL support password-based authentication. Login produces a session/token that authenticates subsequent API requests. Failed login attempts SHALL be rate-limited.
Scenario: Successful login
- WHEN a user submits valid credentials
- THEN an authenticated session is established and the user is directed to the dashboard
Scenario: Failed login
- WHEN a user submits invalid credentials
- THEN the system rejects the attempt with a generic error (not revealing whether the email or password was wrong)
Scenario: Password reset
- WHEN a user requests a password reset
- THEN a reset link is sent to their registered email
Requirement: Instance-level RBAC
The system SHALL implement role-based access control at the instance level. Users are assigned one or more roles. Each role has a set of permissions from the permission enum. Permission checks are enforced on API endpoints.
Scenario: Assign role to user
- WHEN an administrator assigns a role to a user
- THEN the user gains all permissions associated with that role
Scenario: Permission check on API call
- WHEN a user calls an API endpoint requiring a specific permission
- THEN the system checks whether any of the user's roles include that permission and rejects the call if not
Scenario: Role with multiple permissions
- WHEN a role is configured with permissions CanViewLedgers and CanAttestExpenses
- THEN users with that role can both view ledgers and attest expense claims
Requirement: Dev-mode impersonation
The system SHALL support a development-mode-only feature where a developer can bypass login and assume administrator access. This feature MUST be disabled in production builds via configuration.
Scenario: Dev impersonation active
- WHEN the system runs in development mode and a developer activates impersonation
- THEN the developer is authenticated as a system administrator without credentials
Scenario: Dev impersonation blocked in production
- WHEN the system runs in production mode
- THEN the impersonation endpoint is not registered and returns 404