Skip to main content

AccessControl

Trait AccessControl 

Source
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§

Source

type Id

The identity type used by this access control provider.

Required Methods§

Source

fn load<M>(mm: &MemoryManager<M>) -> MemoryResult<Self>
where M: MemoryProvider, Self: Sized,

Loads ACL state from persisted memory.

Source

fn is_allowed(&self, identity: &Self::Id) -> bool

Checks whether an identity is allowed.

Source

fn allowed_identities(&self) -> Vec<Self::Id>

Returns all allowed identities.

Source

fn add_identity<M>( &mut self, identity: Self::Id, mm: &mut MemoryManager<M>, ) -> MemoryResult<()>
where M: MemoryProvider,

Adds an identity and persists the change.

Source

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.

Implementors§