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:
Shawn O. Pearce
2008-12-24 18:14:20 -08:00
parent 3c38949d57
commit defe5918e8
2 changed files with 5 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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();
}