Files
gerrit/gerrit-acceptance-tests
Edwin Kempin 5af9f1e311 Also find accounts by preferred email
Historically (before change I2b3c5c9df) Gerrit was able to find accounts
by preferred email, even when the account had no external ID with that
email.

It turns out that the Gerrit integration with Google Accounts that is
used for Gerrit installations at Google depends on this feature. Each
Google Account can be associated with multiple email addresses, and one
is designated as "primary" email address. Users are intentionally
allowed to choose any of the email addresses that are associated with
their account as preferred email, not just the "primary" email address.
Because an ExternalId can store only a single email only the "primary"
email is part of the external ID and the secondary email addresses are
not stored in Gerrit's database. If a user chooses such a secondary
email address a preferred email we must ensure that its account is found
when a lookup by this secondary email is made. Hence we reenable the old
Gerrit behavior to also look for accounts with matching preferred email
when looking up accounts by email.

Change I757a4d065b added a new API to lookup accounts by email. Change
the implementation of these method to also find accounts by preferred
email.

To find accounts by preferred email use the the account index. To
prevent a circular dependency between the Accounts class and the
AccountCacheImpl.ByIdLoader class when using InternalAccountQuery the
methods to lookup accounts by email are moved to an own class.

As follow-up change I991d21b1ac adapts all Gerrit code to use the new
API for looking up accounts by email, so that the AccountByEmailCache
can be removed by change I3a4279f5ab.

Not being able to find (inconsistent) accounts by preferred email
currently blocks the migration of accounts to NoteDb.

Change-Id: I1c24da13786f81d6e59b0784586f0b53a16b0a28
Signed-off-by: Edwin Kempin <ekempin@google.com>
2017-08-08 14:06:53 +02:00
..