AccountManager: Create account and username atomically

So far the account was created first and then in a second transaction
the external ID for the username was added. This meant that the account
creation needed to be rolled back if the creation of the external ID for
the username failed.

With this change the account and the external ID for the username are
now created within the same transaction.

ChangeUserName is now only used by PutUsername and hence it is merged
into this class.

Change-Id: I8f06f792b02331d10b943a52c6c890830087caec
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-12-29 15:52:43 +01:00
parent 0ecc845e43
commit c5ee0fe7b4
6 changed files with 92 additions and 201 deletions

View File

@@ -86,7 +86,6 @@ import com.google.gerrit.server.account.AccountManager;
import com.google.gerrit.server.account.AccountResolver;
import com.google.gerrit.server.account.AccountVisibilityProvider;
import com.google.gerrit.server.account.CapabilityCollection;
import com.google.gerrit.server.account.ChangeUserName;
import com.google.gerrit.server.account.EmailExpander;
import com.google.gerrit.server.account.GroupCacheImpl;
import com.google.gerrit.server.account.GroupControl;
@@ -419,7 +418,6 @@ public class GerritGlobalModule extends FactoryModule {
factory(VersionedAuthorizedKeys.Factory.class);
bind(AccountManager.class);
factory(ChangeUserName.Factory.class);
bind(new TypeLiteral<List<CommentLinkInfo>>() {})
.toProvider(CommentLinkProvider.class)