updateUserActive method
- String userId,
- MmUpdateUserActiveRequest mmUpdateUserActiveRequest
Update user active status
Update user active or inactive status. Since server version 4.6, users using a SSO provider to login can be activated or deactivated with this endpoint. However, if their activation status in Mattermost does not reflect their status in the SSO provider, the next synchronization or login by that user will reset the activation status to that of their account in the SSO provider. Server versions 4.5 and before do not allow activation or deactivation of SSO users from this endpoint. ##### Permissions User can deactivate themselves. User with manage_system
permission can activate or deactivate a user.
Parameters:
-
String userId (required): User GUID
-
MmUpdateUserActiveRequest mmUpdateUserActiveRequest (required): Use
true
to set the user active,false
for inactive
Implementation
Future<MmStatusOK?> updateUserActive(
String userId,
MmUpdateUserActiveRequest mmUpdateUserActiveRequest,
) async {
final response = await updateUserActiveWithHttpInfo(
userId,
mmUpdateUserActiveRequest,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'MmStatusOK',
) as MmStatusOK;
}
return null;
}