Hi everyone,
"This is a good place to be if you're interested in undoing the damage done when the same person registers twice with two different email addresses or We can have duplicated accounts since more than one system manage one user account as different person"
The aim is that one person has to have only one account.
So, we have three scenarios:
1. Merge the Applications Items :
----------------------------------
We have to move the items of each package (faqs,news, bboards, etc...) that the duplicated account owns to the good account. In this scenario, we have two possibles solutions : Service Contracts or Dynamic Queries.
1.1. Service Contracts : Here we need to write the implementation per each package. For example, if we want to merge faq, faq should have a procedure to change the owner of all the faqs.
1.2. Dynamic Queries: In this solution we avoid to write service contracts and their implementations but we need to use the pg_* system tables, for example : pg_contraint, pg_class, pg_attribute. The aim here is to look for all the childs (foreign keys) that acs_objects.object_id has, get the column and table name from pg_* tables and make the query to update each row.
2. Merge the memberships:
--------------------------
Where does the duplicad account belong to? Which groups?. Here we need to change the relationships/memberships, adding the good account to the groups that the duplicated account belongs to, then delete the relations between the duplicated account and its groups.
3. Delete the duplicated account:
----------------------------------
This could be an update of the user_state setting it to the state 'deleted' or doing a really 'nuke' of the account, deleting each row of each table that has relation with the bad account.
Please, if you have questions or sugestions, I would appreciate them :).
Regards,
Enrique.