From e555ad41a2cd60ee04b421aeb5e9615a05dfb13e Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Thu, 7 Oct 2010 21:54:12 +0000
Subject: [PATCH] [LMS-1816] Enable login with email address

SVN: 18216
---
 openbis/dist/server/service.properties                          | 2 ++
 .../ch/systemsx/cisd/openbis/generic/server/AbstractServer.java | 2 +-
 openbis/source/java/genericApplicationContext.xml               | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/openbis/dist/server/service.properties b/openbis/dist/server/service.properties
index d91f3ab5cc4..6867b35e873 100644
--- a/openbis/dist/server/service.properties
+++ b/openbis/dist/server/service.properties
@@ -60,6 +60,8 @@ ldap.attributenames.email =
 ldap.attributenames.first.name =
 # The attribute name for the last name, defaults to "sn"
 ldap.attributenames.last.name =
+# Set to true to also query for email aliases
+ldap.queryEmailForAliases = true
 
 # The database instance local unique identifier. Used when the new database is created.
 database-instance = TEST
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java
index dad82546b5c..221b3612fb5 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java
@@ -253,7 +253,7 @@ public abstract class AbstractServer<T> extends AbstractServiceWithLogger<T> imp
         assert persons.size() > 0 : "At least system user should be in the database";
         // If only one user (system user), then this is the first logged user.
         final boolean isFirstLoggedUser = (persons.size() == 1);
-        PersonPE person = daoFactory.getPersonDAO().tryFindPersonByUserId(user);
+        PersonPE person = daoFactory.getPersonDAO().tryFindPersonByUserId(session.getUserName());
         if (person == null)
         {
             final PersonPE systemUser = getSystemUser(persons);
diff --git a/openbis/source/java/genericApplicationContext.xml b/openbis/source/java/genericApplicationContext.xml
index 1a2e115708b..64309e3181f 100644
--- a/openbis/source/java/genericApplicationContext.xml
+++ b/openbis/source/java/genericApplicationContext.xml
@@ -60,6 +60,8 @@
         </constructor-arg>
         <!-- The time after which an inactive session is expired by the service (in minutes). -->
         <constructor-arg value="${session-timeout}" />
+        <!-- Enable login with email addresses -->
+        <constructor-arg value="true" />
     </bean>
     
     <bean id="remote-host-validator" class="ch.systemsx.cisd.openbis.generic.server.WhiteListBasedRemoteHostValidator">
-- 
GitLab