pub struct Reach { /* private fields */ }Expand description
Where a call may act: the scopes the caller holds the method’s grant on
(within its ceiling), handed to the method beside auth. A read without a
target (list, watch) answers only from these.
A reach is live when it came from a gate: Reach::allows and
Reach::current ask the gate again, as memberships, roles and the
ceiling stand now — so a stream checks each event (IDENTITY-37: a role
revoked reaches an open stream at its next event). A service without a gate
hands every method Reach::everywhere, which allows everything.
Implementations§
Source§impl Reach
impl Reach
Sourcepub fn everywhere() -> Reach
pub fn everywhere() -> Reach
Everything — what a method receives on a service without a gate (login off), as today.
Sourcepub fn nowhere() -> Reach
pub fn nowhere() -> Reach
RETURNS-47: nothing — the reach of a call made for no one (a child
under the anonymous forward policy, or one whose caller cannot be
read). Covers and allows nothing, and names no grant.
Sourcepub fn is_everywhere(&self) -> bool
pub fn is_everywhere(&self) -> bool
Whether the grant is held on *. ONE-6: only a real * (or
self) — never an address scope, which holds no data.
Sourcepub fn holds_activation(&self) -> bool
pub fn holds_activation(&self) -> bool
ONE-6: whether the grant is held for the whole of this call’s
activation — the door: on *, or, for a reach
Gate::check_everywhere_at gave, on an address scope covering the
call. Never because of a data scope. An in-method backstop on a
whole-service method asks this (an operator on /dyn holds
dyn.connect’s activation); one that means “holds every data scope”
asks Reach::is_everywhere, which this never widens. Without a
gate: true, as is_everywhere is.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the grant is held nowhere (a public method called by a
caller who holds no role listing it).
Sourcepub fn caller(&self) -> Option<&AuthContext>
pub fn caller(&self) -> Option<&AuthContext>
PERF.115-49: the caller this reach was decided for — the context the
gate was asked about, which it keeps to ask again; None for an
anonymous caller and for a reach no gate made (Reach::everywhere,
Reach::nowhere). Lets a holder of the reach read that caller
rather than keep a second copy of it.
Sourcepub fn grant(&self) -> Option<&Grant>
pub fn grant(&self) -> Option<&Grant>
The grant this reach is for; None on a service without a gate.
Sourcepub fn generation(&self) -> Option<&GrantsGeneration>
pub fn generation(&self) -> Option<&GrantsGeneration>
POLYGLOT-5: the grants generation of the gate this reach came from
(BIDIR-8) — a call held open elsewhere (a child service’s stream)
asks Reach::current again only when it moved. None without a
gate.
Sourcepub fn allows(&self, target: &str) -> bool
pub fn allows(&self, target: &str) -> bool
Whether the call may act on target — asked of the gate as it
stands now. Without a gate: always. KEEL-31: a whole-service
method’s reach allows a target only while the grant is held on *.
ONE-6: a whole-service reach admitted at a door
(Gate::check_everywhere_at) allows a target only while the door
still admits and the target’s data chain does (* or a data scope
holding the grant) — an address scope never allows data.
Sourcepub fn current(&self) -> Option<Reach>
pub fn current(&self) -> Option<Reach>
The reach as it stands now: None once the grant is held nowhere (a
stream should end). Without a gate: unchanged.
Sourcepub fn recheck(&self) -> Result<Reach, Refusal>
pub fn recheck(&self) -> Result<Reach, Refusal>
FRAME-5: Reach::current with the gate’s refusal kept — Err
says why the grant is held nowhere now: Refusal::Ended when the
sign-in no longer stands (signed out, expired, revoked session),
Refusal::MissingGrant when the grants moved away,
Refusal::Unauthenticated when the caller proves no one. A held
open call that must say why it ends (a watch’s typed reason) asks
this; one that only needs to know whether asks current. Without a
gate: unchanged.
Sourcepub fn covers(&self, chain: &[ScopeRef]) -> bool
pub fn covers(&self, chain: &[ScopeRef]) -> bool
Whether the reach covers a target whose chain is chain (as
Resolve::chain gives it), by this snapshot — no new question to
the gate. Prefer Reach::allows where the answer must be current.