Remove unused dbProvider field from IdentifiedUser

This field is also no longer used in some factory methods, which means
many callers need to get updated as well. One side effect is to
consolidate many of the GenericFactory#create methods. This in turn
means that the remote peer provider is never null; previously the code
was treating a null Provider and a Provider that returns null
identically, so this should have no behavior change.

Change-Id: I107fcfbd1a1d8daa15ee3afc02c8e7e709ffb3ea
This commit is contained in:
Andrew Bonventre
2016-05-16 12:07:42 -07:00
committed by Dave Borowitz
parent 1766703b05
commit 0f8b4118b7
17 changed files with 47 additions and 94 deletions

View File

@@ -169,7 +169,7 @@ public class GerritPublicKeyChecker extends PublicKeyChecker {
if (extId == null) {
return CheckResult.bad("Key is not associated with any users");
}
IdentifiedUser user = userFactory.create(db, extId.getAccountId());
IdentifiedUser user = userFactory.create(extId.getAccountId());
Set<String> allowedUserIds = getAllowedUserIds(user);
if (allowedUserIds.isEmpty()) {
return CheckResult.bad("No identities found for user");

View File

@@ -151,12 +151,12 @@ public class GerritPublicKeyCheckerTest {
private IdentifiedUser addUser(String name) throws Exception {
AuthRequest req = AuthRequest.forUser(name);
Account.Id id = accountManager.authenticate(req).getAccountId();
return userFactory.create(Providers.of(db), id);
return userFactory.create(id);
}
private IdentifiedUser reloadUser() {
accountCache.evict(userId);
user = userFactory.create(Providers.of(db), userId);
user = userFactory.create(userId);
return user;
}