pub struct OrgScope { /* private fields */ }Expand description
A resolved session scope over the org tree (ADR-0028).
Built by resolve_org_scope; carried by with_org_request_scope.
Implementations§
Source§impl OrgScope
impl OrgScope
Sourcepub fn for_company_unit(unit: Uuid) -> Self
pub fn for_company_unit(unit: Uuid) -> Self
A single-company scope for paths that cannot run the resolver — chiefly composition
seams minting records on a node the request already pinned (ADR-0029’s decorator makes
those inserts resolve their org_unit_id from app.acting_unit_id).
Precondition: unit must be a COMPANY node (or whatever node kind the caller’s
rows anchor on, with legacy_company_id semantics in mind). resolve_org_scope
derives the legacy app.company_id by walking ancestors from the acting node; this
constructor sets it verbatim, so a BRANCH handed here would bind a legacy variable
matching no company-fenced row and fail closed on every not-yet-stripped table.
The scope ids are exactly [unit] — no root-shared rows, no sibling subtrees. That is
fail-narrow (the same property as execute_unit_scoped): inserts land on the unit
and reads see only the unit’s own rows. Paths needing the session’s entitlement union
must resolve a real scope instead.
Sourcepub fn scope_unit_ids(&self) -> &[Uuid]
pub fn scope_unit_ids(&self) -> &[Uuid]
Every unit id this session may see rows for: the union of the entitled subtrees plus the root node. Order is stable (sorted) so the serialized form is deterministic.
Sourcepub fn acting_unit_id(&self) -> Uuid
pub fn acting_unit_id(&self) -> Uuid
The node the session acts at — the default org_unit_id for new records and the UI’s
context node.
Sourcepub fn legacy_company_id(&self) -> Option<Uuid>
pub fn legacy_company_id(&self) -> Option<Uuid>
The company node for the legacy app.company_id fence during the re-key transition.
Trait Implementations§
impl Eq for OrgScope
impl StructuralPartialEq for OrgScope
Auto Trait Implementations§
impl Freeze for OrgScope
impl RefUnwindSafe for OrgScope
impl Send for OrgScope
impl Sync for OrgScope
impl Unpin for OrgScope
impl UnsafeUnpin for OrgScope
impl UnwindSafe for OrgScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more