From 6a0f89d6451e992e602818efcd56cd9de5c2e173 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 25 Sep 2004 01:52:17 +0000 Subject: [PATCH] Added lookupUsersByEmail() to look up all user records for users that match the specified email address. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1507 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../servlet/user/UserRepository.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/projects/samskivert/src/java/com/samskivert/servlet/user/UserRepository.java b/projects/samskivert/src/java/com/samskivert/servlet/user/UserRepository.java index 49b5f8e6..e6447b2e 100644 --- a/projects/samskivert/src/java/com/samskivert/servlet/user/UserRepository.java +++ b/projects/samskivert/src/java/com/samskivert/servlet/user/UserRepository.java @@ -268,6 +268,28 @@ public class UserRepository extends JORARepository }); } + /** + * Lookup a user by email address, something that is not efficient and + * should really only be done by site admins attempting to look up a + * user record. + * + * @return the user with the specified user id or null if no user with + * that id exists. + */ + public ArrayList lookupUsersByEmail (String email) + throws PersistenceException + { + final String where = "where email = '" + + StringUtil.replace(email, "'", "\\'") + "'"; + return (ArrayList) execute(new Operation() { + public Object invoke (Connection conn, DatabaseLiaison liaison) + throws PersistenceException, SQLException + { + return _utable.select(where).toArrayList(); + } + }); + } + /** * Loads up a user record that matches the specified where clause. * Returns null if no record matches.