SpeciesFileGroup / taxonworks

Workbench for biodiversity informatics.
http://taxonworks.org
Other
87 stars 26 forks source link

As a admin I need code to merge 2 users #3537

Open mjy opened 1 year ago

mjy commented 1 year ago

Something like: User.find(1).merge_into(2)

Wrap everything in a transaction.

In the same way we check for whether a User curates_data? loop through records updating created and/or updated_by ids from one to another.

Do a second pass on the user that is being "removed" to ensure they have no data.

Use a column update, i.e. don't touch timestamps (or maybe we should, unsure).

Do not destroy the user in the method that updates the data.

Do not update User attributes from one user to another, just leave it to edit those back in as needed?

Return the id of the the user being removed.

LocoDelAssembly commented 1 year ago

[ ] Double check Project::MANIFEST is up-to date

Can be marked completed if that means to check all models are there.

LocoDelAssembly commented 1 year ago

In the same way we check for whether a User curates_data? loop through records updating created and/or updated_by ids from one to another.

@mjy what about community data? #curates_data? checks for project data only. Or is this an example but in reality I have to iterate over ActiveRecord tables and change created_by_id and updated_by_id (each field only if matches user that loses attribution of data)?

mjy commented 1 year ago

Yes, we need to handle community data too.

mjy commented 2 weeks ago

Tagging in https://github.com/SpeciesFileGroup/taxonworks/issues/970