pub struct AccessContext { /* private fields */ }Expand description
A resolve-once, in-memory oracle for “can this viewer see page X?”.
Built per render by access_context and reused for viewer-aware
menu hiding and the can_view / visible Tera helpers (so a
template can guard any hand-written page link or nested list with
the same protection the built-in menus apply). Holds the viewer’s
resolved facts + every tenant view-restriction (page/subtree and
per-type), so AccessContext::can_view answers with zero further
queries.
Implementations§
Source§impl AccessContext
impl AccessContext
Sourcepub fn is_unrestricted(&self) -> bool
pub fn is_unrestricted(&self) -> bool
True when nothing is gated at all — callers can short-circuit to “everything visible” without inspecting each page.
Sourcepub fn gates_by_type(&self) -> bool
pub fn gates_by_type(&self) -> bool
True when some page type carries a view restriction.
Auto Trait Implementations§
impl Freeze for AccessContext
impl RefUnwindSafe for AccessContext
impl Send for AccessContext
impl Sync for AccessContext
impl Unpin for AccessContext
impl UnsafeUnpin for AccessContext
impl UnwindSafe for AccessContext
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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 moreCreates a shared type from an unshared type.