Struct medal::db_objects::SessionUser

source ·
pub struct SessionUser {
Show 28 fields pub id: i32, pub session_token: Option<String>, pub csrf_token: String, pub last_login: Option<Timespec>, pub last_activity: Option<Timespec>, pub account_created: Option<Timespec>, pub username: Option<String>, pub password: Option<String>, pub salt: Option<String>, pub logincode: Option<String>, pub email: Option<String>, pub email_unconfirmed: Option<String>, pub email_confirmationcode: Option<String>, pub firstname: Option<String>, pub lastname: Option<String>, pub street: Option<String>, pub zip: Option<String>, pub city: Option<String>, pub nation: Option<String>, pub grade: i32, pub sex: Option<i32>, pub anonymous: bool, pub is_admin: Option<bool>, pub is_teacher: bool, pub managed_by: Option<i32>, pub school_name: Option<String>, pub oauth_foreign_id: Option<String>, pub oauth_provider: Option<String>,
}

Fields§

§id: i32§session_token: Option<String>§csrf_token: String§last_login: Option<Timespec>§last_activity: Option<Timespec>§account_created: Option<Timespec>§username: Option<String>§password: Option<String>§salt: Option<String>§logincode: Option<String>§email: Option<String>§email_unconfirmed: Option<String>§email_confirmationcode: Option<String>§firstname: Option<String>§lastname: Option<String>§street: Option<String>§zip: Option<String>§city: Option<String>§nation: Option<String>§grade: i32§sex: Option<i32>§anonymous: bool§is_admin: Option<bool>§is_teacher: bool§managed_by: Option<i32>§school_name: Option<String>§oauth_foreign_id: Option<String>§oauth_provider: Option<String>

Implementations§

source§

impl SessionUser

source

pub fn minimal(id: i32, session_token: String, csrf_token: String) -> Self

source

pub fn group_user_stub() -> Self

source

pub fn is_alive(&self) -> bool

source

pub fn is_logged_in(&self) -> bool

source

pub fn is_teacher(&self) -> bool

source

pub fn is_admin(&self) -> bool

source

pub fn ensure_alive(self) -> Option<Self>

source

pub fn ensure_logged_in(self) -> Option<Self>

source

pub fn ensure_teacher(self) -> Option<Self>

source

pub fn ensure_admin(self) -> Option<Self>

source

pub fn ensure_teacher_or_admin(self) -> Option<Self>

Trait Implementations§

source§

impl Clone for SessionUser

source§

fn clone(&self) -> SessionUser

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SessionUser

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl SetPassword for SessionUser

source§

fn set_password(&mut self, password: &str) -> Option<()>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T> AsTaggedExplicit<'a> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self>

§

impl<'a, T> AsTaggedImplicit<'a> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneAny for T
where T: Any + Clone,

§

fn clone_any(&self) -> Box<dyn CloneAny>

§

fn clone_any_send(&self) -> Box<dyn CloneAny + Send>
where T: Send,

§

fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync>
where T: Sync,

§

fn clone_any_send_sync(&self) -> Box<dyn CloneAny + Sync + Send>
where T: Send + Sync,

source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PersistentInto<Arc<Mutex<T>>> for T

§

fn persistent_into(self) -> Arc<Mutex<T>>

Convert self into a value of type T.
§

impl<T> PersistentInto<Arc<RwLock<T>>> for T

§

fn persistent_into(self) -> Arc<RwLock<T>>

Convert self into a value of type T.
§

impl<T> PersistentInto<Arc<T>> for T

§

fn persistent_into(self) -> Arc<T>

Convert self into a value of type T.
§

impl<T> PersistentInto<T> for T

§

fn persistent_into(self) -> T

Convert self into a value of type T.
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Err = <U as TryFrom<T>>::Err

§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Err>

§

impl<T> Typeable for T
where T: Any,

§

fn get_type(&self) -> TypeId

Get the TypeId of this object.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> DebugAny for T
where T: Any + Debug,

§

impl<T> UnsafeAny for T
where T: Any,