pub struct PolicyEngine { /* private fields */ }Expand description
Resolves declarative policy into an effective policy and enforces approvals.
Implementations§
Source§impl PolicyEngine
impl PolicyEngine
Sourcepub fn new(repository: PolicyRepository) -> Self
pub fn new(repository: PolicyRepository) -> Self
Creates a policy engine from the loaded repository data.
Sourcepub fn repository(&self) -> &PolicyRepository
pub fn repository(&self) -> &PolicyRepository
Returns the loaded repository data.
Sourcepub fn resolve(
&self,
mode_slug: &str,
approval_profile_slug: &ApprovalProfileSlug,
) -> Result<ResolvedMode, PolicyError>
pub fn resolve( &self, mode_slug: &str, approval_profile_slug: &ApprovalProfileSlug, ) -> Result<ResolvedMode, PolicyError>
Resolves the effective policy for a mode and approval profile.
The result is the policy Ferrify actually executes with after mode defaults and approval-profile overrides have been merged.
§Errors
Returns PolicyError when either the mode or approval profile is
missing from the loaded repository data.
Checks whether a capability can be used with the provided approvals.
§Errors
Returns PolicyError when the capability is not allowed by the active
mode, when the capability is denied outright, or when the capability
requires approval and the caller did not supply it.
Enforces the rule that widening a mode’s authority requires approval.
§Errors
Returns PolicyError when the target mode introduces a capability
that is either disallowed or not explicitly approved for the transition.
Trait Implementations§
Source§impl Clone for PolicyEngine
impl Clone for PolicyEngine
Source§fn clone(&self) -> PolicyEngine
fn clone(&self) -> PolicyEngine
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more