Struct bonsaidb_core::admin::User
source · [−]pub struct User {
pub username: String,
pub groups: Vec<u64>,
pub roles: Vec<u64>,
pub argon_hash: Option<SensitiveString>,
}Expand description
A user that can authenticate with BonsaiDb.
Fields
username: StringThe name of the role. Must be unique.
groups: Vec<u64>The IDs of the user groups this user belongs to.
roles: Vec<u64>The IDs of the roles this user has been assigned.
argon_hash: Option<SensitiveString>The user’s stored password hash.
This field is not feature gated to prevent losing stored passwords if
the password-hashing feature is disabled and then re-enabled and user
records are updated in the meantime.
Implementations
Returns a default user with the given username.
pub async fn effective_permissions<C: Connection>(
&self,
admin: &C
) -> Result<Permissions, Error>
pub async fn effective_permissions<C: Connection>(
&self,
admin: &C
) -> Result<Permissions, Error>
Calculates the effective permissions based on the groups and roles this user is assigned.
Trait Implementations
The Id of this collection.
fn 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
type ByNameView = ByName
type ByNameView = ByName
The name view defined for the collection.
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,
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.
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,
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,
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>;Gets a CollectionDocument with id from connection.
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,
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
Auto Trait Implementations
impl RefUnwindSafe for User
impl UnwindSafe for User
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns the unique SchemaName for this schema.
Defines the Collections into schema.
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more