Crate policy
Expand description
Who may invoke which action.
Authority is granted over the published tree of rooms, apps, resources,
items and actions. A Grant names a Subject, a node (TreePath),
the kinds of action it covers (KindSet), an Answer and a
Lifetime. decide is the one function every door, host and receiver
uses: the most specific covering node wins, at the same node Deny beats Ask
beats Allow, and no grant means Deny. Someone acting for a person (an agent,
a task, a Shortcut, an app) is bounded by both: Authority::decide takes
the minimum.
Roles are presets of grants on a room (roles); membership, roles and
grants change only through the room’s governance actions (RoomPolicy).
[describe] renders a grant set as sentences people and agents can talk
through.
Modules§
- bot
- A bot’s grants: the rules its program needs, held to the room it was installed in, never reaching governance.
- describe
- Grant sets in plain language, for the people who give them and the agents that hold them.
- edits
- When a generic field edit asks for confirmation.
- roles
- Presets: named grant sets. Roles are the built-in presets on a room; an agent’s default delegation and the foreign-device bound are presets too.
Structs§
- Authority
- Who is acting: a person, and the delegations bounding them (an agent, a task, a Shortcut, an app, a foreign device).
- Bound
- A delegation bounding a person: its subject and the grants it carries itself (an agent delegation’s, a Shortcut’s). The room’s own grants naming the subject count too.
- Context
- What liveness depends on where a decision is made.
- Decision
- One party’s answer for one node and kind.
- Grant
- One grant.
- GrantId
- Names one grant, so it can be revoked or consumed.
- Ids
- Labels nodes by their ids.
- KindSet
- The kinds a grant covers. Serialised as the list of kinds.
- Party
- One source of authority: the subjects someone is known by, the grants that may name them, and the rooms they own.
- Path
Error - A path that does not parse.
- Preset
- A named grant set people pick instead of writing grants one by one.
- Room
Policy - Everything that decides authority in one room.
- Rule
- One rule of a preset: a grant without its subject.
- Specificity
- How specific a grant’s node is. Greater is more specific: names beat open levels position by position, and a deeper node beats its ancestors.
- Standing
- Who is acting in a room and everything their authority depends on.
- Tree
Path - A node, or a pattern of nodes, in the published tree.
- Verdict
- The combined answer for one node and kind, with each party’s part.
Enums§
- Action
Kind - What an action is able to do, derived by the framework from the action’s code and never declared by an app.
- Answer
- The answer a grant gives. Ordered
Deny < Ask < Allow, so the stricter of two answers is their minimum. - Basis
- Why a party answered as it did.
- Change
- A change to a room’s authority. Each is one governance action.
- Level
- The level of a segment in the tree.
- Lifetime
- How long a grant is live.
- Preset
Error - A preset that cannot be assigned.
- Refusal
- Why a governance action was refused.
- Role
- A role preset. A member of a room holds one; the room keeps the grants each
role carries (see
crate::roles). - Segment
- One segment of a path.
- Subject
- Whom a grant is for.
Traits§
- Labels
- Names for nodes. The default uses ids; a host that knows app and resource names supplies them.
Functions§
- decide
- Decides for one set of subjects over one set of grants:
- describe
- One sentence per node:
Mail: reading and undoable changes allowed, outside effects ask first.Nodes come in tree order; grants with a lifetime other than until-revoked say so. - describe_
node - A node as people read it:
Mail › every resource › Send.