Skip to main content

Role boundaries (2026-11-11)

This page records how the HTTP API keeps each role to its own data, following the web console's request "Backend requirements — Business, Installer and End User access" (2026-11-11). The section numbers (§1–§8) are that request's. Roles: Super Admin and Administrator in the Crown (PLATFORM) org, Business (an OPERATOR org), Installer (the Business's seeded R-91 template, scope SCOPED) and End User (R-92, connected through a share or a customer org, or independent in a personal org). See Roles & permissions for the role levels and Authorization for scopes and the Crown platform fallback.

:::info Status In the code on main as of 2026-11-12 and covered by unit tests. Not yet confirmed on dev: no request below has been executed against a deployment yet, so every example is illustrative. Existing data needs the RBAC backfill (§4, §5) and the projection rebuild (§8) to be run by an operator. :::

Which roles an org may grant (§2, §4)​

Checked on POST /v1/orgs/{orgId}/invitations, PATCH …/invitations/{inviteId} and a role change on PATCH …/members/{sub}, after the existing retired-role and escalation checks.

OrgRoles that may be granted
Crown (PLATFORM)Super Admin, Administrator, the org's custom roles
Business (OPERATOR, not personal)the org's custom roles (Installer and its copies). End User on an invitation — from a Business user (ADR 0033 join request, 2026-11-27), the Installer path or a Super Admin; a member role change to End User stays Super Admin only (2026-11-12). Business only by a Super Admin (owner hand-over, member role change); a new Business owner comes from POST …/businesses — since 2026-11-30 an invitation with the Business role is refused for everyone (403 BUSINESS_ROLE_VIA_CREATE_ONLY, Invitations)
Customer orgEnd User only
Personal orgEnd User only (unchanged: PERSONAL_ORG errors keep priority)
Partner orgunchanged

Anything else → 403 FORBIDDEN, details.reason: "ROLE_NOT_ASSIGNABLE". A member patch that does not change the role is not checked, so an existing member with an older role can still have their scope edited.

GET /v1/orgs/{orgId}/roles in a Business org no longer lists Super Admin, Administrator or (since 2026-11-12) Business. End User stays listed, because connected End Users are members there, but a Business user cannot grant it: the console should offer End User only on the Installer's invite flow. The Crown org still lists every built-in role, since built-in roles are edited there.

Installer-type roles are stored with scope NONE (2026-11-12)​

Superseded by RBAC v2 (ADR 0026, deployed to dev 2026-11-13): Installer-type roles are now stored with scope ALL and every Installer membership is read as ALL — an Installer sees and edits every plant of its Business. The rest of this section describes the 2026-11-12 behaviour.

Console request 2026-11-12 (web console spec 037: permissions change only on roles; "the backend stays authoritative for plant scope"). An Installer-type role is a non-built-in role with scopeRule: SCOPED in a Business (non-personal OPERATOR) org — the Installer template and its copies, the only custom roles such an org may grant.

  • POST /v1/orgs/{orgId}/invitations, PATCH …/invitations/{inviteId} (when roleId or scope is sent), PATCH …/members/{sub} (when the role changes or scope is sent) and members:bulk-assign-scope store {kind: "NONE", targets: []} for such a role, whatever scope the client sent. No 422: the client's value is ignored, so older clients keep working and none can widen an Installer's reach.
  • An Installer with scope NONE reaches exactly the plants assigned to them as Installer (§6 below).
  • A change that touches neither role nor scope (department, MFA flag, a department-only invitation edit) keeps the stored scope. Existing members are not migrated: an Installer stored with another scope keeps it until their role or scope is next changed (decision C-2).
  • Unchanged: ALL-rule roles (scope ALL, FR-021), End User invitations from the Installer path (scope PLANTS, ADR 0021), and every other org kind.
  • Open: §6 still keys on the stored scope, so an existing Installer stored with ALL keeps Business-wide customer and share lists until their role or scope is changed (KI-50). Deferred by decision C-2.

Code: isInstallerTypeRole / installerRoleScope in packages/core/src/access/assignable-roles.ts.

End Users never hold Administrator (§4)​

  • A customer org's first member, and the owner invited when a Business adds a customer (or a plant with a new customer), get End User, not Administrator. End User has team, customers, settings, roles, audit, firmware at NONE, so GET /v1/me/context no longer opens Team, Customers, Roles, Audit or Engineering for them.
  • The End User role itself (2026-11-12): service is NONE (was EDIT), so Work orders / Service no longer open; raising a service request on their own plant still works (it needs plants ≥ VIEW). End Users keep commands and register levels to control their own devices, but GET /v1/me/context never lists the engineering module for the End User role — nor, since 2026-11-12, for an Installer-type role (the Installer template or any copy of it, with or without its template marker; Installers keep commands: EDIT for commissioning; route authorization is unchanged). The same predicate decides who may invite End Users from the Installer path. This applies to every End User at once (a built-in role is not stored per org), unless a Super Admin override of End User was saved earlier.
  • The RBAC roles backfill step 4 now also moves every ACTIVE Administrator of a customer org to End User (it already did this for personal orgs). Run it in dry-run first.

Installer template (§5)​

The seeded Installer now has reports: MANAGE (was EDIT), so Installers can delete and schedule reports on their plants. customers stays VIEW. The backfill raises existing Installer roles; it never lowers a level.

Changed 2026-11-23 (RBAC-S5, S6, S7; built, not deployed). New Installer roles start at reports: EDIT again (generate only; delete and schedule control need MANAGE) and sharing: VIEW. Existing Installer roles keep their levels.

Changed 2026-11-26 (owner; built, not deployed). sharing is MANAGE again for the Installer template, and the RBAC backfill raises every existing Installer role to it: template roles and plain copies (a copy is raised on sharing only). An Installer shares any plant of its Business, whoever added the plant, and may change the plants of an End User member through PATCH …/members/{sub} (End Users only, plant scope only). team and customers are unchanged, and an Installer still never archives or deletes a plant (plants: EDIT). An Installer (customers: VIEW) no longer receives a customer's contact / lastContact.

Scoped lists and writes (§6)​

For a member whose scope is not ALL (an Installer, or any scoped member), "their plants" are the plants their scope covers plus the plants assigned to them as Installer.

Shares (GET/POST/PATCH/DELETE /v1/orgs/{orgId}/shares…):

  • The list returns only shares whose selector stays inside the caller's plants: a PLANTS selector whose plants are all theirs, or a TAG/REGION selector naming only tags/regions their own scope is built from. The levels[].shareCount on the first page counts those rows on that page, not the org total.
  • PATCH/DELETE of a share outside their plants → 404 NOT_FOUND (the share is never confirmed).
  • POST, or a PATCH that changes the selector to reach outside their plants → 403 FORBIDDEN, details.reason: "OUTSIDE_SCOPE".

Customers (GET /v1/orgs/{orgId}/customers, …/{customerOrgId}, /overview, PATCH, :close):

  • The list holds only the customers of the caller's plants, with no limit on how many plants (since 2026-11-12; it used to read at most 1,000). It reads the scope's own indexes: a CUSTOMER scope's targets directly, every plant linked to a TAG/REGION target, and the plant records of a PLANTS scope and of the plants assigned to the Installer. Plants of another org and plants being deleted don't count. Every filter and q still apply. It is in name order with its own cursor; tiles are omitted (they are org-wide).
  • Since 2026-11-25 this includes the End Users their plants are shared with: a shared plant's customer is the End User's personal org (End Users are customers). An End User of a plant outside the caller's plants stays 404.
  • Detail, overview, edit and close of any other customer → 404 NOT_FOUND.

Customer and partner codes (GET /v1/lookup?code=CU-…|PB-…, A12 search suggestions): a CU- code resolves only for a customer of the caller's plants; PB- (partner businesses) never resolves. Both answer the same 404 as an unknown code.

Partner businesses (GET /v1/orgs/{orgId}/partners, …/{partnerOrgId}, PATCH): the list is empty ({items: [], relationshipCounts: {}}) and detail / edit answer 404 NOT_FOUND.

Access requests (GET /v1/orgs/{orgId}/access-requests, :approve, :reject): incoming requests are only those on the caller's plants (a page can come back short; the cursor still advances); approving or rejecting any other request → 404 NOT_FOUND.

Scope NONE with assigned plants: work-order lists and summaries, maintenance history and report visibility count the plants assigned to the Installer as theirs (a NONE scope alone covers nothing).

Work orders (WO-4): an OPERATOR member below service: MANAGE (the Installer tier) sees only the orders assigned to them — in lists, on the order, through GET /v1/lookup?code=WO-…, and (since 2026-11-12) in an alert's linked work orders (GET /v1/alerts/{alertId}/work-orders).

Members scoped ALL (the Business itself) and Crown staff are unaffected.

Crown staff are not named to Businesses (§3)​

Writes made by a Crown member acting in another org through the platform fallback are marked viaPlatform: true:

WhereMarked field
Access logthe entry (PLATFORM_ACCESS entries always; now also the action's own entries, e.g. MEMBER_INVITED)
Work-order events, notes, attachmentsthe actor (ActorRef.viaPlatform)
Plant installedBy, installer historyinstalledBy.viaPlatform, by.viaPlatform

For a reader with no Crown membership, every response replaces such an actor with { "displayName": "Crown Support", "viaPlatform": true }: no sub, orgId, role or email. Crown members see the person. Masking fails closed: it is skipped only for a caller known to hold an ACTIVE Crown membership, so a route that answers before resolving the caller's org context masks too. Records written before 2026-11-12 carry no marker (except PLATFORM_ACCESS entries) until the Crown staff masking backfill is run; it can reach older access-log entries and work-order events, not attachments or plant installedBy. Alert actions are owned by the TCP server, which applies the same rule using two realtime ticket claims HTTP now issues: pm (the reader is a Crown member) and vp (the ticket reaches its org through platform access) — see Realtime.

Crown-wide customer list (§8)​

GET /v1/orgs/{crownOrgId}/customers, called by a Crown Super Admin or Administrator (ACTIVE, scope ALL), lists the customers of every Business, plus Independent End Users' personal orgs (ADR 0017 all-org mode):

  • Each item's operatorOrgId is its Business; refs.orgs[operatorOrgId].name is the Business name. A personal org has operatorOrgId equal to its own id and personal: true, portalLevel: "NONE", and plantCount exact.
  • status, customerType, city, portalLevel, tagId and q (name, code, city words) filter; sort is name or -name. Personal orgs never match customerType, city, tagId or a portalLevel other than NONE.
  • Customers of a suspended Business are listed and carry operatorSuspended: true (Bug fix 2026-12-02; before, they were left out). Customers of a closed Business are left out, and so are entries whose profile no longer exists.
  • Tiles (first page, since 2026-11-12): active and totalOnRecord count every Business customer plus every personal org, noPortalAccess ACTIVE Business customers with portal NONE (bug fix 2026-12-02: closed customers, whose portal a close sets to NONE, were counted too; corrected by the next backfill:customer-list run), capacityKwp every org's ACTIVE plants (the HQ dashboard's fleet sum). approximate: true. Customers of a suspended Business are counted (they are listed). Customers of a closed Business are not: :close subtracts them from the platform counters once (Bug fix 2026-12-02), and the backfill leaves them out. Data older than the counters needs the customer list backfill (customer counts) and rebuild:projections -- --all-orgs --execute (capacity).
  • One Business (2026-11-12): ?operatorOrgId=<businessOrgId> returns that Business's own customer list read through platform access — the same filters, cursor and first-page tiles as the Business sees, plus the Business in refs.orgs. An unknown, closed or personal org → 404 NOT_FOUND; a suspended one is listed (Bug fix 2026-12-02). Outside the Crown-wide list, an operatorOrgId other than the path {orgId} → 400 VALIDATION_FAILED.
  • The cursor is tied to the filters; reusing it with other filters → 400 INVALID_CURSOR.
  • Customers and personal orgs created before ADR 0017's list entries existed appear only after the customer list backfill has been run against dev (rebuild:projections does not write these entries).

Other callers in the Crown org keep the per-org list. GET /v1/orgs/{crownOrgId}/businesses is not part of this mode (issue #14 later added status / q filters and approximate counts to it, see Invitations).

Open and edit from the Crown path (issue #14, 2026-11-13, not deployed): the same caller can open, edit, close and create any of these customers on /v1/orgs/{crownOrgId}/customers…. Personal rows are read-only. See Customers → Crown org: any customer.

Partners (issue #14 CP-5, 2026-11-13, not deployed): partner orgs are created and edited only from the Crown PLATFORM org; a Business may only change a partner's status. See Partners.

Realtime ticket carries firmware (§1)​

Each ticket grant's lv now includes firmware (capped on share and customer grants like the other keys), so the TCP gateway can hide firmware versions below VIEW and require EDIT for firmware writes. See Realtime.

Work orders on dev (§7)​

ADR 0019 assignment was confirmed on dev on 2026-11-05. Whether the later lifecycle v2 changes are deployed was not checked on 2026-11-12 (no AWS credentials in the agent's shell); run npm run diff to see.