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 all commits
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(default, 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
7 changes: 7 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,12 @@ 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>,

/// Whether the user should be locked.
///
/// Defaults to false, or the current value if user already exists.
#[serde(skip_serializing_if = "Option::is_none")]
pub locked: Option<bool>,
}

#[response]
Expand Down Expand Up @@ -89,6 +95,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,

/// Whether to include locked users in the response.
///
/// 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>,

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