pub struct ExecPolicyEngine { /* private fields */ }Implementations§
Source§impl ExecPolicyEngine
impl ExecPolicyEngine
Sourcepub fn new(trusted_prefixes: Vec<String>, denied_prefixes: Vec<String>) -> Self
pub fn new(trusted_prefixes: Vec<String>, denied_prefixes: Vec<String>) -> Self
Legacy constructor: wraps the two vecs into a User-layer ruleset.
Sourcepub fn with_rulesets(rulesets: Vec<Ruleset>) -> Self
pub fn with_rulesets(rulesets: Vec<Ruleset>) -> Self
Build an engine from explicit layered rulesets. Rulesets are sorted by layer priority on construction.
Sourcepub fn add_ruleset(&mut self, ruleset: Ruleset)
pub fn add_ruleset(&mut self, ruleset: Ruleset)
Add a ruleset layer (re-sorts internally).
Sourcepub fn remember_session_approval(&mut self, approval_key: String)
pub fn remember_session_approval(&mut self, approval_key: String)
Records an approval key for the current session so subsequent checks skip approval.
Sourcepub fn is_session_approved(&self, approval_key: &str) -> bool
pub fn is_session_approved(&self, approval_key: &str) -> bool
Returns whether the given approval key has been recorded for this session.
Sourcepub fn check(&self, ctx: ExecPolicyContext<'_>) -> Result<ExecPolicyDecision>
pub fn check(&self, ctx: ExecPolicyContext<'_>) -> Result<ExecPolicyDecision>
Evaluates a command against the policy and returns a decision.
The evaluation order is: deny rules first (always win), then trusted prefix matching (arity-aware), then typed ask rules, and finally the approval mode.
Trait Implementations§
Source§impl Clone for ExecPolicyEngine
impl Clone for ExecPolicyEngine
Source§fn clone(&self) -> ExecPolicyEngine
fn clone(&self) -> ExecPolicyEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExecPolicyEngine
impl Debug for ExecPolicyEngine
Source§impl Default for ExecPolicyEngine
impl Default for ExecPolicyEngine
Source§fn default() -> ExecPolicyEngine
fn default() -> ExecPolicyEngine
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ExecPolicyEngine
impl RefUnwindSafe for ExecPolicyEngine
impl Send for ExecPolicyEngine
impl Sync for ExecPolicyEngine
impl Unpin for ExecPolicyEngine
impl UnsafeUnpin for ExecPolicyEngine
impl UnwindSafe for ExecPolicyEngine
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