Merge branch 'stable-2.15'
* stable-2.15: Documentation: Wrong field names in ChangeDetail JSON example Add /.bazel_path to .gitignore Add /plugins/cookbook-plugin/ to .gitignore AccountManager: Don't try to lookup external IDs from account index AccountManager#lookup: Don't use account index to resolve external ID Change-Id: I97fa645bc007af7494e7a8139c657e0eef964be3
This commit is contained in:
commit
670a5b241e
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,5 +27,6 @@
|
||||
/gwt-unitCache
|
||||
/infer-out
|
||||
/local.properties
|
||||
/plugins/cookbook-plugin/
|
||||
/test_site
|
||||
/tools/format
|
||||
|
@ -734,9 +734,9 @@ REJECTED > APPROVED > DISLIKED > RECOMMENDED.
|
||||
"email": "john.doe@example.com",
|
||||
"username": "jdoe"
|
||||
},
|
||||
"updated": "2013-03-23 21:34:02.419000000",
|
||||
"date": "2013-03-23 21:34:02.419000000",
|
||||
"message": "Patch Set 1:\n\nThis is the first message.",
|
||||
"revision_number": 1
|
||||
"_revision_number": 1
|
||||
},
|
||||
{
|
||||
"id": "WEEdhU",
|
||||
@ -746,9 +746,9 @@ REJECTED > APPROVED > DISLIKED > RECOMMENDED.
|
||||
"email": "jane.roe@example.com",
|
||||
"username": "jroe"
|
||||
},
|
||||
"updated": "2013-03-23 21:36:52.332000000",
|
||||
"date": "2013-03-23 21:36:52.332000000",
|
||||
"message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
|
||||
"revision_number": 1
|
||||
"_revision_number": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -35,11 +35,9 @@ import com.google.gerrit.server.account.externalids.ExternalIdsUpdate;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.group.db.GroupsUpdate;
|
||||
import com.google.gerrit.server.project.ProjectCache;
|
||||
import com.google.gerrit.server.query.account.InternalAccountQuery;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.gwtorm.server.SchemaFactory;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -68,7 +66,6 @@ public class AccountManager {
|
||||
private final ChangeUserName.Factory changeUserNameFactory;
|
||||
private final ProjectCache projectCache;
|
||||
private final AtomicBoolean awaitsFirstAccountCheck;
|
||||
private final Provider<InternalAccountQuery> accountQueryProvider;
|
||||
private final ExternalIds externalIds;
|
||||
private final ExternalIdsUpdate.Server externalIdsUpdateFactory;
|
||||
private final GroupsUpdate.Factory groupsUpdateFactory;
|
||||
@ -87,7 +84,6 @@ public class AccountManager {
|
||||
IdentifiedUser.GenericFactory userFactory,
|
||||
ChangeUserName.Factory changeUserNameFactory,
|
||||
ProjectCache projectCache,
|
||||
Provider<InternalAccountQuery> accountQueryProvider,
|
||||
ExternalIds externalIds,
|
||||
ExternalIdsUpdate.Server externalIdsUpdateFactory,
|
||||
GroupsUpdate.Factory groupsUpdateFactory,
|
||||
@ -103,7 +99,6 @@ public class AccountManager {
|
||||
this.projectCache = projectCache;
|
||||
this.awaitsFirstAccountCheck =
|
||||
new AtomicBoolean(cfg.getBoolean("capability", "makeFirstUserAdmin", true));
|
||||
this.accountQueryProvider = accountQueryProvider;
|
||||
this.externalIds = externalIds;
|
||||
this.externalIdsUpdateFactory = externalIdsUpdateFactory;
|
||||
this.groupsUpdateFactory = groupsUpdateFactory;
|
||||
@ -115,11 +110,9 @@ public class AccountManager {
|
||||
/** @return user identified by this external identity string */
|
||||
public Optional<Account.Id> lookup(String externalId) throws AccountException {
|
||||
try {
|
||||
AccountState accountState = accountQueryProvider.get().oneByExternalId(externalId);
|
||||
return accountState != null
|
||||
? Optional.of(accountState.getAccount().getId())
|
||||
: Optional.empty();
|
||||
} catch (OrmException e) {
|
||||
ExternalId extId = externalIds.get(ExternalId.Key.parse(externalId));
|
||||
return extId != null ? Optional.of(extId.accountId()) : Optional.empty();
|
||||
} catch (IOException | ConfigInvalidException e) {
|
||||
throw new AccountException("Cannot lookup account " + externalId, e);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user