Resolution, scopes & the authorizer
This page explains how a (role, feature) pair becomes an effective decision, how PARTIAL writes get scoped to specific objects, and the one invariant that keeps the matrix from locking itself out. For the data model it builds on, see The model.
Resolution precedence
Resolving (role, feature) follows a fixed, ordered algorithm. The first rule that applies wins:
- Superuser — if the role is a superuser, the decision is
FULL. Done. (No cells are consulted; a superuser has none.) - Alias — if the role is an alias, resolve using its target role instead, then continue with the steps below for that target.
- Override — if an override exists for the (resolved role, feature) cell, use it.
- Default — otherwise, if a code default exists for that cell, use it.
- Fallback — otherwise, use the fallback level (
NONE).
A client that holds a matrix snapshot resolves levels locally, with no server round-trip. That means this algorithm — and every rule in it — is pinned to the wire major version. Changing how a snapshot resolves is a breaking change, never additive. See Versioning.
Once resolved, the level answers the two questions directly: level >= VIEW for read eligibility, level >= PARTIAL for write eligibility. A PARTIAL write is then narrowed by a scope.
Scopes
A FULL write applies to every object. A PARTIAL write applies only to objects that satisfy the feature's scope — a small boolean expression over named atoms:
| Atom | Grants write to objects where… |
|---|---|
own_record | the object belongs to the caller (its owner field matches the caller) |
own_assignment | the object is the caller's by identity — its subject/assignee is them, or they are a member of its subjects/assignees collection |
own_department | the object is in the caller's department (opt-in) |
own_subtree | the object is in the caller's unit or any unit below it (opt-in, transitive) |
You combine atoms with all_of, any_of, and not, so a scope can express things like "my own records or anything in my department." A feature without an explicit scope falls back to the matrix's default partial scope.
- The server owns evaluation. What makes an object "own record" — which column is the owner, how a department is matched — is a predicate your adapter supplies. It's never on the wire and never in the core, so a client can never resolve object-level access itself.
- Only writes are scoped. The core authorizes reads at the feature level (
level >= VIEW) only. Filtering a list or an object read down to what a user may see is an adapter queryset concern, explicitly outside the core.
Fail-closed evaluation
Scope evaluation is defined to deny on anything unexpected:
- an unknown atom →
false(deny); - an empty
any_of→false; an emptyall_of→true(the usual identities); - a malformed expression → rejected as invalid.
So a missing owner attribute, a scope the server doesn't recognize, or a typo can only ever remove access, never grant it.
The management feature and anti-lockout
rbac.manage is the feature that controls permission administration. Because an admin edits the matrix through an API that is itself restricted by rbac.manage, a careless edit could otherwise remove everyone's ability to manage permissions — an unrecoverable lock-out.
Archenstack forbids that with an invariant checked on every mutation:
At least one active, standard role must resolve
rbac.manageatFULL.
A mutation (a cell edit, a role deactivation, a policy import) that would leave no such role is rejected with a lockout error, and nothing changes. Superusers do not count toward the invariant — they're the emergency escape hatch, not the day-to-day administrator, so the matrix must always retain a normal admin.
In a multi-tenant deployment this is checked per org: each org's mutation is validated against that org's own snapshot, so one tenant can never lock out — or affect the management-FULL holders of — another. See per-org anti-lockout.
The management feature (rbac.manage) and its minimum level (FULL) are fixed by the specification and aren't configurable — they're the same in every implementation.
See also
- The model — roles, features, levels, defaults vs. overrides.
- Organizations (multi-tenancy) — how an org selects the snapshot a cell resolves against.
- The wire protocol — envelopes, the
/check/endpoint, and the error taxonomy (lockout,validation, …). - Security — the threat model behind fail-closed scoping and the caller-must-have-a-role contract.
- The specification — the exact normative rules.