pub struct AbacEngine { /* private fields */ }Expand description
The ABAC policy evaluation engine.
Compiles policies at construction time and evaluates them with forbid-overrides semantics (any matching forbid wins over all permits).
Implementations§
Source§impl AbacEngine
impl AbacEngine
Sourcepub fn new(
policies: &[AbacPolicy],
entities: &[AbacEntity],
) -> Result<Self, String>
pub fn new( policies: &[AbacPolicy], entities: &[AbacEntity], ) -> Result<Self, String>
Create an ABAC engine from policies and entities.
Compiles all policies and builds the entity store. Returns an error if any policy pattern is invalid or entity bounds are exceeded.
Sourcepub fn evaluate(
&self,
action: &Action,
ctx: &AbacEvalContext<'_>,
) -> AbacDecision
pub fn evaluate( &self, action: &Action, ctx: &AbacEvalContext<'_>, ) -> AbacDecision
Evaluate an action against all ABAC policies.
Uses forbid-overrides semantics:
- Collect matching policies (principal + action + resource + conditions)
- If any matching policy is Forbid → Deny
- If any matching policy is Permit (and no Forbid) → Allow
- If nothing matches → NoMatch (caller decides)
Sourcepub fn entity_store(&self) -> &EntityStore
pub fn entity_store(&self) -> &EntityStore
Get a reference to the entity store.
Sourcepub fn find_conflicts(&self) -> Vec<AbacConflict>
pub fn find_conflicts(&self) -> Vec<AbacConflict>
Detect conflicts where permit and forbid policies overlap.
Sourcepub fn policy_count(&self) -> usize
pub fn policy_count(&self) -> usize
Return the number of compiled policies.
Auto Trait Implementations§
impl Freeze for AbacEngine
impl RefUnwindSafe for AbacEngine
impl Send for AbacEngine
impl Sync for AbacEngine
impl Unpin for AbacEngine
impl UnsafeUnpin for AbacEngine
impl UnwindSafe for AbacEngine
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