Skip to content

Commit

Permalink
Return suspended status when querying user account (#17952)
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay authored Nov 22, 2024
1 parent 4c67d20 commit 4587dec
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/17952.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return whether the user is suspended when querying the user account in the Admin API.
3 changes: 2 additions & 1 deletion docs/admin_api/user_admin_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ It returns a JSON body like the following:
}
],
"user_type": null,
"locked": false
"locked": false,
"suspended": false
}
```

Expand Down
1 change: 1 addition & 0 deletions synapse/handlers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ async def get_user(self, user: UserID) -> Optional[JsonMapping]:
"consent_ts": user_info.consent_ts,
"user_type": user_info.user_type,
"is_guest": user_info.is_guest,
"suspended": user_info.suspended,
}

if self._msc3866_enabled:
Expand Down
1 change: 1 addition & 0 deletions tests/rest/admin/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3222,6 +3222,7 @@ def _check_fields(self, content: JsonDict) -> None:
self.assertIn("consent_ts", content)
self.assertIn("external_ids", content)
self.assertIn("last_seen_ts", content)
self.assertIn("suspended", content)

# This key was removed intentionally. Ensure it is not accidentally re-included.
self.assertNotIn("password_hash", content)
Expand Down

0 comments on commit 4587dec

Please sign in to comment.