Return suspended status when querying user account (#17952)

This commit is contained in:
Shay 2024-11-22 04:37:19 -08:00 committed by GitHub
parent 4c67d20af7
commit 4587decd67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 1 deletions

1
changelog.d/17952.misc Normal file
View file

@ -0,0 +1 @@
Return whether the user is suspended when querying the user account in the Admin API.

View file

@ -55,7 +55,8 @@ It returns a JSON body like the following:
} }
], ],
"user_type": null, "user_type": null,
"locked": false "locked": false,
"suspended": false
} }
``` ```

View file

@ -124,6 +124,7 @@ class AdminHandler:
"consent_ts": user_info.consent_ts, "consent_ts": user_info.consent_ts,
"user_type": user_info.user_type, "user_type": user_info.user_type,
"is_guest": user_info.is_guest, "is_guest": user_info.is_guest,
"suspended": user_info.suspended,
} }
if self._msc3866_enabled: if self._msc3866_enabled:

View file

@ -3222,6 +3222,7 @@ class UserRestTestCase(unittest.HomeserverTestCase):
self.assertIn("consent_ts", content) self.assertIn("consent_ts", content)
self.assertIn("external_ids", content) self.assertIn("external_ids", content)
self.assertIn("last_seen_ts", content) self.assertIn("last_seen_ts", content)
self.assertIn("suspended", content)
# This key was removed intentionally. Ensure it is not accidentally re-included. # This key was removed intentionally. Ensure it is not accidentally re-included.
self.assertNotIn("password_hash", content) self.assertNotIn("password_hash", content)