pub struct UserState {
pub id: Id,
card_id: Option<CardPseud>,
pub registration_date: Option<NumericDate>,
pub polymorphic_pseudonym: Triple,
pub banned: bool,
pub allow_login_by: HashSet<Id>,
pub could_be_banned_by: HashSet<Id>,
pub stored_objects: HashMap<Handle, UserObjectDetails>,
}Expand description
Details pubhubs central stores about a user’s account
Fields§
§id: IdRandomly generated identifier for this account, used for creating access tokens and such
card_id: Option<CardPseud>Used as registration pseudonym on pubhubs cards issued for to this user.
Might not be set for users that registered under v3.0.0, but will be upon entering pubhubs.
If not set, it’s derived from UserState::id, which is done by UserState::card_id().
registration_date: Option<NumericDate>Registration date for this user
Might not be set for users that registered under v3.0.0.
polymorphic_pseudonym: TripleRandomly generated and by Constellation::master_enc_key elgamal encrypted
identifier used to generate hub pseudonyms for this user.
banned: boolWhether this account is banned
allow_login_by: HashSet<Id>Attributes that may be used to log in as this user,
provided that AttrState::may_identify_user also points to this account.
The user may remove an attribute from this list.
could_be_banned_by: HashSet<Id>Attributes that when banned will ban this user
The user can only add attributes to this list, but not remove them.
This list is used to keep track of whether there is at least one attribute that would ban this user. If there are none, the user must add a bannable attribute before they can login in.
stored_objects: HashMap<Handle, UserObjectDetails>Details about the objects stored by this user at pubhubs central
Implementations§
Source§impl UserState
impl UserState
Sourcepub fn card_id(&self) -> CardPseud
pub fn card_id(&self) -> CardPseud
Returns UserState::card_id when available, and otherwise an Id derived from UserState::id.
Sourcepub(crate) fn update_quota(&self, quota: Quota) -> Result<Quota, QuotumName>
pub(crate) fn update_quota(&self, quota: Quota) -> Result<Quota, QuotumName>
Subtract quota usage from the given Quota, returning an error when a QuotumName was
reached.
Sourcepub(crate) fn into_user_version(self: UserState, app: &App) -> ApiUserState
pub(crate) fn into_user_version(self: UserState, app: &App) -> ApiUserState
Turns this UserState into a ApiUserState.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UserState
impl<'de> Deserialize<'de> for UserState
Source§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>,
Source§impl JsonObjectDetails for UserState
impl JsonObjectDetails for UserState
impl Eq for UserState
impl StructuralPartialEq for UserState
Auto Trait Implementations§
impl Freeze for UserState
impl RefUnwindSafe for UserState
impl Send for UserState
impl Sync for UserState
impl Unpin for UserState
impl UnsafeUnpin for UserState
impl UnwindSafe for UserState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ObjectDetails for Twhere
T: JsonObjectDetails,
impl<T> ObjectDetails for Twhere
T: JsonObjectDetails,
const PREFIX: &'static str = const PREFIX: &'_ str = <T as JsonObjectDetails>::PREFIX;
type Identifier = <T as JsonObjectDetails>::Identifier
fn object_id(&self) -> &<T as ObjectDetails>::Identifier
fn from_bytes(bytes: Bytes) -> Result<T, Error>
Source§fn to_put_payload(&self) -> Result<PutPayload, Error>
fn to_put_payload(&self) -> Result<PutPayload, Error>
bytes::Bytes