Change AccountSshKeyAccess so we can get all keys for an account
When showing keys to the user we want to also display their invalid keys, but the sshd only wants the valid ones. We need two queries to set this access path up. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -25,6 +25,9 @@ public interface AccountSshKeyAccess extends
|
||||
@PrimaryKey("id")
|
||||
AccountSshKey get(AccountSshKey.Id id) throws OrmException;
|
||||
|
||||
@Query("WHERE id.accountId = ? AND valid = true ORDER BY storedOn DESC")
|
||||
@Query("WHERE id.accountId = ? ORDER BY storedOn DESC")
|
||||
ResultSet<AccountSshKey> byAccount(Account.Id id) throws OrmException;
|
||||
|
||||
@Query("WHERE id.accountId = ? AND valid = true ORDER BY storedOn DESC")
|
||||
ResultSet<AccountSshKey> valid(Account.Id id) throws OrmException;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SshUtil {
|
||||
// TODO log accounts with duplicate emails
|
||||
return Collections.<AccountSshKey> emptyList();
|
||||
}
|
||||
kl = db.accountSshKeys().byAccount(matches.get(0).getId()).toList();
|
||||
kl = db.accountSshKeys().valid(matches.get(0).getId()).toList();
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user