Skip to main content

Module permission

Module permission 

Source
Expand description

What is currently permitted, across a set of subjects and actions.

§A cell has four states, not two

PermissionState keeps NotApplicable apart from Denied. “This tool has no network to reach” and “this tool is refused the network” are different sentences: the first says the question does not arise, the second says somebody answered it no. Drawing them the same way would invent a refusal nobody made, so they are different states, different wording, and different published values.

§Where a permission came from

A permission inherited from a broader rule is not the same as one set in this matrix, and a reader who cannot tell them apart cannot tell what changing a cell would actually do. The component therefore carries and shows provenance through PermissionSource, and derives none of it: working out which rule won is policy evaluation over a rule set the host owns, which is exactly the kind of fact this library takes as an input rather than computing. Every cell says either where it was inherited from, in the host’s own words, or that it was set here.

§Read-only and editable

A matrix with no on_change handler is read-only: its cells publish Role::Cell and install nothing. A cell whose state is NotApplicable installs nothing either, in an editable matrix as much as a read-only one, because there is no state for it to cycle to.

Structs§

PermissionAction
One column: an action, addressed by a stable key.
PermissionChange
What operating a cell asks for. Nothing is applied.
PermissionEntry
One cell: a state, and where it came from.
PermissionMatrix
A grid of subjects against actions.
PermissionSubject
One row: whatever the permissions are about, and its cells.

Enums§

PermissionSource
Where a cell’s state was decided.
PermissionState
What a cell says about one subject and one action.