Add an AccountsUpdate class to update accounts from a single class
As a first step AccountsUpdate is only responsible for creating new accounts. Additional functionality to update accounts will be added later. This is another step towards migrating accounts from ReviewDb to NoteDb. In the end all code that needs to update accounts should use AccountsUpdate. AccountsUpdate can then take care to update the accounts in ReviewDb and NoteDb. Change-Id: I77e3a664e23bfa579da7da7c1e86823e7ad905eb Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -69,6 +69,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
private final VersionedAuthorizedKeys.Accessor authorizedKeys;
|
||||
private final SshKeyCache sshKeyCache;
|
||||
private final AccountCache accountCache;
|
||||
private final AccountsUpdate accountsUpdate;
|
||||
private final AccountIndexer indexer;
|
||||
private final AccountByEmailCache byEmailCache;
|
||||
private final AccountLoader.Factory infoLoader;
|
||||
@@ -86,6 +87,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
VersionedAuthorizedKeys.Accessor authorizedKeys,
|
||||
SshKeyCache sshKeyCache,
|
||||
AccountCache accountCache,
|
||||
AccountsUpdate accountsUpdate,
|
||||
AccountIndexer indexer,
|
||||
AccountByEmailCache byEmailCache,
|
||||
AccountLoader.Factory infoLoader,
|
||||
@@ -100,6 +102,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
this.authorizedKeys = authorizedKeys;
|
||||
this.sshKeyCache = sshKeyCache;
|
||||
this.accountCache = accountCache;
|
||||
this.accountsUpdate = accountsUpdate;
|
||||
this.indexer = indexer;
|
||||
this.byEmailCache = byEmailCache;
|
||||
this.infoLoader = infoLoader;
|
||||
@@ -172,7 +175,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
Account a = new Account(id, TimeUtil.nowTs());
|
||||
a.setFullName(input.name);
|
||||
a.setPreferredEmail(input.email);
|
||||
db.accounts().insert(Collections.singleton(a));
|
||||
accountsUpdate.insert(db, a);
|
||||
|
||||
for (AccountGroup.Id groupId : groups) {
|
||||
AccountGroupMember m = new AccountGroupMember(new AccountGroupMember.Key(id, groupId));
|
||||
|
||||
Reference in New Issue
Block a user