pub struct User {Show 31 fields
pub id: Id,
pub created: u128,
pub username: String,
pub password: String,
pub salt: String,
pub settings: UserSettings,
pub tokens: Vec<Token>,
pub legacy_permissions: i32,
pub is_verified: bool,
pub notification_count: usize,
pub follower_count: usize,
pub following_count: usize,
pub last_seen: u128,
pub totp: String,
pub recovery_codes: Vec<String>,
pub post_count: usize,
pub request_count: usize,
pub connections: UserConnections,
pub stripe_id: String,
pub grants: Vec<AuthGrant>,
pub associated: Vec<Id>,
pub achievements: Vec<Achievement>,
pub ban_reason: String,
pub is_deactivated: bool,
pub ban_expire: u128,
pub checkouts: Vec<String>,
pub last_policy_consent: u128,
pub missed_messages_count: usize,
pub views: usize,
pub shrimpcamp_link: usize,
pub permissions: PermissionsContainer,
}Fields§
§id: Id§created: u128§username: String§password: String§salt: String§settings: UserSettings§tokens: Vec<Token>§legacy_permissions: i32§is_verified: bool§notification_count: usize§follower_count: usize§following_count: usize§last_seen: u128§totp: StringThe TOTP secret for this profile. An empty value means the user has TOTP disabled.
recovery_codes: Vec<String>The TOTP recovery codes for this profile.
post_count: usize§request_count: usize§connections: UserConnectionsExternal service connection details.
stripe_id: StringThe user’s Stripe customer ID.
grants: Vec<AuthGrant>The grants associated with the user’s account.
associated: Vec<Id>A list of the IDs of all accounts the user has signed into through the UI.
achievements: Vec<Achievement>Users collect achievements through little actions across the site.
ban_reason: StringThe reason the user was banned.
is_deactivated: boolIf the user is deactivated. Deactivated users act almost like deleted users, but their data is not wiped.
ban_expire: u128The time at which the user’s ban will automatically expire.
checkouts: Vec<String>The IDs of Stripe checkout sessions that this user has successfully completed.
This should be checked BEFORE applying purchases to ensure that the user hasn’t already applied this purchase.
last_policy_consent: u128The time in which the user last consented to the site’s policies.
missed_messages_count: usizeThe number of messages this user has missed.
views: usizeThe number of unique authenticated users who have viewed this user’s profile.
shrimpcamp_link: usizeThe ID of the Shrimpcamp account the user is linked to.
permissions: PermissionsContainerImplementations§
Source§impl User
impl User
Sourcepub fn create_token(ip: &str) -> (String, Token)
pub fn create_token(ip: &str) -> (String, Token)
Sourcepub fn check_password(&self, against: String) -> bool
pub fn check_password(&self, against: String) -> bool
Check if the given password is correct for the user.
Sourcepub fn parse_mentions(input: &str) -> Vec<String>
pub fn parse_mentions(input: &str) -> Vec<String>
Parse user mentions in a given input.
Sourcepub fn totp(&self, issuer: Option<String>) -> Option<TOTP>
pub fn totp(&self, issuer: Option<String>) -> Option<TOTP>
Get a TOTP from the profile’s totp secret value.
Sourcepub fn get_grant_by_app_id(&self, id: &Id) -> Option<&AuthGrant>
pub fn get_grant_by_app_id(&self, id: &Id) -> Option<&AuthGrant>
Get a grant from the user given the grant’s app ID.
Should be used before adding another grant (to ensure the app doesn’t already have a grant for this user).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for User
impl<'de> Deserialize<'de> for User
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>,
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnsafeUnpin for User
impl UnwindSafe for User
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<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 more