Skip to main content

PermissionChecker

Trait PermissionChecker 

Source
pub trait PermissionChecker: Send + Sync {
    // Required methods
    fn check_permission(
        &self,
        user_info: UserInfoRef,
        req: PermissionReq<'_>,
    ) -> Result<PermissionResp>;
    fn check_permission_with_table_targets(
        &self,
        user_info: UserInfoRef,
        req: PermissionReq<'_>,
        targets: PermissionTableTargets,
    ) -> Result<PermissionResp>;

    // Provided methods
    fn check_permission_with_context(
        &self,
        user_info: UserInfoRef,
        req: PermissionReq<'_>,
        _current_schema: Option<&str>,
    ) -> Result<PermissionResp> { ... }
    fn uses_table_targets(&self) -> bool { ... }
}

Required Methods§

Source

fn check_permission( &self, user_info: UserInfoRef, req: PermissionReq<'_>, ) -> Result<PermissionResp>

Source

fn check_permission_with_table_targets( &self, user_info: UserInfoRef, req: PermissionReq<'_>, targets: PermissionTableTargets, ) -> Result<PermissionResp>

Checks the operation privilege and its resolved user-visible table targets.

PermissionTableTargets::Resolved with an empty vector still requires checking the operation privilege in req, but has no table ACLs to check.

ACL-aware implementations must apply any admin bypass first, then reject PermissionTableTargets::Unresolved for non-admin users.

Provided Methods§

Source

fn check_permission_with_context( &self, user_info: UserInfoRef, req: PermissionReq<'_>, _current_schema: Option<&str>, ) -> Result<PermissionResp>

Source

fn uses_table_targets(&self) -> bool

Returns whether authorization depends on resolved table targets.

The conservative default keeps target resolution enabled. Implementations may return false only when their authorization result is independent of the targets passed to Self::check_permission_with_table_targets.

Implementations on Foreign Types§

Source§

impl PermissionChecker for Option<&PermissionCheckerRef>

Implementors§