Skip to main content

IUserService.DeactivateUser

Reference​

void DeactivateUser(Guid userId)

Use the DeactivateUser method to deactivate a user by their user id or user profile type instance id.

Parameters​

  • userId: The unique Guid for a Protrak user or Protrak user profile type instance. This id can be used to fetch the details of protrak user or user profile type instance.

Returns​

This method does not return a value.

Caveats​

  • This API deactivates the specified Protrak user account.
  • It creates an asynchronous job to manage instance access to the given protrak user account.
  • This API can only be used by:
    • Admin account type users
    • Users with roles that have ActivatedDeactivateUser permission.

Usage​

  • Deactivating by User Id
UserService.DeactivateUser(userId);
  • Deactivating by User Profile Type Instance Id
UserService.DeactivateUser(userProfileTypeInstanceId);

Troubleshooting​

  • If the context user account type is non-admin and user's roles do not include the ActivateDeactivateUser permissions, a Prorigo.Core.Exceptions.UnauthorizedException is thrown. Based on the business logic, developer may need to catch this exception to handle the scenario appropriately.