Module permissions
Expand description
The toolkit’s permission gate.
Two questions, each answered by the one model that owns it:
- May this person (or their agent) perform this action? Decided by
tilo-action-policyover the workspace’s grants: aStandingnames the person, the workspace’s policy and any delegation bounding them, andPermissionScope::Actionnames a node below the workspace and the action’s kind. - May this app’s code reach this path, device or host? Decided by the
sandbox capabilities of [
collab_types::caps] (PermissionScope::Sandbox).
The host installs both via PermissionContext::new; nothing here decides
anything itself.
Modules§
- capability
- Widgets gated by a permission scope.
- policy
- Who may invoke which action.
Structs§
- Action
Decider - Answers
PermissionContext::permits_actionfor many actions of one app: one authority for all of them, and the node of the resource last asked about kept for the next action on it. - Actor
- The thing asking to reach a sandboxed resource: every
Principalit can prove it is, and its signing key if it has one. - CapOverride
- One sandbox capability.
- KindSet
- The kinds a grant covers. Serialised as the list of kinds.
- Live
Permissions - A participant’s permissions as they stand now, following every change the host makes while the app runs: a role changed by the record’s owner, a grant revoked, a capability granted. Read-only: only the host changes them.
- Permission
Context - The authority and sandbox a frame’s permission checks are decided against.
Held by
App, consulted byapp::dispatch_gated_eventbefore a gated widget ever sees an event. - Shared
Permissions - The permissions a host shares with what it hosts (an app, its components,
a worker) and changes while they run: a role changed by the record’s
owner, a grant revoked, a workspace’s participation. Every change goes through
Self::set, which movesshared_revisionon, so whatever derives something from shared permissions (which controls may run) derives it again only after a change, not on every frame. - Standing
- Who is acting in a workspace and everything their authority depends on.
- Tree
Path - A node, or a pattern of nodes, in the published tree.
- UserId
- A person’s stable id, as apps and presence spell it.
- Weak
Permissions SharedPermissionsheld without keeping them shared.
Enums§
- Access
- How far a sandbox capability reaches into its resource.
- 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. - AppKind
- Which system app a presence key or a permission scope refers to.
- CapDecision
- The outcome of a sandbox check.
- Denial
- A refused permission check, with the reason people and agents read.
- Effect
- Whether a capability grants or restricts.
- Expiry
- When a capability dies — the
expiryof(subject, resource, verbs, expiry). - Permission
Scope - What a widget or a launch asks permission for.
- Principal
- A named principal — the string-keyed half of the subject space.
- Resource
Ref - A sandboxed resource an app might reach.
- Role
- A role preset. A member of a workspace holds one; the workspace keeps the grants each
role carries (see
crate::roles). - Scope
- What a sandbox capability ranges over.
- Subject
- Who a capability is about: one signing identity or a named
Principal.
Constants§
- LOCAL_
USER - The id the local, unrestricted user acts as under
PermissionContext::permissive. - LOCAL_
WORKSPACE - The workspace
PermissionContext::permissiveandPermissionContext::memberdecide in, when no host names one.
Functions§
- action_
node - The node below the workspace of action
action_idon resourceresource_id(of kindresource_kind) published byapp_id. - admit_
in_ window - The shared admission (
tilo_action_policy::admit) as a window takes it for its own person, the decision a broker takes for a caller: an ask is theirs to confirm in the window when they act themselves (direct), and nobody else’s here.confirmedis their confirmation, or the broker having admitted it. - decide_
capability - May
actorreachresourcewithaccess? A live matching grant whose access implies the request allows, unless a live matching restriction caps it below the request.nowin Unix seconds;Noneskips expiry. - outside_
changed - An outside authority permissions follow changed, on any thread: the
host’s view of an app’s action authority, or a policy clock
(
PermissionContext::with_policy_time_sampler) that could not be read and can be again. Movesshared_revisionon and wakes every loop that asked ([wake_on_outside_change]), so what it derived from permissions is derived again. - shared_
revision - Moves on with every change of any
SharedPermissionson this thread, and with every change of an outside authority they follow.