Skip to content

Roles and access ​

All rules live in one module in packages/api (access.ts). The UI only hides what the server would refuse. A record outside your scope returns "not found", so nobody can probe ids.

RoleWhoSees
OwnerJanuEverything: money, settings, team, every client, every lead.
Manager (optional, later)Day-to-day opsEverything except money, settings, team. Build the role but nothing depends on it yet.
SalesDoor-to-door and call sellersTheir own day planner, their own businesses/leads, their QR links, outcomes, their commission. Never clients' production data.
VideographerCrewOnly clients assigned to them: shoot days, scripts, shot lists, their uploads, editor requests, review comments tagged to them, their pay and metrics.
EditorCrewOnly clients assigned to them: footage, edit tasks, review comments tagged to them, their pay and metrics.
Client AdminThe paying business's main loginTheir own business only: plan, calendar, scripts, videos, approvals, billing, to-do list, sub-account requests.
Client MemberSub-accounts (the client's salespeople, editors, social managers)Their business's calendar, scripts, videos and to-do list. No billing unless the Client Admin allows it.

Modelling ​

A client business is a Better Auth organization. The Client Admin is its owner-role member; Client Members are members with a restricted role. Maximum logins per business is a setting (access.maxLoginsPerClient, default 5).

In code (ADR 0007):

  • user.role (admin plugin) is one of owner | manager | sales | videographer | editor | client.
  • Client Admin and Client Member are both client; the organization member role distinguishes them (owner = Client Admin, member = Client Member).
  • The web app has four spaces: /owner (owner, manager), /sales, /crew (videographer, editor), /client.

Clipper keys ​

A Clipper key is a Better Auth API key (prefix sgc_) that lets the desktop app connect as its owner's user (ADR 0011).

  • Who may create one: owner, manager, editor and videographer (CLIPPER_ROLES in packages/api/src/access.ts). Sales and clients cannot create keys or use the Clipper.
  • Whose data: owner and manager see every user's keys, projects and usage. Editors and videographers see only their own. Out-of-scope records are NOT_FOUND.
  • Owners and managers: can hold keys and see usage and the library. They upload from the web app, not from the desktop app.
  • Expiry and revocation: a key expires between 1 and 365 days after creation and can be revoked earlier. Creation and revocation are audited.
  • Sending clips: only the videographer or editor assigned to the video can send, and only to videos they can see (Production).

Public pages ​

Public pages need no login (form, call-booked confirmation, quote, contract signing, set-password). Each takes only an unguessable token, is rate-limited per IP, and shows only what that page needs. They live under /p/*.

Enforcement conventions ​

  • Access rules live in packages/api/src/access.ts; routers ask it for scope and never hand-roll checks.
  • Out-of-scope records are NOT_FOUND, never FORBIDDEN. FORBIDDEN is only for a route the role may not use at all.
  • Role membership of a procedure is declared with roleProcedure(...); record-level scope is a filter from the access module applied to every query.

Internal documentation. Not for clients.