Deactivate() [ServiceManager]
Deactivate a user
Description
This method deactivates a user from a service immediately
Organization Id is optional.
For future deactivation, the user will be deactivated on the provided date. Default date for deactivation is set
to next date. Deactivation date should be greater than the current date.
Package Details
Interface
IServiceManager
Syntax
IServiceManager.Deactivate(int userId, int serviceId, int? organizationId = null)
IServiceManager.Deactivate(UserFutureDeactivation userFutureDeactivation)
Returns
Nothing
API Endpoint
Implementation Notes
Internal users must not be associated with any organizations.
POST
/api/v1/services/{serviceId}/deactivate-user?userId={userId}&organizationId={organizationId}
/api/v1/services/deactivate-user
Parameters
Parameter | Description | Parameter Type |
---|---|---|
serviceId | Service Id | Path |
userId | User iId | Query string |
organizationId (Optional) | Organization Id (Optional) | Query string |
Returns
On success, 200 Ok
On error, 400 Bad Request
On authorization error, 403 Forbidden
Example
int id = 2;
int userId = 2757;
int organizationId = 5950;
if (organizationId.HasValue){
await _serviceManager.Deactivate(userId, id, organizationId.Value);
}
else{
await _serviceManager.Deactivate(userId, id);
}
Example
var userFutureDeactivation = new UserFutureDeactivation
{
UserId = 2757,
ServiceId = 2,
DateTime = 2021-05-20
}
await _serviceManager.Deactivate(userFutureDeactivation);