Migrate external IDs to NoteDb (part 3)
This is the third part of migrating external IDs from ReviewDb to NoteDb. This change: * changes the code to always read external IDs from NoteDb (the user.readExternalIdsFromGit configuration parameter is removed) * bumps the database schema version * deletes the database table for external IDs Pushing to the refs/meta/external-ids branch is still prevented by a commit validator. Since all external IDs are now in NoteDb only we could allow pushing to refs/meta/external-ids. However we would still like to do validation of the branch content and reject invalid content (e.g. invalid Git config files, usage of non-existing account IDs etc.) and such a validator is not implemented yet (but can be implemented in a follow-up change). Change-Id: Id9e5574a1d8d82f4f48fbb0b6dadc0e27d138a28 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -22,7 +22,6 @@ import com.google.gerrit.extensions.common.AccountExternalIdInfo;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||
import com.google.gerrit.server.account.externalids.ExternalIds;
|
||||
@@ -38,18 +37,12 @@ import java.util.List;
|
||||
|
||||
@Singleton
|
||||
public class GetExternalIds implements RestReadView<AccountResource> {
|
||||
private final Provider<ReviewDb> db;
|
||||
private final ExternalIds externalIds;
|
||||
private final Provider<CurrentUser> self;
|
||||
private final AuthConfig authConfig;
|
||||
|
||||
@Inject
|
||||
GetExternalIds(
|
||||
Provider<ReviewDb> db,
|
||||
ExternalIds externalIds,
|
||||
Provider<CurrentUser> self,
|
||||
AuthConfig authConfig) {
|
||||
this.db = db;
|
||||
GetExternalIds(ExternalIds externalIds, Provider<CurrentUser> self, AuthConfig authConfig) {
|
||||
this.externalIds = externalIds;
|
||||
this.self = self;
|
||||
this.authConfig = authConfig;
|
||||
@@ -62,7 +55,7 @@ public class GetExternalIds implements RestReadView<AccountResource> {
|
||||
throw new AuthException("not allowed to get external IDs");
|
||||
}
|
||||
|
||||
Collection<ExternalId> ids = externalIds.byAccount(db.get(), resource.getUser().getAccountId());
|
||||
Collection<ExternalId> ids = externalIds.byAccount(resource.getUser().getAccountId());
|
||||
if (ids.isEmpty()) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
Reference in New Issue
Block a user