authentik_rust/models/
user_group.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/// UserGroup : Simplified Group Serializer for user's groups
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct UserGroup {
16    #[serde(rename = "pk")]
17    pub pk: uuid::Uuid,
18    /// Get a numerical, int32 ID for the group
19    #[serde(rename = "num_pk")]
20    pub num_pk: i32,
21    #[serde(rename = "name")]
22    pub name: String,
23    /// Users added to this group will be superusers.
24    #[serde(rename = "is_superuser", skip_serializing_if = "Option::is_none")]
25    pub is_superuser: Option<bool>,
26    #[serde(rename = "parent", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub parent: Option<Option<uuid::Uuid>>,
28    #[serde(rename = "parent_name")]
29    pub parent_name: String,
30    #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
31    pub attributes: Option<std::collections::HashMap<String, serde_json::Value>>,
32}
33
34impl UserGroup {
35    /// Simplified Group Serializer for user's groups
36    pub fn new(pk: uuid::Uuid, num_pk: i32, name: String, parent_name: String) -> UserGroup {
37        UserGroup {
38            pk,
39            num_pk,
40            name,
41            is_superuser: None,
42            parent: None,
43            parent_name,
44            attributes: None,
45        }
46    }
47}
48