pub trait AccessControl: Default {
type Id;
// Required methods
fn load<M>(mm: &MemoryManager<M>) -> MemoryResult<Self>
where M: MemoryProvider,
Self: Sized;
fn is_allowed(&self, identity: &Self::Id) -> bool;
fn allowed_identities(&self) -> Vec<Self::Id>;
fn add_identity<M>(
&mut self,
identity: Self::Id,
mm: &mut MemoryManager<M>,
) -> MemoryResult<()>
where M: MemoryProvider;
fn remove_identity<M>(
&mut self,
identity: &Self::Id,
mm: &mut MemoryManager<M>,
) -> MemoryResult<()>
where M: MemoryProvider;
}Expand description
Trait for access control providers.
Each implementation specifies its own Id type so that runtimes
can use native identity representations.
Runtimes that need ACL use AccessControlList (the default).
Runtimes without ACL use NoAccessControl which allows everything.
Required Associated Types§
Required Methods§
Sourcefn load<M>(mm: &MemoryManager<M>) -> MemoryResult<Self>where
M: MemoryProvider,
Self: Sized,
fn load<M>(mm: &MemoryManager<M>) -> MemoryResult<Self>where
M: MemoryProvider,
Self: Sized,
Loads ACL state from persisted memory.
Sourcefn is_allowed(&self, identity: &Self::Id) -> bool
fn is_allowed(&self, identity: &Self::Id) -> bool
Checks whether an identity is allowed.
Sourcefn allowed_identities(&self) -> Vec<Self::Id>
fn allowed_identities(&self) -> Vec<Self::Id>
Returns all allowed identities.
Sourcefn add_identity<M>(
&mut self,
identity: Self::Id,
mm: &mut MemoryManager<M>,
) -> MemoryResult<()>where
M: MemoryProvider,
fn add_identity<M>(
&mut self,
identity: Self::Id,
mm: &mut MemoryManager<M>,
) -> MemoryResult<()>where
M: MemoryProvider,
Adds an identity and persists the change.
Sourcefn remove_identity<M>(
&mut self,
identity: &Self::Id,
mm: &mut MemoryManager<M>,
) -> MemoryResult<()>where
M: MemoryProvider,
fn remove_identity<M>(
&mut self,
identity: &Self::Id,
mm: &mut MemoryManager<M>,
) -> MemoryResult<()>where
M: MemoryProvider,
Removes an identity and persists the change.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.