Skip to main content

Engine

Struct Engine 

Source
pub struct Engine<S, C = NoCache> { /* private fields */ }
Expand description

租户 RBAC 授权引擎。

Implementations§

Source§

impl<S, C> Engine<S, C>

Source

pub fn config(&self) -> &EngineConfig

返回当前引擎配置。

Source

pub async fn accessible_scope(&self, query: ScopeQuery) -> Result<AccessScope>

计算某个权限可访问的数据范围。

Source

pub async fn can_access_scope( &self, request: ScopedAccessRequest, ) -> Result<AccessDecision>

检查主体是否可以访问目标范围路径。

Source

pub async fn can_tenant( &self, request: TenantAccessRequest, ) -> Result<AccessDecision>

检查主体是否拥有租户级访问权。

Source

pub async fn explain_access_scope( &self, request: ScopedAccessRequest, ) -> Result<AccessExplanation>

解释目标路径访问检查结果。

Source

pub async fn explain_tenant( &self, request: TenantAccessRequest, ) -> Result<AccessExplanation>

解释租户级访问检查结果。

Source

pub async fn invalidate_principal( &self, tenant: &TenantId, principal: &PrincipalId, )

失效某个主体的缓存授权。

Source

pub async fn invalidate_role(&self, tenant: &TenantId, role: &RoleId)

失效某个角色的缓存授权。

Source

pub async fn invalidate_tenant(&self, tenant: &TenantId)

失效某个租户的缓存授权。

Source

pub async fn invalidate_all(&self)

失效所有缓存授权。

Trait Implementations§

Source§

impl<S: Debug, C: Debug> Debug for Engine<S, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S, C> Freeze for Engine<S, C>
where S: Freeze, C: Freeze,

§

impl<S, C> RefUnwindSafe for Engine<S, C>

§

impl<S, C> Send for Engine<S, C>
where S: Send, C: Send,

§

impl<S, C> Sync for Engine<S, C>
where S: Sync, C: Sync,

§

impl<S, C> Unpin for Engine<S, C>
where S: Unpin, C: Unpin,

§

impl<S, C> UnsafeUnpin for Engine<S, C>
where S: UnsafeUnpin, C: UnsafeUnpin,

§

impl<S, C> UnwindSafe for Engine<S, C>
where S: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.