pub struct Engine { /* private fields */ }Expand description
Decision engine. Immutable and shareable between threads once built.
Implementations§
Source§impl Engine
impl Engine
pub fn builder(catalog: impl Into<Arc<Catalog>>) -> EngineBuilder
pub fn catalog(&self) -> &Catalog
pub fn roles(&self) -> &RoleGraph
pub fn check(&self, ctx: &Context<'_>, request: &Request<'_>) -> bool
pub fn decide(&self, ctx: &Context<'_>, request: &Request<'_>) -> Decision
Sourcepub fn decide_without_overrides(
&self,
ctx: &Context<'_>,
request: &Request<'_>,
) -> Decision
pub fn decide_without_overrides( &self, ctx: &Context<'_>, request: &Request<'_>, ) -> Decision
Decision by the grants only, without overrides. Used by overrides that depend on a permission.
Sourcepub fn explain(&self, ctx: &Context<'_>, request: &Request<'_>) -> Explanation
pub fn explain(&self, ctx: &Context<'_>, request: &Request<'_>) -> Explanation
The same decision as Engine::decide, with the trace of each override and of each grant
delivered by the source. More expensive: it evaluates the condition tree and clones the grants.
Sourcepub fn validate_grant(&self, grant: &Grant) -> Result<(), GrantError>
pub fn validate_grant(&self, grant: &Grant) -> Result<(), GrantError>
Checks a grant against the catalog and the engine configuration before writing it.
Sourcepub fn capabilities(
&self,
ctx: &Context<'_>,
subject: &Subject,
scope: &Resource,
) -> CapabilitySet
pub fn capabilities( &self, ctx: &Context<'_>, subject: &Subject, scope: &Resource, ) -> CapabilitySet
Preloads, in one trip to the source, the grants that may hold for subject within
scope. The result is itself a GrantSource for repeated decisions (a WebSocket
connection, a page with many buttons) and serializes for the frontend.
Auto Trait Implementations§
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Forget for Engine
impl Freeze for Engine
impl Move for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
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