Add error status to user deletion api response if trying to delete a group owner
Problem to solve
If, via the user api, an automated process tries to delete a user that is a group owner, there is no feedback in the response that the user wasn't actually deleted. Response status is 204...which is the same as if it was successfully deleted (no indication of error in logs either)
Intended users
Proposal
Have the user deletion endpoint return a 409(?) status with the following body:
{
"message": "409 This user is currently a group owner. You must transfer ownership or delete these groups before you can delete this user."
}
Permissions and Security
Consistent with current permissions, admin only.
What does success look like, and how can we measure that?
Automated processes can successfully act or provide feedback to user deletion failures.
Links / references
Wikipedia: 409 Conflict Indicates that the request could not be processed because of conflict in the current state of the resource, such as an edit conflict between multiple simultaneous updates. Whenever a resource conflict would be caused by fulfilling the request. Duplicate entries and deleting root objects when cascade-delete is not supported are a couple of examples.
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_errors