Repository navigation
Description
Summary
Add Enterprise User Management — multi-tenant Organizations/Teams plus advanced RBAC — as the second concrete enterprise module on the #847 entitlement seam (after the audit dashboard, #941). Entitlement id: user_management.
Today OSS ships a flat 4-tier role model (user < operator < creator < admin, ROLE-001) with admin-only per-user role CRUD and a single user namespace. Enterprise customers need org/team scoping, custom roles, and a permission matrix beyond the 4 built-ins (called out as a reserved-but-unbuilt seam in docs/planning/OSS_ENTERPRISE_SPLIT_RESEARCH.md and requirements §35).
Open-core split (private-first)
Per the enterprise architecture (docs/planning/ENTERPRISE_ARCHITECTURE.md, feature-flows/enterprise-modules.md) and the explicit directive to keep enterprise logic in the private repo, the split is:
- Private —
Abilityai/trinity-enterprisesubmodule (src/backend/enterprise/backend/user_management/): owns everything with IP — its own private tables (created idempotently onregister_enterprise, viafrom db.connection import get_db_connection), Pydantic models, db ops, service/business logic, and the FastAPI router gated byrequires_entitlement("user_management"). Registers the module viaentitlement_service.register_module("user_management"). - Public —
Abilityai/trinity→dev: only the unavoidable seam. The enterprise Vue view ships in the OSS bundle (documented: enterprise Vue carries no algorithmic IP; gated purely by the serverGET /api/settings/feature-flags→enterprise_featureslist) + nav/route + store getter. No public schema/model/router changes — the entitlement plumbing (requires_entitlement,list_entitled_features, feature-flag exposure) already exists from Spike: enterprise edition architecture — private module strategy for compliance features (SSO, SCIM, SIEM) #847.
Phases
Phase 1a — Organizations + membership (this issue's starting slice)
- Private tables:
enterprise_organizations,enterprise_org_members(created on registration). - CRUD orgs (create/list/get/update/delete) + add/remove/list members, admin +
requires_entitlement("user_management")gated. -
register_enterprise()mounts the router and callsregister_module("user_management"). - Public: gated Enterprise → User Management Vue view + nav/route, hidden unless
user_managemententitled. - Unit tests (private): entitlement gate (403 when not entitled), org CRUD, membership.
Phase 1b — Teams
-
enterprise_teams,enterprise_team_members; nested team membership within an org.
Phase 1c — Advanced RBAC
- Custom role definitions + permission matrix (
enterprise_custom_roles,enterprise_role_permissions); arequires_permission(...)resolution path layered over the OSS role hierarchy when entitled.
Later (separate issues, reserved seams)
- SSO (OIDC/SAML) —
ssoentitlement; SCIM 2.0 —scimentitlement. Org/team model here is the identity target they provision into.
Architectural invariants to respect
- Router → Service → DB layering, mirrored inside the private module.
- Entitlement gating via
requires_entitlement("user_management")on every enterprise endpoint;register_module(...)inregister_enterprise. - Frontend gates on the server feature-flag (
enterprise_features), never a client constant. TRINITY_OSS_ONLY=1must hide the whole surface (entitlement returns[]).- OSS-only build (submodule absent) must be unaffected — endpoints 404, UI hidden, no import errors.
Out of scope
- License-claim enforcement / seat-cap metering (Phase 1 of the license mechanism, Spike: enterprise edition architecture — private module strategy for compliance features (SSO, SCIM, SIEM) #847 — separate).
- SSO/SCIM (reserved entitlements, separate issues).
- Migrating existing OSS roles into orgs (backfill strategy is a later concern; orgs start empty).
Activity
feat(enterprise-ui): per-user activity audit in Settings → User Manag…
feat(user-mgmt): OSS deactivation primitive + enterprise lifecycle UI (…
fix(user-mgmt): stop Management column clipping in User Management ta…
fix(user-mgmt): fit User Management table in the card (no h-scroll) (#…
test: add suspended_at to schedule-soft-delete test users DDL (#995)
docs(architecture): document enterprise modules + two-track migrations (
fix(enterprise): enterprise registration failure must not crash core …
feat(user-mgmt): user lifecycle (invite + deactivate) + activity, in …
Merge origin/dev into feature/525-idempotency-keys
feat(auth): connector-scope MCP key primitive + connector MCP tools (…
feat(auth): portal_delegate key scope + single-route fence (ent#163) (#…
fix(ui): widen the Settings panel to fit its own tab strip (#1862) (#…
feat(workspace): the session slides instead of expiring at 12 hours (…
feat(workspace): the session slides instead of expiring at 12 hours (…
feat(workspace): the session slides instead of expiring at 12 hours (…
fix(auth): correct the ops-tier offboarding claim, add the Depends op…
docs+test(2323): retract the offboarding claim in the flow doc, close…
feat(auth): bound, attribute and fail-closed the machine credential f…
fix(auth): /ws/events applies the account-state check the other doors…
fix(auth): live connections follow the account — event sockets, event…
fix(workspace): a deactivated account is refused at the Workspace door (