We had an internal user directory, then a while later we enabled the LDAP integration. For some users, we used their domain user ID as their JIRA login, so moving to LDAP was easy. For other users, we used their e-mail address as their JIRA login.
If we rename a user's internal account to match their domain user ID before they log in for the first time using LDAP, then when they login to Jira, JIRA does some magic and links/merges the accounts so that they can login using their domain user ID (LDAP) and still see all their old issues assigned to them (to the new LDAP account).
However, if they login with their domain account before we've renamed their internal account to match the domain one, no merging happens. They end up with 2 separate user IDs, with separate issues.
I've been looking to see if I can recreate the merging, but I'm missing something somewhere.
Both user IDs are in cwd_user, and I think it does the merging/mapping using app_user, since this table changes when you rename a user through the Jira UI, and it appears to follow a logic where it appends "#n" to the end of the lowercase user ID, so JIRA 'knows' they are all for one human.
user_key contains the userID from app_user or an internally-generated id for this table, and lower_user_name contains the userID that this user_key maps to. For users with multiple accounts, lower_user_name contains the userID suffixed with "#1", "#2" etc. It makes sense to me that if a user had an internal account, then they get another account using LDAP, that it's this table that allows the issues assigned to their internal accounts to be 'merged' or seen as being for the same userID when they login using LDAP.
But in the cases where the user logged in using LDAP before we had renamed their internal account ID to match it, if I update app_user to append the next sequential number to the user id, this doesn't make JIRA display all the issue records when that user logs in, so there's obviously some other entry elsewhere which I'm missing.
e.g. if we have two entries in app_user
user_key="bill1@space.com" and lower_user_name="bill1"
user_key="bill1" and lower_user_name="bill1#1"
I would expect (from my logic) that logging in with LDAP account "bill1", the user sees issues associated with both accounts. But this doesn't happen. Is there another table containing details used to 'merge' the userIDs?