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,
        current_schema: Option<&str>,
    ) -> 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 { ... }
    fn grpc_table_targets(
        &self,
        _request: &Request,
        _catalog: &str,
        _schema: &str,
    ) -> PermissionTableTargets { ... }
    fn precheck_table_targets(
        &self,
        _user_info: UserInfoRef,
        _req: PermissionReq<'_>,
        targets: &PermissionTableTargets,
        _current_schema: Option<&str>,
    ) -> Result<TableTargetPrecheck> { ... }
}

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, current_schema: Option<&str>, ) -> 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.

Source

fn grpc_table_targets( &self, _request: &Request, _catalog: &str, _schema: &str, ) -> PermissionTableTargets

Extracts user-visible gRPC targets before the frontend classifies them using catalog metadata. Unrecognized requests must fail closed.

Source

fn precheck_table_targets( &self, _user_info: UserInfoRef, _req: PermissionReq<'_>, targets: &PermissionTableTargets, _current_schema: Option<&str>, ) -> Result<TableTargetPrecheck>

Returns a permission decision or the indices of targets that need catalog resolution.

A checker may return TableTargetPrecheck::Allow only after authorizing both the operation and access to every target. Allow skips Self::check_permission_with_table_targets for this request. Returning NeedsPhysicalResolution(vec![]) runs that check without catalog lookups.

A false PermissionTableTarget::is_physical_metric_table flag may mean the target has not been looked up yet. If its physical status could change the decision, include its index in TableTargetPrecheck::NeedsPhysicalResolution.

The conservative default delegates the authorization decision to Self::check_permission_with_table_targets with zero catalog lookups when Self::uses_table_targets is false, and otherwise requests physical resolution for every resolved target not already marked physical.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl PermissionChecker for Option<&PermissionCheckerRef>

Source§

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

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

Source§

fn grpc_table_targets( &self, request: &Request, catalog: &str, schema: &str, ) -> PermissionTableTargets

Source§

fn precheck_table_targets( &self, user_info: UserInfoRef, req: PermissionReq<'_>, targets: &PermissionTableTargets, current_schema: Option<&str>, ) -> Result<TableTargetPrecheck>

Source§

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

Implementors§