Declared Access Grants
Some instances have their access decided on their deployment record. A test instance where every member is a tester is the typical case. On such an instance, who holds which role is part of the instance's declaration, made by pull request like everything else on the record. A customer instance decides access through governed activities instead, and its record states no grants.
"accessGrants": [
{ "scope": "/", "role": "Underwriter", "to": { "allMembers": true } },
{ "scope": "/", "role": "Underwriter", "to": { "user": "rbuergi" } },
{ "scope": "Esl", "role": "AvpEsl", "to": { "group": "EslTeam/EslTeam" } }
]
| Field | Meaning |
|---|---|
scope |
/ (the default) is the instance root; otherwise a node path such as a partition. A path segment may not start with _. |
role |
A built-in role or one a Role node declares. |
to |
Exactly one of user (a user id), group (a group path) or allMembers: true. |
Every member (allMembers) means every signed-in, non-virtual user of this instance, and never an anonymous
visitor. It is the platform's Public subject, which the permission fold ORs into the roles of every signed-in viewer.
How it works
- The record renders
Access__DeclaredGrants__N__Scope|Role|User|Group|AllMembers(DeploymentPortalConfig.PortalConfig, on both the Helm and the Aspire route). - The portal reads
Access:DeclaredGrants(DeclaredAccessGrants.Read). It turns each valid entry into a computedAccessAssignmentat{scope}/_Access(_Accessfor the root), served as a static node (IStaticNodeProvider). ItsgovernedByisrecord:Access:DeclaredGrants:{N}, the provenance (DeclaredAccessGrants.IsRecordOwned). - The permission fold already unions static assignments into every evaluation. A declared grant is therefore a grant
like any other: it is inherited down the scope, expanded through groups, and subtracted by a
Deniedassignment.hub.HoldsRole, the permission checks and the role lookups (Doc/Architecture/RoleChecks) all answer for it. There is one fold and no second evaluator.
Declared, not derived
The record is the source of truth (policy declared-not-derived), and nothing is written:
- Dropped from the record means gone. An entry the record no longer states is not produced at the next boot. There is no stored row to prune, so nothing can outlive the record.
- Hand-made and governed grants are never touched. The portal writes no assignment. The broad-grant guard's rule that a platform sweep never writes a grant therefore holds trivially.
- An absent role node is not a removal. A grant to a role id no
Rolenode declares confers nothing, because the fold ignores an undeclared role. It is reported by name and kept, since a role package installed later declares the role.DeclaredAccessGrants.ObserveProblems(hub)is live and re-evaluates as the role catalog changes. - A malformed entry is refused by name and grants nothing. An entry is malformed when it has no role, names zero
or several subjects, has an invalid scope, or grants to
Anonymous. The refusal is logged as[DeclaredAccessGrants] REFUSED Access:DeclaredGrants:{N}: ….
When a change applies. The grants are read when the portal boots. A record change reaches the pods by a roll, which boots them from the new render, and a running process keeps the set it booted with. The process-wide security queries carry the static nodes they were first built with.
One instance only. Each portal reads its own record. A grant on one record reaches no other instance, and a record
that states none renders no Access__DeclaredGrants key at all.
The read paths
The C# permission fold (HoldsRole, CheckPermission, the layout areas and menus) includes declared grants. The
Postgres search projection reads stored rows only, so a declared role's permissions do not widen what a SQL search
returns. That direction is fail-closed. Gating process moves by role is unaffected, because the role question is
answered by the fold.
Proven by
test/MeshWeaver.Graph.Test/DeclaredAccessGrantsTest.cschecks that a declared grant is held by the named user and by every member, on every scope below the root, and never by an anonymous visitor. It also checks that an undeclared role is refused by name, that malformed entries are refused by name, and that the computed nodes carry their provenance.DeclaredAccessGrantsDroppedTestboots from the next render with the root grants dropped. Those grants are gone, the moved grant applies where it moved, and the governed grant is untouched and not record-owned.test/MeshWeaver.Deployment.Contract.Test/AccessGrantsRecordTest.cschecks that the record's JSON round-trips, that both routes render the keys the portal reads, and that another instance's record renders none.
See also: Role Checks · Configuring an Instance from Aspire (the record's parity table) · Declared Not Derived.