Found out where this was coming from. UCosmic tracks User and Person records separately. Every User must be connected to a Person, but not every Person needs to be connected to a User. So we can have People in the system who are not Users, but we cannot have a User who is not a Person.
When deleting a User, Doug had code in here to first delete the User, then delete the Person, as two separate transactions. What I believe happened here was that the User deletion transaction succeeded, but the Person deletion transaction failed. The reason that degrees, activities, etc, are showing up in the system is because that data is connected to the Person, not the User.
The correct solution here is not to delete the Person when deleting a User, but to instead disassociate them from their tenancy in the system. The Person record can be reused in other places. For example, say Halflants was a contact on a UWI agreement in addition to being a USF user. Deleting their Person record from the USF side would remove them from being an agreement contact on UWI's side, which should never happen. Instead the system should keep Halflants degrees, activities, etc in the system but disassociate them from USF. We can do this by removing their affiliations with USF and flagging them as inactive. The deletion of the user account and disassociation should also happen in a single transaction so that if one step in the process fails, the whole operation fails, without putting the data into an inconsistent state.
Found out where this was coming from. UCosmic tracks User and Person records separately. Every User must be connected to a Person, but not every Person needs to be connected to a User. So we can have People in the system who are not Users, but we cannot have a User who is not a Person.
When deleting a User, Doug had code in here to first delete the User, then delete the Person, as two separate transactions. What I believe happened here was that the User deletion transaction succeeded, but the Person deletion transaction failed. The reason that degrees, activities, etc, are showing up in the system is because that data is connected to the Person, not the User.
The correct solution here is not to delete the Person when deleting a User, but to instead disassociate them from their tenancy in the system. The Person record can be reused in other places. For example, say Halflants was a contact on a UWI agreement in addition to being a USF user. Deleting their Person record from the USF side would remove them from being an agreement contact on UWI's side, which should never happen. Instead the system should keep Halflants degrees, activities, etc in the system but disassociate them from USF. We can do this by removing their affiliations with USF and flagging them as inactive. The deletion of the user account and disassociation should also happen in a single transaction so that if one step in the process fails, the whole operation fails, without putting the data into an inconsistent state.