Backfill, enter-as flow, mutation guards, config API

FeatureSecurityService
Shipped
April 23, 2026 at 9:09 PM UTC
Author
Kamo
Commit
ec392b6

Self-heal provisioning: SystemUserBackfillService runs on every SecurityService boot (from DataLoader) to add the is_system_user column and system_user_access table if missing, ensure the singleton System User record exists, and create an Administrator-role TeamMember in every non-top-level org it doesn't already belong to. Also runs at createOrganization time so new orgs get a System User membership immediately rather than waiting for the next restart. Cross-org enter flow: replaces the old /api/generate-otk hand-off (which leaked the caller's source-org session to the destination domain) with /api/security/enter-as. The new endpoint builds a fresh *** scoped to the target org's actual member, so memberID/orgID/rights always match the org being entered. Adds a SUDO_MEMBER_ID field to session JSON so that System User impersonation carries the human operator's memberId for audit attribution. Guards: SystemUserGuard refuses any API-driven mutation to the System User record or any of its memberships (wired into MemberController, MemberSecurityController, **************** Hides the System User from the GetMembersAndSubscribers, getTeamMembersAndContractors, and getMembersByDepartment endpoints so tenants never see it in lists. Config surface: SystemUserConfigController exposes CRUD over the grant table for top-level-org owners only, and SystemUserCapabilityController returns a boolean the /network page uses to decide whether to render the ENTER AS SYSTEM MEMBER button.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing