Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add locked users property #22

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ pub struct UserDetails {
/// 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>,

/// Is the account locked
#[serde(deserialize_with = "crate::serde::bool_or_uint")]
pub locked: bool,
jplatte marked this conversation as resolved.
Show resolved Hide resolved
}

/// An external ID associated with a user
Expand Down
6 changes: 6 additions & 0 deletions src/users/create_or_modify/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ pub struct Request {
/// defaults to false, or the current value if user already exists
#[serde(skip_serializing_if = "Option::is_none")]
pub deactivated: Option<bool>,

/// Should the user be locked
/// defaults to false, or the current value if user already exists
hanadi92 marked this conversation as resolved.
Show resolved Hide resolved
#[serde(skip_serializing_if = "Option::is_none")]
pub locked: Option<bool>,
}

#[response]
Expand Down Expand Up @@ -89,6 +94,7 @@ impl Request {
avatar_url: None,
admin: None,
deactivated: None,
locked: None,
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/users/list_users/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ pub struct Request {
#[serde(default, skip_serializing_if = "ruma::serde::is_default")]
#[ruma_api(query)]
pub deactivated: bool,

/// The parameter locked is optional and if true will include locked users.
hanadi92 marked this conversation as resolved.
Show resolved Hide resolved
///
/// Defaults to false to exclude locked users.
#[serde(default, skip_serializing_if = "ruma::serde::is_default")]
#[ruma_api(query)]
pub locked: bool,
}

#[response]
Expand Down Expand Up @@ -116,4 +123,8 @@ pub struct UserMinorDetails {
/// The user's avatar URL, if set.
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar_url: Option<String>,

/// Is the account locked
hanadi92 marked this conversation as resolved.
Show resolved Hide resolved
#[serde(deserialize_with = "crate::serde::bool_or_uint")]
jplatte marked this conversation as resolved.
Show resolved Hide resolved
pub locked: bool,
jplatte marked this conversation as resolved.
Show resolved Hide resolved
}