Struct bonsaidb_core::admin::Role
source · [−]Expand description
An assignable role, which grants permissions based on the associated PermissionGroups.
Fields
name: StringThe name of the role. Must be unique.
groups: Vec<u64>The IDs of the permission groups this role belongs to.
Implementations
sourceimpl Role
impl Role
sourcepub fn named<S: Into<String>>(name: S) -> Self
pub fn named<S: Into<String>>(name: S) -> Self
Returns a new role with no groups and the name provided.
sourcepub fn with_group_ids<I: IntoIterator<Item = u64>>(self, ids: I) -> Self
pub fn with_group_ids<I: IntoIterator<Item = u64>>(self, ids: I) -> Self
Builder-style method. Returns self after replacing the current groups with ids.
Trait Implementations
sourceimpl Collection for Role
impl Collection for Role
sourcefn collection_name() -> CollectionName
fn collection_name() -> CollectionName
The Id of this collection.
sourceimpl<'de> Deserialize<'de> for Role
impl<'de> Deserialize<'de> for Role
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl NamedCollection for Role
impl NamedCollection for Role
type ByNameView = ByName
type ByNameView = ByName
The name view defined for the collection.
sourcefn load<'name, 'life0, 'async_trait, N: Into<NamedReference<'name>> + Send + Sync, C: Connection>(
id: N,
connection: &'life0 C
) -> Pin<Box<dyn Future<Output = Result<Option<CollectionDocument<Self>>, Error>> + Send + 'async_trait>> where
Self: SerializedCollection + Sized + 'static,
'name: 'async_trait,
N: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn load<'name, 'life0, 'async_trait, N: Into<NamedReference<'name>> + Send + Sync, C: Connection>(
id: N,
connection: &'life0 C
) -> Pin<Box<dyn Future<Output = Result<Option<CollectionDocument<Self>>, Error>> + Send + 'async_trait>> where
Self: SerializedCollection + Sized + 'static,
'name: 'async_trait,
N: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
Gets a CollectionDocument with id from connection.
sourcefn entry<'connection, 'name, N: Into<NamedReference<'name>> + Send + Sync, C: Connection>(
id: N,
connection: &'connection C
) -> Entry<'connection, 'name, C, Self, (), ()>ⓘNotable traits for Entry<'a, 'name, Conn, Col, EI, EU>impl<'a, 'name, Conn, Col, EI, EU> Future for Entry<'a, 'name, Conn, Col, EI, EU> where
Col: NamedCollection + SerializedCollection + 'static,
Conn: Connection,
EI: EntryInsert<Col> + 'a,
EU: EntryUpdate<Col> + 'a,
'name: 'a, type Output = Result<Option<CollectionDocument<Col>>, Error>; where
Self: SerializedCollection + Sized,
fn entry<'connection, 'name, N: Into<NamedReference<'name>> + Send + Sync, C: Connection>(
id: N,
connection: &'connection C
) -> Entry<'connection, 'name, C, Self, (), ()>ⓘNotable traits for Entry<'a, 'name, Conn, Col, EI, EU>impl<'a, 'name, Conn, Col, EI, EU> Future for Entry<'a, 'name, Conn, Col, EI, EU> where
Col: NamedCollection + SerializedCollection + 'static,
Conn: Connection,
EI: EntryInsert<Col> + 'a,
EU: EntryUpdate<Col> + 'a,
'name: 'a, type Output = Result<Option<CollectionDocument<Col>>, Error>; where
Self: SerializedCollection + Sized,
Col: NamedCollection + SerializedCollection + 'static,
Conn: Connection,
EI: EntryInsert<Col> + 'a,
EU: EntryUpdate<Col> + 'a,
'name: 'a, type Output = Result<Option<CollectionDocument<Col>>, Error>;
Gets a CollectionDocument with id from connection.
sourcefn load_document<'name, 'life0, 'async_trait, N: Into<NamedReference<'name>> + Send + Sync, C: Connection>(
name: N,
connection: &'life0 C
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>> where
Self: SerializedCollection + Sized,
'name: 'async_trait,
N: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn load_document<'name, 'life0, 'async_trait, N: Into<NamedReference<'name>> + Send + Sync, C: Connection>(
name: N,
connection: &'life0 C
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>> where
Self: SerializedCollection + Sized,
'name: 'async_trait,
N: 'async_trait,
C: 'async_trait,
'life0: 'async_trait,
Self: Send + 'async_trait,
Loads a document from this collection by name, if applicable. Return
Ok(None) if unsupported. Read more
impl DefaultSerialization for Role
Auto Trait Implementations
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnwindSafe for Role
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Schema for T where
T: 'static + Collection,
impl<T> Schema for T where
T: 'static + Collection,
sourcefn schema_name() -> SchemaName
fn schema_name() -> SchemaName
Returns the unique SchemaName for this schema.