Organizations (multi-tenancy)
One Archenstack deployment can serve many organizations (tenants) at once, with full isolation between them. Each org owns its own groups, roles, features, overrides, matrix version, and audit log — there's no shared, mutable policy state between two orgs, and neither can see or edit the other's.
This page explains the tenancy model. To wire it up in a specific backend — the resolver settings, the dev header, the org picker — see Wiring multi-tenancy. For the normative rules, see the specification's Organizations section.
If you never emit an org claim and run a single-tenant deployment, nothing about the model below changes for you — your app simply lives in one org (by default the reserved root org). Multi-tenancy is additive: the wire is byte-identical whether or not a deployment serves many orgs.
One deployment, many tenants
An organization is a first-class entity identified by a slug (^[a-z][a-z0-9_-]*$, the same grammar as roles and groups). It carries a display label, an is_active flag, and an ordering hint. That's the whole tenant anchor — everything else in the model just gains an org dimension.
Every policy-bearing thing becomes one per org:
| Concept | Single-tenant | Multi-tenant |
|---|---|---|
| Groups, roles, features | one set | one set per org |
| Overrides (the editable layer) | one layer | one layer per org |
| The matrix version stamp | one counter | one counter per org |
| The compiled snapshot | one snapshot | one snapshot per org |
| The audit log | one append-only log | one append-only log per org |
| Superusers & aliases | global | strictly per org |
Two orgs may each define a manager role and a reports.export feature. They never collide and never resolve against each other — an override, alias, or group reference can never bridge two orgs.
Snapshot-per-org: the one idea that makes isolation fall out
Here's the design in a sentence: an org selects which snapshot a caller loads and resolves — it is never an input to the resolver itself.
A MatrixSnapshot already is exactly one self-contained policy world. So isolation isn't a new rule bolted onto resolution; it's a consequence of handing the resolver the right snapshot:
The resolution algorithm — precedence, aliases, superusers, scopes, the authorizer — is byte-for-byte unchanged. decide(feature, role) still takes bare role and feature strings and evaluates them against the one org snapshot it was handed. Org never enters the canonical, hashed snapshot body; it travels out-of-band as transport metadata. That's why multi-tenancy landed additively, with wire_version still 1.
Because each org's rows compile into their own snapshot, the resolver never even sees a foreign org's entity. Cross-tenant leakage isn't something the resolution kernel has to prevent — there's no shared state for it to leak. The only place isolation must be actively defended is the caches: every snapshot/decision cache key embeds the org, so org A's cached matrix (or a cached allowed = true) can never be served to org B.
Per-org uniqueness
Slugs and keys are unique per org, not globally:
- roles and groups are unique on
(org, slug); - features are unique on
(org, key); - an override is unique on
(org, feature, role).
The slug/feature-key grammar is unchanged — org is a first-class dimension, never encoded as a slug prefix or a dotted-namespace hack. Two orgs owning the same manager slug is normal and correct.
One practical consequence in the admin UI: a "this slug already exists" 409 is now per org. Creating manager in org B succeeds even though org A already has one. See per-org uniqueness in the spec.
Per-org anti-lockout
The anti-lockout invariant — at least one active, standard role must resolve rbac.manage at FULL — is enforced per organization. Because each org has its own snapshot, the authorizer’s check runs against exactly that org's matrix on every mutation. No org's edit can ever affect another org's management-FULL holders.
The management feature (rbac.manage) and its minimum level (FULL) stay the spec-pinned global constants — they're not per-org configurable. What's per-org is the invariant: every org must independently keep a rbac.manage-FULL standard holder, and every newly-provisioned org needs a lockout-safe baseline (a management-FULL standard role plus an active superuser). "≥1 active super per deployment" becomes ≥1 active super per org.
The reserved root org
root is a reserved org slug with exactly two jobs:
- Migration backfill. When an existing single-tenant deployment gains tenancy, all its existing rows are backfilled into
root, so nothing moves and the old policy keeps working. - Dev / seed default. Local development and the seed command target
rootso a single-org app boots without emitting any org claim.
root is supplied by the ARCHENSTACK_RBAC_DEFAULT_ORG environment variable (there is no inline code default — an unset value fails loudly). It is never a runtime fallback: at request time, a caller's org comes only from their claim, never silently from root.
Missing or unknown org fails closed
Tenancy is fail-closed, matching Archenstack's existing caller-must-have-a-role posture:
- Missing org — the resolver yields no org (an unauthenticated or claim-less caller). Treated like a role-less caller: deny (
NONE)./me/and/check/return the standard role-less surface. The runtime never substitutesroot. - Unknown org — the claim names an org that doesn't exist (or a reference tries to bridge two orgs). The request is rejected with the
unknown_orgerror and denied — never by compiling an empty matrix, never by falling back to another tenant.
So a misconfigured claim can only ever remove access, never grant it or cross a tenant boundary.
Where identity comes from: the OIDC claim contract
Archenstack stays entirely out of authentication. It never validates a token, runs a login, or talks to an identity provider — it only reads the already-authenticated principal off the request and maps claims to (org, subject). Validating the JWT is the host's job:
The host's resource server verifies the token signature against the issuer's JWKS, and checks
iss(config-pinned),aud, andexp/iat/nbf. Only then does Archenstack read the principal.
Against that authenticated principal, Archenstack reads two claims:
| Claim | Role in Archenstack |
|---|---|
sub | The identity. A stable, opaque, issuer-unique subject id. Archenstack keys its per-(org, sub) role assignment on it. |
org (plus optional orgs[]) | The active tenant. Which org's snapshot this request selects. orgs[] lists membership for a multi-org user; org is the active one for this request. |
The org/orgs[] claims live behind a dedicated organization scope, so they're only emitted when requested — additive on the identity provider's side, and invisible to clients that never ask for them.
- Identity is
sub, neveremail. Email is mutable and belongs to a person, not a stable principal — treat it as a display attribute only. Role assignments key onsub. - Roles are internal to archenstack-rbac. The identity provider supplies
subandorg/orgs[]and nothing about app roles. Archenstack owns role definitions, the matrix, and the(org, sub) → roleassignment. The provider never learns your application's roles — which keeps the two systems decoupled and lets one identity provider back many apps.
This is described purely as the standards contract — an org/orgs[] claim behind an organization scope, a stable opaque sub, JWKS-validated tokens. Any standards-compliant OIDC provider that can emit a custom claim behind a scope satisfies it; Archenstack names no specific product.
To turn the claim into a selected snapshot, each backend exposes an org resolver (the org-level counterpart of the identity resolver). That wiring — Django's SCOPE_ORG_RESOLVER, Java's RbacPrincipalResolver.resolveOrg, the web client's withOrg — is the subject of the next page.
See also
- Wiring multi-tenancy — the per-backend resolver recipe, the dev header, and the org picker.
- Hierarchical organizations — modeling a chain of command or parent/subsidiary across these flat, isolated tenants.
- The model — roles, features, levels, the matrix an org owns.
- Resolution, scopes & the authorizer — how a cell resolves and how anti-lockout works.
- Security — the fail-closed posture tenancy extends.
- Specification — the normative Organizations, per-org uniqueness, and
unknown_orgrules.