Skip to content

feat(auth): add CLI-designated IT accounts - #56

Merged
systemicdream merged 1 commit into
mainfrom
IT-Accounts
Oct 19, 2026
Merged

systemicdream merged 1 commit into
mainfrom
IT-Accounts

Conversation

@systemicdream

Copy link
Copy Markdown
Contributor

Summary

Lets operators designate accounts as IT accounts (stored role TECHNICIAN) that are distinct from regular user accounts, and adds a single server-side guard that future IT-only abilities can reuse. No new IT abilities are added yet.

Related issue

Closes #55

What changed

  • pnpm user:set-role interactively promotes an existing account to TECHNICIAN or demotes it to USER, backed by a new AuthRepository.setUserRole. Role parsing is shared with pnpm user:create.
  • New requireTechnician guard (apps/api/src/auth/require-technician.ts) resolves the role from the server-side session on every request; the assignment route now uses it with unchanged 401/403 responses. Role changes apply on the next request without revoking sessions.
  • The account menu shows an "IT" badge for IT accounts; the accessible label becomes "Account: Signed in as (IT)".
  • ADR-006, a spec, and a plan record the decision. README documents creating and upgrading IT accounts (command line only), and AGENTS.md lists the new command.

Validation

  • Added or updated tests where behavior changed: repository promote/demote/unknown-user integration tests, demoted-session 403 route test, parseUserRole unit tests, badge component tests.
  • Ran relevant local checks: format, lint, typecheck, migrate, test, coverage, build, smoke, and git diff --check in the pinned toolchain.
  • Verified the primary user flow: ran user:set-role against a local database (promote, demote, invalid role, unknown user), and checked the badge in a browser for IT and regular accounts at desktop and 375px widths.

Screenshots or recordings

The IT badge appears next to "Signed in" in the header account button for IT accounts at desktop and mobile widths; regular accounts are unchanged.

Review notes

  • The stored role stays TECHNICIAN; "IT" is the product label. Renaming the enum was rejected to avoid a migration and an API contract change (see ADR-006).
  • Role changes are command-line only; an in-app role manager needs an admin role and is deferred.
  • No migration is required.

Add pnpm user:set-role to promote or demote existing accounts between
USER and TECHNICIAN, extract a shared requireTechnician guard for
IT-only routes, and label IT accounts in the account menu.

Records the decision in ADR-006 with a matching spec and plan.

Closes #55
@systemicdream
systemicdream merged commit 3018369 into main Oct 19, 2026
3 checks passed
@systemicdream
systemicdream deleted the IT-Accounts branch October 19, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: IT Users

3 participants