Skip to content
Snippets Groups Projects
Commit 187eb312 authored by srosse's avatar srosse
Browse files

OO-838: shows the last click and the last "touch" on the HTTP session in admin > user session

parent 90f15605
No related branches found
No related tags found
No related merge requests found
......@@ -85,14 +85,15 @@ public class UserSessionController extends BasicController implements StackedCon
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.last", 0, null, ureq.getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.first", 1, null, ureq.getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.identity", 2, null, ureq.getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.authprovider", 3, null, ureq.getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.fqdn", 4, null, ureq.getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.access", 5, null, ureq.getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.duration", 6, null, ureq.getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.mode", 7, null, ureq.getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.last", 0, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.first", 1, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.identity", 2, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.authprovider", 3, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.fqdn", 4, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.lastClick", 5, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.access", 9, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.duration", 6, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("sess.mode", 7, null, getLocale()));
tableCtr.addColumnDescriptor(new StaticColumnDescriptor("sess.details", "sess.details", translate("sess.details")));
tableCtr.addColumnDescriptor(new BooleanColumnDescriptor("sess.chat", 8, "sess.chat", translate("sess.chat"), null));
......
......@@ -73,6 +73,7 @@ public class UserSessionDetailsController extends BasicController {
long creatTime = -1;
long lastAccessTime = -1;
long lastClickTime = -1;
boolean success = false;
if (isAuth) {
......@@ -80,16 +81,18 @@ public class UserSessionDetailsController extends BasicController {
HttpSession se = sessInfo.getSession();
creatTime = se.getCreationTime();
lastAccessTime = se.getLastAccessedTime();
lastClickTime = sessInfo.getLastClickTime();
success = true;
} catch (Exception ise) {
// nothing to do
}
}
if (success) {
Formatter f = Formatter.getInstance(ureq.getLocale());
sesDetails.contextPut("created", f.formatDateAndTime(new Date(creatTime)));
sesDetails.contextPut("lastaccess", f.formatDateAndTime(new Date(lastAccessTime)));
sesDetails.contextPut("lastclick", f.formatDateAndTime(new Date(lastClickTime)));
} else {
sesDetails.contextPut("created", " -- this session has been invalidated --");
sesDetails.contextPut("lastaccess", " -- this session has been invalidated --");
......
......@@ -70,11 +70,8 @@ public class UserSessionTableModel extends DefaultTableDataModel<UserSessionView
case 5: return usess.getLastClickTime();
case 6: return usess.getSessionDuration();
case 7: return usess.getMode();
case 8: {
//can chat?
return myIdentityKey.equals(usess.getIdentityKey())
? Boolean.FALSE : Boolean.TRUE;
}
case 8: return myIdentityKey.equals(usess.getIdentityKey()) ? Boolean.FALSE : Boolean.TRUE;
case 9: return usess.getLastAccessTime();
default: return "Error";
}
} else { // not signed on
......
......@@ -13,6 +13,7 @@
<tr><td>$r.translate("sess.fqdn"):</td><td>$!si.getFromFQN()</td></tr>
<tr><td>User Agent:</td><td>$!si.getUserAgent()</td></tr>
<tr><td>$r.translate("sess.created"):</td><td>$created</td></tr>
<tr><td>$r.translate("sess.lastClick"):</td><td>$lastclick</td></tr>
<tr><td>$r.translate("sess.access"):</td><td>$lastaccess</td></tr>
<tr><td>$r.translate("sess.webMode"):</td><td>$!si.getWebMode()</td></tr>
<tr><td>WebDAV:</td><td>$!si.isWebDAV()</td></tr>
......
......@@ -98,7 +98,8 @@ runtime.users.last6months=Aktive Benutzer innerhalb der letzten 6 Monate
runtime.users.lastday=Aktive Benutzer innerhalb der letzten 24 Stunden
runtime.users.lastmonth=Aktive Benutzer innerhalb des letzten Monates
runtime.users.lastweek=Aktive Benutzer innerhalb innerhalb der letzten 7 Tage
sess.access=Letzter Zugriff
sess.lastClick=Letzter Click
sess.access=Letzer Zugriff
sess.active=Aktive Nutzer
sess.and.clicks=$\:sess.active
sess.attributes.title=Attribute
......
......@@ -99,6 +99,7 @@ runtime.users.lastday=Active users within last 24 hours
runtime.users.lastmonth=Active users within last month
runtime.users.lastweek=Active users within last 7 days
sess.access=Last access
sess.lastClick=Last click
sess.active=Active users
sess.and.clicks=$\:sess.active
sess.attributes.title=Attributes
......
......@@ -21,6 +21,8 @@ package org.olat.admin.sysinfo.model;
import java.util.Date;
import javax.servlet.http.HttpSession;
import org.olat.core.util.SessionInfo;
import org.olat.core.util.UserSession;
......@@ -37,6 +39,7 @@ public class UserSessionView {
private String login, authProvider;
private String fromFQN;
private Date lastClickTime;
private Date lastAccessTime;
private long sessionDuration;
private String mode;
......@@ -75,6 +78,16 @@ public class UserSessionView {
mode = sessInfo.getWebMode();
}
}
HttpSession se = sessInfo.getSession();
if(se != null) {
try {
lastAccessTime = new Date(se.getLastAccessedTime());
} catch (Exception e) {
lastAccessTime = null;
}
}
}
public UserSession getUserSession() {
......@@ -111,8 +124,12 @@ public class UserSessionView {
public Date getLastClickTime() {
return lastClickTime;
}
}
public Date getLastAccessTime() {
return lastAccessTime;
}
public long getSessionDuration() {
return sessionDuration;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment