]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/User.java
ADD: Show and add affiliations to organistations.
[gigi.git] / src / org / cacert / gigi / dbObjects / User.java
index 398af91adf7304fbad0867817d1c14768425b3bc..57a9ee2cefbad0293f047266db95b03f912bb2f4 100644 (file)
@@ -419,6 +419,16 @@ public class User extends CertificateOwner {
         return null;
     }
 
+    public static User getByEmail(String mail) {
+        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT users.id FROM users inner join certOwners on certOwners.id=users.id WHERE email=? AND deleted is null");
+        ps.setString(1, mail);
+        GigiResultSet rs = ps.executeQuery();
+        if ( !rs.next()) {
+            return null;
+        }
+        return User.getById(rs.getInt(1));
+    }
+
     public boolean canIssue(CertificateProfile p) {
         switch (p.getCAId()) {
         case 0: