Mark <
gri...@mitsein.net> wrote:
> Somehow a user on my server has managed to register two accounts (months
> apart) with the same full name and preferred email. Gerrit will not let me
> add him to any reviews or groups - it says he is not a registered user.
> Autocompletion shows both accounts but once I hit submit I get the error
> lightbox.
>
>
> 1. How did this happen?
> - second login using putting his userid in upper case or vice versa?
Yea, that can cause it with LDAP auth.
> - Shouldn't there be a unique constraint on accounts:preferred_email?
Hmm. Probably. But its too late that point. You can only pick
values from preferred_email which are listed in the email_address
field of account_external_ids. If there is a duplicate there,
we already have this duplicate account scenario.
So the better question is, why isn't there a unique constraint on
the email_address field of account_external_ids? And the answer
is because users can have multiple OpenID accounts from different
authentication systems, but each using the same underlying email.
For LDAP auth environments, this makes no sense though.
> 2. How can I fix?
Use the merge script on the wiki:
http://groups.google.com/group/repo-discuss/web/merging-gerrit-user-accounts
> - Hopefully one account is not attached to anything and I can just
> remove it.
That merge script will replace the from_id with to_id throughout
the database, so if he was attached to anything, it'll carry over
to the account you keep.
> 3. How can I prevent?
I think a few folks have tried installing a trigger in their database
to ensure lowercase on external_id column of account_external_ids
table. I don't know how successful that has been.