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