pub struct Guard { /* private fields */ }Expand description
Main public entry point for ClawDB security checks.
Implementations§
Source§impl Guard
impl Guard
Sourcepub async fn new(config: GuardConfig) -> GuardResult<Self>
pub async fn new(config: GuardConfig) -> GuardResult<Self>
Opens the SQLite pool, applies migrations, and initializes guard services.
Sourcepub fn keys(&self) -> &ApiKeyManager
pub fn keys(&self) -> &ApiKeyManager
Returns the shared API key manager.
Sourcepub fn sessions(&self) -> &SessionManager
pub fn sessions(&self) -> &SessionManager
Returns the shared session manager.
Sourcepub fn policy_engine(&self) -> &PolicyEngine
pub fn policy_engine(&self) -> &PolicyEngine
Returns the policy engine.
Sourcepub fn masking_engine(&self) -> &MaskingEngine
pub fn masking_engine(&self) -> &MaskingEngine
Returns the configured masking engine.
Sourcepub fn config(&self) -> &GuardConfig
pub fn config(&self) -> &GuardConfig
Returns the guard configuration.
Sourcepub fn pool(&self) -> &SqlitePool
pub fn pool(&self) -> &SqlitePool
Returns the underlying SQLite pool.
Sourcepub async fn check_access(
&self,
session: &GuardSession,
action: &str,
resource: &str,
) -> GuardResult<AccessResult>
pub async fn check_access( &self, session: &GuardSession, action: &str, resource: &str, ) -> GuardResult<AccessResult>
Evaluates a session, action, and resource triplet.
Sourcepub async fn check_access_with_task(
&self,
session: &GuardSession,
action: &str,
resource: &str,
task: &str,
) -> GuardResult<AccessResult>
pub async fn check_access_with_task( &self, session: &GuardSession, action: &str, resource: &str, task: &str, ) -> GuardResult<AccessResult>
Evaluates access with an explicit task name.
Sourcepub fn check_tool_permission(
&self,
session: &GuardSession,
tool_name: &str,
) -> bool
pub fn check_tool_permission( &self, session: &GuardSession, tool_name: &str, ) -> bool
Checks whether a session grants permission to use a tool.
Sourcepub async fn query_audit(
&self,
filter: AuditFilter,
) -> GuardResult<Vec<AuditEntry>>
pub async fn query_audit( &self, filter: AuditFilter, ) -> GuardResult<Vec<AuditEntry>>
Queries persisted audit records.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Guard
impl !RefUnwindSafe for Guard
impl Send for Guard
impl Sync for Guard
impl Unpin for Guard
impl UnsafeUnpin for Guard
impl !UnwindSafe for Guard
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request