Description
During an effort to propagate login/logout events to a central logging service, I discovered
that updateSession() has the user_id and session_id SQL parameters in the wrong
order, so it never updates any records.
Once the session timeout bug (http://community.i2b2.org/jira/browse/LEOPARD-39 )
was fixed, this meant that sessions could never last more than 30 minutes, I think.
The fix is straightforward:
--- a/edu.harvard.i2b2.pm/src/edu/harvard/i2b2/pm/dao/PMDbDao.java
+++ b/edu.harvard.i2b2.pm/src/edu/harvard/i2b2/pm/dao/PMDbDao.java
@@ -707,7 +707,7 @@ public class PMDbDao extends JdbcDaoSupp
public int updateSession(String userId, String sessionId, int timeout)
{
String addSql = "update pm_user_session set expired_date = ? " +
- " where session_id = ? and user_id =?";
+ " where user_id = ? and session_id =?";
Calendar now = Calendar.getInstance();
now.add(Calendar.MILLISECOND, timeout);
I checked the current svn code (Rev: 62 2010-07-28 13:39:58 -0500) and the bug
is still there.
see also http://bitbucket.org/DanC/i2b2-pm-cas/changeset/a8c7cd30b279
that updateSession() has the user_id and session_id SQL parameters in the wrong
order, so it never updates any records.
Once the session timeout bug (http://community.i2b2.org/jira/browse/LEOPARD-39 )
was fixed, this meant that sessions could never last more than 30 minutes, I think.
The fix is straightforward:
--- a/edu.harvard.i2b2.pm/src/edu/harvard/i2b2/pm/dao/PMDbDao.java
+++ b/edu.harvard.i2b2.pm/src/edu/harvard/i2b2/pm/dao/PMDbDao.java
@@ -707,7 +707,7 @@ public class PMDbDao extends JdbcDaoSupp
public int updateSession(String userId, String sessionId, int timeout)
{
String addSql = "update pm_user_session set expired_date = ? " +
- " where session_id = ? and user_id =?";
+ " where user_id = ? and session_id =?";
Calendar now = Calendar.getInstance();
now.add(Calendar.MILLISECOND, timeout);
I checked the current svn code (Rev: 62 2010-07-28 13:39:58 -0500) and the bug
is still there.
see also http://bitbucket.org/DanC/i2b2-pm-cas/changeset/a8c7cd30b279