#[non_exhaustive]pub struct KeyRecord {
pub id: String,
pub name: String,
pub hash: String,
pub email: Option<String>,
pub groups: Vec<String>,
pub disabled: bool,
pub made_unix: Option<i64>,
pub expires_unix: Option<i64>,
}Expand description
One key account as a [Table] keeps it, keyed by name.
It derives guatiao’s ToValue, FromValue and Schema, so a [Table] may keep it in
any format.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: StringStable identity; what a [Verdict::Valid] lookup names.
name: StringThe account name; unique in the table.
hash: StringWhat is kept of the key: sha256:<hex> or an Argon2id hash, as [KeyHash::hash]
writes it. One table may mix both.
email: Option<String>Email address.
groups: Vec<String>Directory groups.
disabled: boolA disabled key is not taken.
made_unix: Option<i64>When it was made, in seconds since the Unix epoch.
expires_unix: Option<i64>When it stops being taken, in seconds since the Unix epoch.
Implementations§
Source§impl KeyRecord
impl KeyRecord
Sourcepub fn new(
id: impl Into<String>,
name: impl Into<String>,
hash: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, name: impl Into<String>, hash: impl Into<String>, ) -> Self
An enabled key account with no groups. hash comes from [KeyHash::hash].
Sourcepub fn groups(self, groups: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn groups(self, groups: impl IntoIterator<Item = impl Into<String>>) -> Self
Sets the directory groups.
Sourcepub fn expires_unix(self, expires: i64) -> Self
pub fn expires_unix(self, expires: i64) -> Self
Sets when the key stops being taken.
Trait Implementations§
impl Eq for KeyRecord
Source§impl FromValue for KeyRecord
impl FromValue for KeyRecord
Source§const KINDS: Kinds = ::coqui_access::guatiao::Kinds::MAP
const KINDS: Kinds = ::coqui_access::guatiao::Kinds::MAP
The kinds
from_value may accept; any
other is refused. Every impl in this crate and every derived one
says; the default, [Kinds::ANY], claims every kind, which keeps
a type that does not say out of an enum told apart by kind.Source§fn from_value(__value: &Value) -> Result<Self, MapError>
fn from_value(__value: &Value) -> Result<Self, MapError>
Performs the conversion. Read more
Source§impl Schema for KeyRecord
impl Schema for KeyRecord
impl StructuralPartialEq for KeyRecord
Auto Trait Implementations§
impl Freeze for KeyRecord
impl RefUnwindSafe for KeyRecord
impl Send for KeyRecord
impl Sync for KeyRecord
impl Unpin for KeyRecord
impl UnsafeUnpin for KeyRecord
impl UnwindSafe for KeyRecord
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.