Skip to main content

authentik_client/models/
user_self.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2026.2.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// UserSelf : User Serializer for information a user can retrieve about themselves
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct UserSelf {
17    #[serde(rename = "pk")]
18    pub pk: i32,
19    /// Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
20    #[serde(rename = "username")]
21    pub username: String,
22    /// User's display name.
23    #[serde(rename = "name")]
24    pub name: String,
25    /// Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
26    #[serde(rename = "is_active")]
27    pub is_active: bool,
28    #[serde(rename = "is_superuser")]
29    pub is_superuser: bool,
30    #[serde(rename = "groups")]
31    pub groups: Vec<models::UserSelfGroups>,
32    #[serde(rename = "roles")]
33    pub roles: Vec<models::UserSelfRoles>,
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 = "uid")]
40    pub uid: String,
41    /// Get user settings with brand and group settings applied
42    #[serde(rename = "settings")]
43    pub settings: std::collections::HashMap<String, serde_json::Value>,
44    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
45    pub r#type: Option<models::UserTypeEnum>,
46    /// Get all system permissions assigned to the user
47    #[serde(rename = "system_permissions")]
48    pub system_permissions: Vec<String>,
49}
50
51impl UserSelf {
52    /// User Serializer for information a user can retrieve about themselves
53    pub fn new(
54        pk: i32,
55        username: String,
56        name: String,
57        is_active: bool,
58        is_superuser: bool,
59        groups: Vec<models::UserSelfGroups>,
60        roles: Vec<models::UserSelfRoles>,
61        avatar: String,
62        uid: String,
63        settings: std::collections::HashMap<String, serde_json::Value>,
64        system_permissions: Vec<String>,
65    ) -> UserSelf {
66        UserSelf {
67            pk,
68            username,
69            name,
70            is_active,
71            is_superuser,
72            groups,
73            roles,
74            email: None,
75            avatar,
76            uid,
77            settings,
78            r#type: None,
79            system_permissions,
80        }
81    }
82}