pub struct CustomKindPolicy { /* private fields */ }Expand description
A PermissionPolicy that matches requests whose PermissionRequest::kind
starts with "custom." and allows or denies them by name.
Use this to govern application-defined permission categories without writing a full policy implementation.
§Example
use agentkit_tools_core::CustomKindPolicy;
let policy = CustomKindPolicy::new(true)
.allow_kind("custom.analytics")
.deny_kind("custom.billing");Implementations§
Source§impl CustomKindPolicy
impl CustomKindPolicy
Sourcepub fn new(require_approval_by_default: bool) -> Self
pub fn new(require_approval_by_default: bool) -> Self
Creates a new policy.
§Arguments
require_approval_by_default- Whentrue, unrecognisedcustom.*kinds require approval instead of returningPolicyMatch::NoOpinion.
Sourcepub fn allow_kind(self, kind: impl Into<String>) -> Self
pub fn allow_kind(self, kind: impl Into<String>) -> Self
Adds a kind string to the allow-list.
Trait Implementations§
Source§impl PermissionPolicy for CustomKindPolicy
impl PermissionPolicy for CustomKindPolicy
Source§fn evaluate(&self, request: &dyn PermissionRequest) -> PolicyMatch
fn evaluate(&self, request: &dyn PermissionRequest) -> PolicyMatch
Evaluate the request and return a match or
PolicyMatch::NoOpinion.Auto Trait Implementations§
impl Freeze for CustomKindPolicy
impl RefUnwindSafe for CustomKindPolicy
impl Send for CustomKindPolicy
impl Sync for CustomKindPolicy
impl Unpin for CustomKindPolicy
impl UnsafeUnpin for CustomKindPolicy
impl UnwindSafe for CustomKindPolicy
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