From d500429a1d7a47da3bcd22880b53dce806ba9300 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Thu, 10 Apr 2014 18:58:10 -0400 Subject: [PATCH] Refactored regex list command into a subclass --- src/main/java/com/gitblit/transport/ssh/gitblit/SetAccountCommand.java | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gitblit/transport/ssh/gitblit/SetAccountCommand.java b/src/main/java/com/gitblit/transport/ssh/gitblit/SetAccountCommand.java index aebe3b1..3f98778 100644 --- a/src/main/java/com/gitblit/transport/ssh/gitblit/SetAccountCommand.java +++ b/src/main/java/com/gitblit/transport/ssh/gitblit/SetAccountCommand.java @@ -22,6 +22,7 @@ import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Option; +import com.gitblit.transport.ssh.SshKey; import com.gitblit.transport.ssh.commands.CommandMetaData; /** Set a user's account settings. **/ @@ -66,18 +67,20 @@ } } - private void addSshKeys(List<String> sshKeys) throws UnloggedFailure, + private void addSshKeys(List<String> keys) throws UnloggedFailure, IOException { - for (String sshKey : sshKeys) { + for (String key : keys) { + SshKey sshKey = new SshKey(key); getKeyManager().addKey(user, sshKey); } } - private void deleteSshKeys(List<String> sshKeys) { - if (sshKeys.contains(ALL)) { + private void deleteSshKeys(List<String> keys) { + if (keys.contains(ALL)) { getKeyManager().removeAllKeys(user); } else { - for (String sshKey : sshKeys) { + for (String key : keys) { + SshKey sshKey = new SshKey(key); getKeyManager().removeKey(user, sshKey); } } -- Gitblit v1.9.1