getAdminLockUser method
Gets information about the locked status of a particular server-local user.
The user calling this endpoint MUST be a server admin.
In order to prevent user enumeration, servers MUST ensure that authorization is checked prior to trying to do account lookups.
userId The user to look up.
returns locked:
Whether the target account is locked.
Implementation
Future<bool> getAdminLockUser(String userId) async {
final requestUri = Uri(
path: '_matrix/client/v1/admin/lock/${Uri.encodeComponent(userId)}',
);
final request = Request('GET', baseUri!.resolveUri(requestUri));
request.headers['authorization'] = 'Bearer ${bearerToken!}';
final response = await httpClient.send(request);
final responseBody = await response.stream.toBytes();
if (response.statusCode != 200) unexpectedResponse(response, responseBody);
final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString);
return json['locked'] as bool;
}