synapse_admin_api/
users.rs

1//! Endpoints in the `/_synapse/admin/v<x>/users/` scope.
2
3pub mod create_or_modify;
4pub mod get_details;
5pub mod is_user_admin;
6pub mod list_joined_rooms;
7pub mod list_users;
8pub mod reset_password;
9
10use ruma::{thirdparty::ThirdPartyIdentifier, SecondsSinceUnixEpoch};
11use serde::{Deserialize, Serialize};
12
13/// User details
14#[derive(Serialize, Deserialize, Clone, Debug)]
15pub struct UserDetails {
16    /// The user's name.
17    pub name: String,
18
19    /// The password hash of the account
20    pub password_hash: Option<String>,
21
22    /// Is the account a guest
23    #[serde(deserialize_with = "crate::serde::bool_or_uint")]
24    pub is_guest: bool,
25
26    /// Is the user a server admin
27    #[serde(deserialize_with = "crate::serde::bool_or_uint")]
28    pub admin: bool,
29
30    /// todo: doc but I do not know what this is
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub consent_version: Option<String>,
33
34    /// todo: doc but I do not know what this is
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub consent_server_notice_sent: Option<bool>,
37
38    /// todo: doc but I do not know what this is
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub appservice_id: Option<String>,
41
42    /// creation date for the account
43    // todo: how to get rid of this option?
44    pub creation_ts: Option<SecondsSinceUnixEpoch>,
45
46    /// todo: doc but I do not know what this is
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub user_type: Option<String>,
49
50    /// Is the account deactivated
51    #[serde(deserialize_with = "crate::serde::bool_or_uint")]
52    pub deactivated: bool,
53
54    /// The user's display name, if set.
55    pub displayname: String,
56
57    /// The user's avatar URL, if set.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub avatar_url: Option<String>,
60
61    /// A list of third party identifiers the homeserver has associated with the user.
62    #[serde(default, skip_serializing_if = "Vec::is_empty")]
63    pub threepids: Vec<ThirdPartyIdentifier>,
64
65    /// A list of external auth identifiers the homeserver has associated with the user.
66    #[serde(default, skip_serializing_if = "Vec::is_empty")]
67    pub external_ids: Vec<ExternalId>,
68
69    /// Is the account locked
70    #[serde(default, deserialize_with = "crate::serde::bool_or_uint")]
71    pub locked: bool,
72}
73
74/// An external ID associated with a user
75#[derive(Clone, Debug, Deserialize, Serialize)]
76pub struct ExternalId {
77    /// The authentication provider to which the user is associated.
78    pub auth_provider: String,
79
80    /// The ID known to the auth provider associated with this user.
81    pub external_id: String,
82}