pub struct DatabaseStorage { /* private fields */ }Expand description
Database-backed storage adapter for role-system
Implementations§
Source§impl DatabaseStorage
impl DatabaseStorage
Sourcepub fn new(connection: Arc<dyn DatabaseConnection>) -> Self
pub fn new(connection: Arc<dyn DatabaseConnection>) -> Self
Create new database storage adapter
Sourcepub fn with_cache_ttl(self, ttl_seconds: u64) -> Self
pub fn with_cache_ttl(self, ttl_seconds: u64) -> Self
Set cache TTL
Sourcepub async fn initialize_schema(&self) -> Result<(), DatabaseError>
pub async fn initialize_schema(&self) -> Result<(), DatabaseError>
Initialize database schema
Trait Implementations§
Source§impl RoleStorage for DatabaseStorage
impl RoleStorage for DatabaseStorage
fn create_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 StoredRole,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 StoredRole,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<StoredRole>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_roles<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<StoredRole>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_permission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
permission: &'life2 StoredPermission,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_permission<'life0, 'life1, 'async_trait>(
&'life0 self,
permission_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<StoredPermission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn assign_role<'life0, 'life1, 'async_trait>(
&'life0 self,
assignment: &'life1 RoleAssignment,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn revoke_role<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
role_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_user_roles<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_role_permissions<'life0, 'life1, 'async_trait>(
&'life0 self,
role_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn log_audit_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: &'life1 AuditEntry,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for DatabaseStorage
impl !RefUnwindSafe for DatabaseStorage
impl Send for DatabaseStorage
impl Sync for DatabaseStorage
impl Unpin for DatabaseStorage
impl UnsafeUnpin for DatabaseStorage
impl !UnwindSafe for DatabaseStorage
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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