I have a script that iterates a list of Portal usernames, searches for them, and deletes the account. I THOUGHT if a user owned a group it would cause the delete user method to fail.
What I think happened when I ran my script was if the user owned a group, it went and unshared all the items in the group, deleted the group and then the user.
Am I crazy or is that how its supposed to work??
There are two ways to delete users. One is User.delete(), which lets you optionally supply a reassign_to parameter to move all their content to another user first.
The second is UserManager.delete_users(), but that method will only work if the user owns no content.
If you did not supply a "reassign_to" parameter, or were using the second method, the delete should have failed. Can you confirm if your script does this?
My script used the first method user.delete and I didn't use the reassign parameter. I thought that would prevent it from deleting any users that owned a group. I had to recover the groups that were deleted. I am going to run my script again and try the reassign parameter this time. fingers crossed.