Add the ability to deactivate users in the MAS client

As we won't be able to deactivate them using the Synapse module API
This commit is contained in:
Andrew Morgan
2026-01-14 16:59:05 +00:00
parent 801d28f3ca
commit d0e17ae274
@@ -78,6 +78,17 @@ class MasAdminClient:
return device_id, access_token
async def deactivate_user(self, mas_user_id: str, token: str | None = None) -> None:
if token is None:
token = await self.request_admin_token()
url = self._build_admin_url(f"/api/admin/v1/users/{mas_user_id}/deactivate")
await self._api.http_client.post_json_get_json(
uri=url,
post_json={"skip_erase": True},
headers={"Authorization": [f"Bearer {token}"]},
)
async def request_admin_token(self) -> str:
url = self._build_oauth_url("/oauth2/token")
basic_auth = base64.b64encode(