Skip to main content

RBAC v2 — Business lifecycle, one org per user, remote control, user block

Status (2026-11-13): deployed to dev on 2026-11-13 (cse-http-be commits a0457d1 … 102503b, backfills applied; TCP side deployed the same day). Decision record: docs/adr/0026-rbac-v2-business-lifecycle-one-org.md; spec: specs/011-rbac-v2/spec.md; TCP contract: docs/handoff/tcp-rbac-v2-2026-11-13.md (all in cse-http-be). It changes parts of Roles & permissions and Role boundaries; where they disagree, this page wins.

Nothing on this page has been run against a deployment. Every request and response below is an illustrative example derived from packages/core/src/schemas.ts and the handlers, not a captured execution.

In plain words​

  • Super Admin creates Admins; nobody else can. Admins now manage firmware too.
  • A Business can be created by anyone at signup and works straight away. Crown staff can suspend, restore, close and reopen it; the Business itself never can (2026-11-19). While a Business is suspended, its staff (Business members and Installers) are locked out of HTTP and TCP, but its End Users keep working — they are the customers. Closing it returns every member to their own account: staff get their personal org back and customers become independent End Users with the plants they brought (2026-11-19).
  • Installers see and edit every plant of their Business, always have remote control, never archive or delete, and can join a Business with its join code.
  • A connected End User (a customer inside a Business) has no remote control until a Business member switches it on. Their personal plants move into the Business when they join (one org per user) and move back if the Business detaches them.
  • Crown staff can block a user: account only, or account plus their plants (inverters shut down by TCP).

Roles at a glance​

RoleWhereCreated byKey levels / rules
Super AdminCrown (PLATFORM) orgbootstrap-org.ts / set-member-role.ts, or another Super Admineverything; only role that grants any role in the Crown org and acts on Admins
AdministratorCrown orgSuper Admin onlyfirmware: FULL (new; capped at VIEW in any non-Crown org), opens any org through platform access
Businessa Business (non-personal OPERATOR org)self-serve onboarding, Crown staff (POST …/businesses, owner must be an existing eligible account since 2026-11-30), or Crown staff promote a member (not by invitation since 2026-11-30)several members may hold it; the last ACTIVE one cannot be removed/suspended/demoted by Business members
Installera Businessthe Business's join request (accepted by a Business member) or an invitationplants: EDIT (no archive/delete), commands/registersWrite: EDIT, scope ALL plants of the Business (kept, RBAC-S9 2026-11-23); new roles start at reports: EDIT (RBAC-S5); sharing: MANAGE for every Installer role and copy (owner 2026-11-26, reversing RBAC-S6); may change the plants of End User members (not other members)
End User (independent)own personal orgsign-up (the personal org is created at sign-up since 2026-11-19)unchanged: full control, deletes own plants
End User (connected)one Businessan Installer's or Crown staff's invitationplants: VIEW, devices: VIEW, alerts: EDIT, sharing: VIEW (RBAC-S10/S11/S12/S6, 2026-11-23; was plants: EDIT); remote control (commands, registersWrite) only when switched on

Business lifecycle​

ActionRouteWhoEffect
SuspendPOST /v1/orgs/{crownOrgId}/businesses/{businessOrgId}:suspendSuper Admin, AdministratorACTIVE → SUSPENDED
Restore…:restoreSuper Admin, AdministratorSUSPENDED → ACTIVE
Close…:close, or POST /v1/orgs/{businessOrgId}:closeSuper Admin, Administrator (never the Business itself, since 2026-11-19)ACTIVE/SUSPENDED → CLOSED, then every member returns home (below)
Reopen…:reopen—Retired 2026-11-27 (ADR 0036): 410 GONE REOPEN_RETIRED

ADR 0036 (2026-11-27, not deployed): :suspend also suspends the Business's Installers and :restore activates only those; :close is refused with 409 OWNS_UNSHARED_PLANTS while the Business holds plants no End User has. See Account suspension and removal.

All three need If-Match = the Business org's version — the orgVersion of its row in GET /v1/orgs/{crownOrgId}/businesses (that row's version is the Business limit's version, for the limit route). They take an optional { "reason": "…" }. Any other transition is 409 INVALID_STATE details.reason: INVALID_TRANSITION. A Business member calling any of them (its creator included) gets 403 FORBIDDEN details.reason: PLATFORM_ONLY. Until 2026-11-19 the creator could close their own Business (NOT_BUSINESS_CREATOR for anyone else); that exception is gone. Rows still carry creatorSub, as a record only.

Closing returns every member home (owner, 2026-11-19)​

After the status change, :close runs the same steps as :remove for every non-removed member of the Business (ACTIVE or SUSPENDED, End Users included):

  • the membership becomes REMOVED (access cut, access.revoked.v1 to TCP);
  • the plants the member brought in (homeOrgId) move back to their personal org;
  • plants transferred to an End User (or handed over before 2026-11-19) move to that End User's personal org too (ADR 0036, 2026-11-27; before: they stayed in the Business with the customer link removed); plants a staff member owns stay too and go to the Business owner when one is left (otherwise the owner is kept);
  • the member's personal org is reopened, or created when they never had one, unless they still belong to another live Business.

Installers and Business members get their personal account back; customers become independent End Users. No account, customer, plant or device is deleted.

The work is bounded per request (about 6 s; API functions time out at 10 s). The 200 body adds two counts:

type BusinessLifecycleResult = {
businessOrgId: string;
status: "ACTIVE" | "SUSPENDED" | "CLOSED";
version: number;
revokedMembers: number; // members whose realtime sessions TCP was asked to drop
membersReturned?: number; // :close only — members this call returned to their own account
membersRemaining?: number; // :close only — members still in the closed Business
};

While membersRemaining > 0, call :close again with the same If-Match (the CLOSED version the first call returned). On a CLOSED Business, :close resumes the work and answers 200 with the same version instead of 409 INVALID_TRANSITION. A member that fails (for example a plant move still running) is counted in membersRemaining and retried by the next call. Businesses closed before 2026-11-19 still hold their members; Crown staff migrate one by running :close on it.

Response 200 after one call on a Business with four members (illustrative example derived from BusinessLifecycleResult in packages/core/src/schemas.ts; not a captured response — not deployed to dev yet):

{ "businessOrgId": "01J…", "status": "CLOSED", "version": 5, "revokedMembers": 3, "membersReturned": 4, "membersRemaining": 0 }

Reopen is retired (ADR 0036, 2026-11-27): 410 GONE REOPEN_RETIRED. A closed Business stays closed.

Every status change also republishes the alert audiences of the members it affects (everyone but End Users), so alerts stop or resume at once.

While SUSPENDED (and, for members not yet returned home, CLOSED):

  • Business members and Installers get 403 FORBIDDEN with details.reason: BUSINESS_SUSPENDED or BUSINESS_CLOSED on any request that selects the Business, and no realtime tickets. HTTP sends TCP one access.revoked.v1 (scope USER) per affected member so their open sessions drop at once.
  • End Users of a SUSPENDED Business keep full access to their plants (HTTP and TCP). After a close they are no longer members: their own plants are back in their personal org.
  • Members cannot be suspended or restored (409 BUSINESS_NOT_ACTIVE); join requests are refused.
  • Crown staff can still open the Business through platform access to manage it.

Previously a CLOSED org still granted access; that bug is fixed for every org kind.

Creator. Org META gains creatorSub: the user who created the Business at onboarding, or the first Business-role member who accepted the invitation of a Business Crown staff created. Existing Businesses get their first Business member (npm run backfill:rbac-v2).

Onboarding without an invitation​

Create your own Business​

POST /v1/me/onboarding (any signed-in user):

{ "kind": "BUSINESS", "name": "Sunrise Solar", "countryCode": "PK", "timezone": "Asia/Karachi" }

201 (illustrative):

{ "kind": "BUSINESS", "org": { "orgId": "01J…", "code": "ORG-42", "kind": "OPERATOR", "status": "ACTIVE", "name": "Sunrise Solar", "…": "…" }, "joinCode": "K7QM2XRB9D" }

One Business at a time: 409 CONFLICT details.reason: ALREADY_IN_BUSINESS when the caller belongs to a Business that is not CLOSED (a suspended membership counts), or the Business they created earlier is not CLOSED. There is no self-service way out: only being removed by that Business, or its closing, frees the person. The messages for every path are listed in one Business per person (2026-11-26). Once it is CLOSED they may create a new one (owner decision, 2026-11-14); a per-account guard (USER#<sub>/OWNBUSINESS, swapped only while it still names the closed one) keeps two simultaneous calls from creating two. A membership in a CLOSED Business also no longer blocks accepting an invitation or join request into another Business. End Users need no call.

Join codes and join requests (Installers)​

RouteWhoNotes
GET /v1/orgs/{orgId}/join-codeBusiness member, team ≥ MANAGE{ orgId, joinCode, version } (joinCode is null before the first)
POST /v1/orgs/{orgId}/join-codesamenew code; the old one stops working
POST /v1/me/join-requestsany signed-in user{ joinCode, message? } → PENDING
GET /v1/me/join-requeststhe requesternewest first; limit (default 15, 10 with a cursor) + cursor → nextCursor
POST /v1/me/join-requests/{id}:cancelthe requesterPENDING → CANCELLED
GET /v1/orgs/{orgId}/join-requests?status=Business member, team ≥ MANAGEdefault PENDING, limit ≤ 50 + cursor
POST /v1/orgs/{orgId}/join-requests/{id}:accept / :rejectsameaccept seats the requester on the Installer role, scope ALL

Join codes are 10 characters from A–Z and 2–9 without 0/O/1/I (never the guessable ORG-<n> code); typed codes are upper-cased and spaces/dashes ignored. Errors: 404 JOIN_CODE_UNKNOWN, 409 BUSINESS_NOT_ACTIVE, 409 ALREADY_IN_BUSINESS, 409 JOIN_REQUEST_PENDING (already asked this Business), 409 JOIN_REQUEST_LIMIT (5 pending), 409 NOT_PENDING, 409 ALREADY_MEMBER.

The 50-invitations-per-day limit is removed. Invitations are not emailed (in-app only, ADR 0027), so SES limits do not apply.

Members​

ChangeRuleError
Grant any role in the Crown orgSuper Admin only403 SUPER_ADMIN_ONLY
Change, suspend, remove, block an Administrator/Super AdminSuper Admin only403 SUPER_ADMIN_ONLY
Promote to Business in a BusinessSuper Admin or Administrator403 ROLE_NOT_ASSIGNABLE
Remove/suspend/demote the last ACTIVE Business memberrefused for Business members (Crown staff may)409 LAST_BUSINESS_MEMBER
Restore a member Crown staff suspendedCrown staff only403 SUSPENDED_BY_PLATFORM
Suspend/restore staff of a non-ACTIVE Businessrefused409 BUSINESS_NOT_ACTIVE
Remote-control switchPATCH /v1/orgs/{orgId}/members/{sub} { "remoteControl": true } (or false), End User members of a Business only422 END_USER_ONLY
Detach a connected End UserPOST /v1/orgs/{orgId}/members/{sub}:detach (team ≥ MANAGE or Crown staff)409 END_USER_ONLY
Remove anyone from a BusinessPOST /v1/orgs/{orgId}/members/{sub}:remove — the user returns to their personal account (plants back, personal org reopened), owner 2026-11-17409 MOVE_IN_PROGRESS

GET …/members and GET …/members/{sub} show remoteControl (End User members of a Business only) and suspendedByPlatform. Turning the switch off queues access.revoked.v1 REMOTE_CONTROL_OFF; HTTP reads the switch live on every request, and the realtime ticket carries commands/registersWrite: NONE while it is off. Existing connected End Users are switched on by the backfill (owner decision).

One org per user — plant moves​

A user has one account. Joining or leaving a Business never creates or deletes an account; it changes the user's membership and where their plants live (owner decision, 2026-11-17).

  • When a user joins a Business — by accepting an invitation (any role), by an accepted join request (Installer), or by creating their own Business — every plant of their personal org moves into the Business (same plantId); each plant records customerSub (the user); the plants are added to their scope when it is a plant list; the personal org is set CLOSED and is no longer listed by GET /v1/me. Until 2026-11-17 Business members and Installers kept their personal plants (and a personal org with plants stayed visible); they now move in like End Users.
  • Leaving — :detach (End Users) or :remove (any member of a Business) — reverses it: the plants they brought in move back and the personal org is reopened as their default org, also when no plant moves back. It stays closed only while the user still belongs to another live Business. A user who never had a personal org gets one created at that point (2026-11-19), so nobody leaves a Business with no organisation. Closing a Business does the same for every member (above).
  • Every account has exactly one personal org (2026-11-19). Cognito PostConfirmation creates it at sign-up. GET /v1/me creates it, or reopens a CLOSED one, for an account that holds no ACTIVE membership — never for anyone with one (D5.4) — and reports it as personalOrg: { orgId, status } | null, also while it is CLOSED (Account API).
  • Shares a Business member or Installer made on their personal plants get the End User cap below while the plants are in the Business, with remote control following their staff role.
  • Detach reverses it: the membership is removed, every plant the End User brought in (homeOrgId) moves back, the personal org reopens, the plant's Installer link is cut, shares the Business granted stop granting, and the Business's open work orders on those plants are cancelled by the system (reason: WITHDRAWN, note END_USER_DETACHED; finished orders stay as the Business's history). Since ADR 0036 (2026-11-27) a plant transferred to this customer (or handed over before 2026-11-19, or given them by the customer backfill) moves to their personal org too; they stay its owner (until then it stayed in the Business).
  • Legacy plants (created by the app before schema v2, no org) that the End User owns are upgraded into their personal org first (creating it if needed), so they move into the Business with the rest.
  • Shares the End User made before joining keep working (owner decision, 2026-11-14). A moved plant records homeOrgId (the personal org), so those shares are still found; they are capped at the End User's own level in the Business — plants at most EDIT, no commands or register writes while the remote-control switch is off, nothing while the End User is suspended — through ORG#<personalOrg>/CONNECTED_LIMIT, applied on every HTTP path, realtime ticket and alert audience. After a detach they grant their own level again. The End User, or a Business member, sees and revokes them with the routes below.
  • Alert audiences of the End User and of everyone their shares go to are republished after every move.
  • Moves run per plant (META conditioned on its current operator and version) under a per-user lock USER#<sub>/MOVING; a move that stops half-way is finished by the next GET /v1/me (a resumed move-in stops if the user is no longer an ACTIVE member). A detach first finishes any pending move-in (409 MOVE_IN_PROGRESS if it cannot). The personal org is closed only once it is really empty.
  • A connected End User's old mobile OWNER row no longer grants FULL while they belong to the plant's Business.
  • Mobile plant create for a user whose personal org is closed: 409 PERSONAL_ORG_CLOSED (the Business adds the plant for them).

Plant delete: no customer → Business members with plants ≥ MANAGE, Administrator, Super Admin; with a customer (customerSub, or a customer org other than the operator) → Crown staff only (403 PLANT_HAS_CUSTOMER for the Business). Independent owners delete their own plants as before. Installers and connected End Users never archive or delete.

Plant for an end user, created by Crown staff (2026-11-17)​

POST /v1/orgs/{crownOrgId}/end-user-plants — Super Admin or Administrator (plants ≥ MANAGE in the Crown org; anyone else 403 PLATFORM_STAFF_ONLY), Idempotency-Key required. Body { "endUserEmail", "plant": <the app's create body> }. The account is found by email in Cognito (ListUsers, exact match); no account is 404 — the user signs up in the app first.

The user…The plant goes toplacement
belongs to a Business (non-REMOVED membership in a non-CLOSED Business)that Business, with the user as its customer (customerSub, homeOrgId = their personal org)BUSINESS
belongs to no Businesstheir personal org, created if they have none — the independent-user defaultPERSONAL

customerOrgId is always the user's personal org, so plant.upserted.v1 carries the placement org as operatorOrgId and the user as ownerUserSub; TCP uses both when devices are transferred into the plant (console "Transfer ownership to a Plant"). Refused: 409 ACCOUNT_BLOCKED (blocked user), 409 MEMBER_NOT_ACTIVE (suspended in their Business), 409 MOVE_IN_PROGRESS. Writes END_USER_PLANT_CREATED to the Crown access log. Response 201:

{ "plantId": "01J…", "code": "PL-…", "name": "Roof", "endUserSub": "…", "placement": "BUSINESS",
"operatorOrgId": "01J…", "customerOrgId": "01J…", "version": 2 }

(Illustrative example derived from EndUserPlantView in packages/core/src/schemas.ts; not a captured response — the route has not been run against dev yet.)

Plant transfer (2026-11-19, replaces the 2026-11-16 handover)​

POST /v1/orgs/{orgId}/plant-transfers { plantId, email } transfers a plant to an already registered account (404 USER_NOT_REGISTERED otherwise; no invitation is ever created).

  • Business role or Installer (in their Business, plants ≥ EDIT): the plant stays in the Business. The receiver is (or is added directly as) an End User of the Business with the plant in scope, and becomes its customerSub and ownerUserSub. A receiver in another Business is refused up front (USER_IN_ANOTHER_ORG).
  • Super Admin / Administrator: the plant moves to the receiver's org — their Business when they are in one (End User, Business role or Installer); when they are in no Business, the Business the staff member picked (businessOrgId, 2026-11-20 — the receiver joins it as an End User), else their personal org (they stay independent) — and the receiver becomes its owner (ownerUserSub, stored on the plant and sent on every later plant.upserted.v1).

Ownership and unshare (2026-11-20, ADR 0029; unshare removed 2026-11-27, ADR 0035 — the route below no longer exists). The creator owns every new plant. POST /v1/orgs/{orgId}/plant-unshares { plantId } takes the End User off one plant: only the Business owner, an Installer, a Super Admin or an Administrator may do it (an End User gets 403 END_USER_CANNOT_UNSHARE), the caller becomes the owner, and the plant stays in its org. See Plants → ownership, share and unshare.

See Plants → transfer a plant.

Carried-in shares​

RouteWhoNotes
GET /v1/orgs/{businessOrgId}/members/{sub}/sharesthe End User themself, or sharing ≥ VIEW in the BusinessSame query (granteeKind, status, level, limit, cursor) and response as GET /v1/orgs/{orgId}/shares.
DELETE /v1/orgs/{businessOrgId}/members/{sub}/shares/{shareId}—Removed 2026-11-27 (ADR 0035). A carried-in share can no longer be revoked.

Both answer 404 when {sub} is not an End User of this Business or carried no shares in.

Block a user​

Retired 2026-11-27 (ADR 0036, not deployed): :block answers 410 GONE BLOCK_RETIRED. Suspend End Users with members/{sub}:suspend instead. :unblock and GET …/block remain to release accounts blocked before. The rest of this section describes the former behaviour. See Account suspension and removal.

POST /v1/orgs/{crownOrgId}/users/{sub}:block (Crown staff, team ≥ MANAGE):

{ "mode": "ACCOUNT_AND_PLANTS", "reason": "Chargeback fraud", "confirm": "BLOCK" }
ModeEffect
ACCOUNT (A)every request → 403 ACCOUNT_BLOCKED; earlier tokens revoked; Cognito disables the account and signs it out everywhere; TCP drops every session (USER_BLOCKED). Their plants keep working for others.
ACCOUNT_AND_PLANTS (B)A, plus every plant they own or are the customer of is frozen (status: SUSPENDED): only Crown staff see it, view only except that Super Admin and Administrator can still delete it (403 PLANT_BLOCKED for anyone else); TCP shuts the inverters down (queued while offline; models without remote shutdown are frozen only) and stops recording telemetry. Needs confirm: "BLOCK".

Cognito is called first: if it fails, the call answers 503 DEPENDENCY_UNAVAILABLE and nothing is recorded, so a retry is clean. Repeating mode B on a user already blocked in mode B finishes any plant a failed earlier call left unfrozen. :unblock reverses it (TCP starts the inverters); it unfreezes the plants first and clears the account flag last, so a failed unblock can simply be retried. Blocked plants are enforced on every HTTP route (the legacy mobile routes included); on realtime, TCP enforces the freeze from plant.blocked.v1. GET /v1/orgs/{crownOrgId}/users/{sub}/block reads the state; since 2026-11-23 (RBAC-S2, built, not deployed) it also returns platformRole: true when the user holds a Crown role (Super Admin or Administrator, even if they are also a Business member or customer). The block guard uses the same test, so an Administrator caller should hide Block for such a user — the call would be 403 SUPER_ADMIN_ONLY. A frozen plant stays in plant lists, favorites and the map with blocked: true on its row (show a badge and disable opening it); realtime tickets leave it out — a ticket asked for specific plants never includes it, and every ticket names the frozen plants its grants would otherwise reach in the xp claim (at most 50), which TCP applies over every grant (Realtime) — except for Crown staff, who keep view-only access; a blocked account's alert audiences are emptied at once. Guards: 403 PLATFORM_ONLY, 403 SUPER_ADMIN_ONLY (blocking Crown staff), 403 SELF, 409 LAST_SUPER_ADMIN, 409 ALREADY_BLOCKED, 409 NOT_BLOCKED, 422 CONFIRMATION_REQUIRED. TCP reports each inverter's outcome as device.block-state.v1, stored at PLANT#<p>/BLOCKSTATE#<deviceId>.

Safety: TCP sends the real shutdown/start register writes only when its POWER_CONTROL_ENABLED setting is on (off everywhere today); until then the state stays SHUTDOWN_QUEUED.

New error codes and reasons​

New code ACCOUNT_BLOCKED (403). New details.reason values: SUPER_ADMIN_ONLY (wider), PLATFORM_ONLY, BUSINESS_SUSPENDED, BUSINESS_CLOSED, BUSINESS_NOT_ACTIVE, INVALID_TRANSITION, NOT_BUSINESS_CREATOR, ALREADY_IN_BUSINESS, LAST_BUSINESS_MEMBER, SUSPENDED_BY_PLATFORM, END_USER_ONLY, JOIN_CODE_UNKNOWN, JOIN_REQUEST_PENDING, JOIN_REQUEST_LIMIT, NOT_PENDING, ALREADY_MEMBER, MOVE_IN_PROGRESS, PERSONAL_ORG_CLOSED, PLANT_HAS_CUSTOMER, PLANT_BLOCKED, ALREADY_BLOCKED, NOT_BLOCKED, LAST_SUPER_ADMIN, CONFIRMATION_REQUIRED, SELF, MEMBER_IN_ANOTHER_BUSINESS, and (2026-11-17) PLATFORM_STAFF_ONLY, MEMBER_NOT_ACTIVE, ACCOUNT_BLOCKED (as a reason on 409), and (2026-11-19) NOT_A_MEMBER (403 FORBIDDEN when the selected org holds no usable membership of the caller — removed, detached or never a member). NOT_BUSINESS_CREATOR is retired (2026-11-19): a Business never closes itself, so the refusal is PLATFORM_ONLY.

Events to TCP​

access.revoked.v1 gains BUSINESS_SUSPENDED, BUSINESS_CLOSED, USER_BLOCKED (no orgId), END_USER_DETACHED, PLANT_MOVED, REMOTE_CONTROL_OFF. plant.upserted.v1 gains customerSub, status and blocked. New plant.blocked.v1 / plant.unblocked.v1 (seq = the plant's version). Inbound device.block-state.v1. Full contract: docs/handoff/tcp-rbac-v2-2026-11-13.md.

Data model​

ItemChange
ORG#<o>/METAcreatorSub; status now written by the lifecycle routes (statusChangedAt, statusChangedBy)
ORG#<o>/MEMBER#<sub>remoteControl?, suspendedBy { sub, platform }?
ORG#<o>/JOINCODE, JOINCODE#<code>/GUARDthe join code and its lookup
ORG#<o>/JOINREQ#<id> (GSI1 USER#<sub>, GSI3 ORG#<o>#JOINREQ#<status>), ORG#<o>/JOINREQPENDING#<sub>join requests
USER#<sub>/MOVINGplant-move lock / resumable job
USER#<sub>/PROFILEblocked { mode, reason, at, by }?
PLANT#<p>/METAcustomerSub?, homeOrgId? (while a moved plant is in a Business), blockedBy?; status: SUSPENDED now enforced
ORG#<personalOrg>/CONNECTED_LIMITthe cap on a connected End User's carried-in shares (permsLimit, businessOrgId, sub)
PLATFORM/FROZEN_PLANTSevery plant frozen by Block B (plantIds), read once per realtime ticket for xp
USER#<sub>/OWNBUSINESSthe user's current self-created Business (orgId, previousOrgIds?)
PLANT#<p>/BLOCKSTATE#<deviceId>TCP's per-inverter block outcome

No new GSI, no Scan, no new AWS service. The block routes' Lambda gains cognito-idp:AdminDisableUser, AdminEnableUser and AdminUserGlobalSignOut.

Deploying and backfilling (dev only)​

A human runs, in order (agents never run these):

npm run deploy:dev
npm run backfill:rbac-roles -- --stage dev --only installer --apply
npm run backfill:rbac-v2 -- --stage dev --apply
npm run backfill:rbac-v2 -- --stage dev --only customers
npm run republish:orgs -- --stage dev

The first backfill sets existing Installer roles to plants: EDIT; the second sets Business creators and turns remote control on for existing connected End Users (run each without --apply first to see the dry run); the customers mode gives each Business plant without a customer the one End User whose scope lists it (plants with none or several are only reported — add --apply after reviewing the dry run); the republish lets TCP learn personal: false for every org (needed by its remote-control rule). The TCP side (cse_tcp_be) must be deployed for sessions to drop and Block B to reach the inverters.

Known gaps​

  • A ticket names at most 50 frozen plants in xp; beyond that, and for a plant frozen after the ticket was issued (tickets live up to 10 minutes), TCP's plant.blocked.v1 handling still refuses every operation. Plants frozen before 2026-11-14 join the frozen list through backfill:rbac-v2 --only frozen (needs USER_POOL_ID).
  • Plants inside a Business that no End User — or more than one — has in scope get no customerSub from the backfill; the dry run lists them for a person to decide.