summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Bruin <peterbruin68@gmail.com>2013-07-18 21:44:17 +0800
committerPeter <peterbruin68@gmail.com>2013-07-18 22:12:10 +0800
commit07ec76188c228e21c472a09656acf0e71981445b (patch)
tree8b53f318b26abc28db44f0399dbe268b1d805d7a
parent7549dfa8174410f1fe5f0da385a9762fb3614840 (diff)
Fix for issue 2016 ssh keys not flushedv2.7-rc3
ssh keys that are added and deleted via the command line command set-account username --add-ssh-key don't take effect until after the caches have been flushed manually. This is cause by the fact that account.getUserName returns null. Change-Id: I23e66d5734f21bb5e378cfb99d4507379fc9334b
-rw-r--r--gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/SetAccountCommand.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/SetAccountCommand.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/SetAccountCommand.java
index a3e9d6ef23..c938891543 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/SetAccountCommand.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/SetAccountCommand.java
@@ -136,6 +136,13 @@ final class SetAccountCommand extends BaseCommand {
boolean accountUpdated = false;
boolean sshKeysUpdated = false;
+ ResultSet<AccountExternalId> ids = db.accountExternalIds().byAccount(id);
+ for (AccountExternalId extId : ids) {
+ if (extId.isScheme(AccountExternalId.SCHEME_USERNAME)) {
+ account.setUserName(extId.getSchemeRest());
+ }
+ }
+
for (String email : addEmails) {
link(id, email);
}