pub struct RoleMapper { /* private fields */ }Expand description
Role mapper
Implementations§
Source§impl RoleMapper
impl RoleMapper
Sourcepub fn builder() -> RoleMapperBuilder
pub fn builder() -> RoleMapperBuilder
Create a builder
Sourcepub fn map_primary_role(&self, identity: &Identity) -> Option<String>
pub fn map_primary_role(&self, identity: &Identity) -> Option<String>
Map an identity to a single database role (primary)
Sourcepub fn has_permission(&self, identity: &Identity, permission: &str) -> bool
pub fn has_permission(&self, identity: &Identity, permission: &str) -> bool
Check if identity has a specific permission
Sourcepub fn get_permissions(&self, identity: &Identity) -> Vec<String>
pub fn get_permissions(&self, identity: &Identity) -> Vec<String>
Get all permissions for an identity
Sourcepub fn assign_static_role(
&self,
user_id: impl Into<String>,
role: impl Into<String>,
)
pub fn assign_static_role( &self, user_id: impl Into<String>, role: impl Into<String>, )
Add a static role assignment
Sourcepub fn remove_static_role(&self, user_id: &str, role: &str)
pub fn remove_static_role(&self, user_id: &str, role: &str)
Remove a static role assignment
Sourcepub fn anonymous_role(&self) -> Option<&String>
pub fn anonymous_role(&self) -> Option<&String>
Get anonymous role
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoleMapper
impl !RefUnwindSafe for RoleMapper
impl Send for RoleMapper
impl Sync for RoleMapper
impl Unpin for RoleMapper
impl UnsafeUnpin for RoleMapper
impl !UnwindSafe for RoleMapper
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> 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 more