pub struct SimpleAccessController { /* private fields */ }Expand description
Estrutura principal do controlador de acesso simples. Mantém uma lista de chaves autorizadas em memória.
Implementations§
Source§impl SimpleAccessController
impl SimpleAccessController
Sourcepub fn new(initial_keys: Option<HashMap<String, Vec<String>>>) -> Self
pub fn new(initial_keys: Option<HashMap<String, Vec<String>>>) -> Self
Cria um novo SimpleAccessController com configuração inicial opcional
Sourcepub fn new_simple() -> Self
pub fn new_simple() -> Self
Cria um novo SimpleAccessController simples
Sourcepub async fn list_keys(&self, capability: &str) -> Vec<String>
pub async fn list_keys(&self, capability: &str) -> Vec<String>
Lista todas as chaves de uma capacidade
Sourcepub async fn list_capabilities(&self) -> Vec<String>
pub async fn list_capabilities(&self) -> Vec<String>
Lista todas as capacidades disponíveis
Sourcepub async fn has_capability(&self, capability: &str, key_id: &str) -> bool
pub async fn has_capability(&self, capability: &str, key_id: &str) -> bool
Verifica se uma chave tem uma capacidade específica
Sourcepub async fn clear_capability(&self, capability: &str) -> Result<()>
pub async fn clear_capability(&self, capability: &str) -> Result<()>
Remove todas as chaves de uma capacidade
Sourcepub async fn is_capability_empty(&self, capability: &str) -> bool
pub async fn is_capability_empty(&self, capability: &str) -> bool
Verifica se uma capacidade está vazia
Sourcepub async fn total_permissions(&self) -> usize
pub async fn total_permissions(&self) -> usize
Conta o total de permissões em todas as capacidades
Sourcepub async fn export_permissions(&self) -> HashMap<String, Vec<String>>
pub async fn export_permissions(&self) -> HashMap<String, Vec<String>>
Exporta todas as permissões para um HashMap
Sourcepub async fn import_permissions(
&self,
permissions: HashMap<String, Vec<String>>,
) -> Result<()>
pub async fn import_permissions( &self, permissions: HashMap<String, Vec<String>>, ) -> Result<()>
Importa permissões de um HashMap (substitui todas as existentes)
Sourcepub async fn grant_multiple(
&self,
capability: &str,
key_ids: Vec<&str>,
) -> Result<()>
pub async fn grant_multiple( &self, capability: &str, key_ids: Vec<&str>, ) -> Result<()>
Adiciona múltiplas chaves a uma capacidade de uma vez
Sourcepub async fn revoke_multiple(
&self,
capability: &str,
key_ids: Vec<&str>,
) -> Result<()>
pub async fn revoke_multiple( &self, capability: &str, key_ids: Vec<&str>, ) -> Result<()>
Remove múltiplas chaves de uma capacidade de uma vez
Sourcepub async fn clone_capability(
&self,
source_capability: &str,
target_capability: &str,
) -> Result<()>
pub async fn clone_capability( &self, source_capability: &str, target_capability: &str, ) -> Result<()>
Clona as permissões de uma capacidade para outra
Sourcepub fn address(&self) -> Option<Box<dyn Address>>
pub fn address(&self) -> Option<Box<dyn Address>>
Este controlador não tem um endereço, pois não é persistido.
Sourcepub fn from_options(params: CreateAccessControllerOptions) -> Result<Self>
pub fn from_options(params: CreateAccessControllerOptions) -> Result<Self>
Método factory alternativo
Trait Implementations§
Source§impl AccessController for SimpleAccessController
impl AccessController for SimpleAccessController
Source§fn grant<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
capability: &'life1 str,
key_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn grant<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
capability: &'life1 str,
key_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn revoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
capability: &'life1 str,
key_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn revoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
capability: &'life1 str,
key_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn save<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ManifestParams>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ManifestParams>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn can_append<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
entry: &'life1 dyn LogEntry,
identity_provider: &'life2 dyn IdentityProvider,
_additional_context: &'life3 dyn CanAppendAdditionalContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn can_append<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
entry: &'life1 dyn LogEntry,
identity_provider: &'life2 dyn IdentityProvider,
_additional_context: &'life3 dyn CanAppendAdditionalContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Auto Trait Implementations§
impl Freeze for SimpleAccessController
impl !RefUnwindSafe for SimpleAccessController
impl Send for SimpleAccessController
impl Sync for SimpleAccessController
impl Unpin for SimpleAccessController
impl !UnwindSafe for SimpleAccessController
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> 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<'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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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>
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>
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