Skip to main content

TableAuthChecker

Trait TableAuthChecker 

Source
pub trait TableAuthChecker:
    Send
    + Sync
    + Debug {
    // Required method
    fn check(
        &self,
        table_name: &str,
        perm: RequiredPermission,
    ) -> Result<(), MongrelError>;
}
Expand description

Extensible auth-checker trait for the Table layer. The default implementation (used by embedded/CLI) delegates to AuthState. The daemon can provide its own implementation that reads the principal from per-request state, enabling per-user enforcement on a shared Database.

This is deliberately a Fn-style trait (not FnMut) so it can be shared across threads via Arc<dyn TableAuthChecker>.

Required Methods§

Source

fn check( &self, table_name: &str, perm: RequiredPermission, ) -> Result<(), MongrelError>

Check whether the current principal has perm on table_name. Returns Ok(()) if allowed, Err(MongrelError::PermissionDenied) (or AuthRequired) if not.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§