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 set_ruleset(&mut self, ruleset: Ruleset)
pub fn set_ruleset(&mut self, ruleset: Ruleset)
Replace the ruleset at one priority layer without clearing approvals remembered for the current session.
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: hard denied prefixes, a trusted-prefix candidate, the winning typed rule (layer, action, specificity), and finally the approval-mode fallback. A typed ask can override the trusted candidate.
pub fn check_with_narrow_allow( &self, ctx: ExecPolicyContext<'_>, suspend_broad_allows: bool, ) -> Result<ExecPolicyCheckOutcome>
pub fn suspended_broad_allow_descriptions(&self) -> Vec<String>
Trait Implementations§
Source§impl Clone for ExecPolicyEngine
impl Clone for ExecPolicyEngine
Source§impl Debug for ExecPolicyEngine
impl Debug for ExecPolicyEngine
Auto Trait Implementations§
impl Forget for ExecPolicyEngine
impl Freeze for ExecPolicyEngine
impl Move 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