Skip to main content

Hierarchical organizations & chains of command

Two questions come up once a single deployment serves a structured customer:

  1. A chain of command across many bodies. A government runs one app across a Central Executive, Ministries, Counties, Departments, and Agencies — each with its own administration, but controlled up the chain.
  2. A parent that operates on its subsidiaries. A holding company's administrators need to perform operations on subsidiary organizations — when, and only when, that authority is explicitly granted.

This guide explains what the model expresses today, the one distinction that decides how to map each case (data authority vs policy authority), the concrete recipe for each scenario, and — stated plainly and separately — what is not supported today and the direction we recommend for it.

The model is flat and isolated — on purpose​

An organization is a flat tenant: a slug, a label, an is_active flag, and an ordering hint. There is no parent field, no tree, no closure table. Every org compiles into its own snapshot, and the resolver is only ever handed that one snapshot — it never sees another org's roles, features, or matrix. Isolation isn't a rule bolted on; it falls out of snapshot-per-org.

That is exactly what you want for independent SaaS tenants, and exactly the property a chain of command needs to cross. So neither scenario is a role you configure — both are about relating separate policy worlds. The good news: the two scenarios need different, and much simpler, answers than "add a tree to the org model."

There is no cross-org reference anywhere

An override, alias, group reference, or assignment can never bridge two orgs — this is enforced structurally (every store and validator is bound to one org) and is a normative isolation guarantee. A hierarchy is therefore modeled between orgs (this guide), never as a hidden edge inside the matrix.

The distinction that decides everything​

Before choosing a topology, separate the two kinds of authority a "superior" might hold over a "subordinate." They behave completely differently in archenstack-rbac.

Data authorityPolicy authority
Question"Which records/objects may this person act on?""Who may edit roles, features, the matrix, assignments?"
MechanismA cell resolves PARTIAL; a scope narrows which objectsThe management API, restricted by rbac.manage at FULL
Can it follow a chain of command?Yes, today — with a custom subtree scope atomNo — matrix administration is an unscopable org-wide binary

The second row is the load-bearing one. FULL bypasses scopes entirely, and the spec requires FULL to administer the matrix — PARTIAL is never sufficient. So there is no way, inside one org, to say "a Ministry admin manages the Ministry's own matrix but not the Centre's." Whoever holds rbac.manage FULL in an org administers all of that org's policy.

Do not collapse many bodies into one org to fake a chain of command

The tempting shortcut — put the whole government in one org and express the hierarchy with roles — fails hard, and it fails silently:

  • Because matrix administration is an unscopable binary, any body's admin holding rbac.manage FULL could rewrite the Central Executive's matrix and self-elevate. That isn't a gap in the approach; it is the approach.
  • Per-org anti-lockout is satisfied by one management-FULL holder anywhere in the org, so "one admin per body" degrades to one admin for the entire government.

Model each body that has its own administration as its own org. Use scopes for the data chain-of-command inside a body — never to fake the policy one.

Data authority: a subtree scope atom (works today)​

Where the chain of command is about records — "a County officer may edit records anywhere beneath their County" — you express it inside an org with the shipped, opt-in own_subtree atom. Your app owns the unit tree; Archenstack asks it one question.

# settings.py
ARCHENSTACK_RBAC = {
"SCOPE_INCLUDE_SUBTREE": True, # turn the atom on
"SCOPE_SUBTREE_FIELD": "org_unit", # the unit FK on the OBJECT
"SCOPE_SUBTREE_RESOLVER": "myapp.rbac.resolve_subtree", # YOUR traversal
}

# myapp/rbac.py
def resolve_subtree(subject):
"""The unit pks at or beneath the caller's own unit. Empty ⇒ deny."""
unit = getattr(subject, "org_unit", None)
return unit.descendant_ids(include_self=True) if unit is not None else []

Assign own_subtree to a feature in the matrix editor and a PARTIAL holder writes only records within their subtree — down the chain, never up it and never sideways to a peer unit. The queryset half narrows a bulk write; the predicate half answers a single-object /check/. Both read that one resolver, so they can never disagree.

Three hard limits come with scopes — they bound what "data authority down a chain" can mean:

  • Scopes narrow writes only. Reads are never scoped. Filtering what a subordinate may see is your queryset's job, not the matrix's.
  • FULL bypasses the scope. A subtree atom constrains a PARTIAL holder; it does nothing to a FULL one.
  • The /check/ object is caller-asserted. The object you POST to /check/ carries its claimed position in the tree. A subtree atom is an advisory UI hint unless the server re-fetches the object by id and reads its real unit — only the subject side of the check is trustworthy.

Government chain of command → one org per body​

Model each body that administers its own policy as its own org: the Central Executive, each Ministry, each County, each Agency. Each gets its own matrix, its own roles, its own admin of record, its own anti-lockout guarantee — full isolation, which is correct: a Ministry rewriting its matrix must never touch a County's. Provision each body as a tenant, with its own first admin.

The two levels do different jobs: orgs are peers that isolate policy, and the unit tree — which your app owns, not Archenstack — carries the records chain of command inside one body.

Inside a body, use the subtree atom for the internal, record-level chain of command (a County's district offices, an Agency's field teams).

What this does not give you yet is a superior body's admin editing a subordinate body's policy — see below.

Parent company with subsidiaries → separate orgs + a bounded platform grant​

Model the parent and each subsidiary as separate orgs, each running its own matrix independently. The parent's ask — "operate on subsidiary organizations" — is lifecycle authority (provision, rename, activate/deactivate), which is the platform control-plane tier. Bound that grant to the parent's own subsidiaries so it is not authority over every tenant in the deployment:

# The platform resolver may return True (unbounded), a list of org slugs
# (bounded), or a falsy value (no authority).
def resolve_platform(request):
claims = getattr(request.user, "claims", {})
return claims.get("platform_orgs") or False # e.g. ["acme-sub-1", "acme-sub-2"]
ARCHENSTACK_RBAC = {"SCOPE_PLATFORM_RESOLVER": "myapp.rbac.resolve_platform"}

The parent's admins can now provision, rename, and deactivate exactly acme-sub-1 and acme-sub-2 — and are refused, 403, on any other tenant. A bounded grant may also provision a slug it names that doesn't exist yet, which is how a parent self-serves a new subsidiary within its allocation, without gaining open-ended namespace creation.

The bound travels the whole chain, not just the last hop. Your identity provider asserts which organizations a subject administers — a fact separate from membership, because belonging to an org confers no authority over it — and both the orchestrator and Archenstack enforce it:

The middle hop matters: the orchestrator acts with its own broad machine credentials, so without that check a bounded caller could launder an out-of-bound request through it. A claim the token does not carry at all means unbounded (machine principals and IdPs that don't emit it keep their full reach); a claim that is present but empty means administers nothing.

The bound only ever narrows

Asserting a bound never grants authority — a caller who is not a platform principal has none regardless. Assert no bound and the grant stays unbounded (every org), exactly as before. The ARCHENSTACK_RBAC_PLATFORM_SUBJECTS env platform-subject is always unbounded, since the very first platform admin must be able to create the first org. An empty bound is no authority, not "all" — a misconfigured grant can only remove access.

If the parent must also edit a subsidiary's matrix, that is policy authority, not lifecycle — see the delegation direction below.

One capability the scenarios above reach for does not exist yet.

Cross-org delegated policy admin (the government's "up the chain")​

Today: a superior body's admin cannot edit a subordinate body's roles/features/matrix. Bounded platform authority covers a subordinate org's lifecycle, not its policy — the two are deliberately different tiers, and the platform tier confers no in-matrix authority by design.

Direction — a delegated acting-as edge. A superior's admin selects a subordinate org context; a stored delegation grant is checked before that org's snapshot loads (acting-as, never merging two snapshots — so decide(), the canonical snapshot body, and every cache key stay untouched and the change is additive). Two limits are inherent and worth stating up front: a delegated admin does not appear in the subordinate's assignment table, so every body still needs a local admin of record to satisfy that org's anti-lockout check; and grants are role-granular at best, because FULL is never scoped.

Build it only against a concrete requirement for a superior to edit a subordinate's matrix. For most chains of command, one org per body — each administering itself — plus own_subtree for records is the right model, and needs none of this.

Why this lives between orgs, not in a tree on the org model

Delegation is an edge between existing isolated orgs, checked at the request boundary — not a parent_org field that would thread hierarchy through the resolver and the hashed snapshot. That keeps the isolation guarantees (and the wire) intact while adding authority above the org, which is exactly where cross-org authority already lives. Bounded platform grants follow the same rule: the bound is adapter/identity state, never a payload field.

See also​