authentik_rust/models/
user.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2024.2.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13/// User : User Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct User {
16    #[serde(rename = "pk")]
17    pub pk: i32,
18    #[serde(rename = "username")]
19    pub username: String,
20    /// User's display name.
21    #[serde(rename = "name")]
22    pub name: String,
23    /// Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
24    #[serde(rename = "is_active", skip_serializing_if = "Option::is_none")]
25    pub is_active: Option<bool>,
26    #[serde(rename = "last_login", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub last_login: Option<Option<String>>,
28    #[serde(rename = "is_superuser")]
29    pub is_superuser: bool,
30    #[serde(rename = "groups", skip_serializing_if = "Option::is_none")]
31    pub groups: Option<Vec<uuid::Uuid>>,
32    #[serde(rename = "groups_obj")]
33    pub groups_obj: Vec<models::UserGroup>,
34    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
35    pub email: Option<String>,
36    /// User's avatar, either a http/https URL or a data URI
37    #[serde(rename = "avatar")]
38    pub avatar: String,
39    #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
40    pub attributes: Option<std::collections::HashMap<String, serde_json::Value>>,
41    #[serde(rename = "uid")]
42    pub uid: String,
43    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
44    pub path: Option<String>,
45    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
46    pub r#type: Option<models::UserTypeEnum>,
47    #[serde(rename = "uuid")]
48    pub uuid: uuid::Uuid,
49}
50
51impl User {
52    /// User Serializer
53    pub fn new(pk: i32, username: String, name: String, is_superuser: bool, groups_obj: Vec<models::UserGroup>, avatar: String, uid: String, uuid: uuid::Uuid) -> User {
54        User {
55            pk,
56            username,
57            name,
58            is_active: None,
59            last_login: None,
60            is_superuser,
61            groups: None,
62            groups_obj,
63            email: None,
64            avatar,
65            attributes: None,
66            uid,
67            path: None,
68            r#type: None,
69            uuid,
70        }
71    }
72}
73