You can use the following Java code in a Java action with no input and a boolean output. Then, run this action in a scheduled event.
// BEGIN USER CODE
Collection<? extends ISession> sessions = Core.getActiveSessions();
Map<String, Object> parameters = new HashMap<String, Object>();
for (ISession iSession : sessions) {
parameters.clear();
IUser user = iSession.getUser();
parameters.put("User", user.getMendixObject());
Boolean forceLogout = Core.execute(getContext(), "Administration.DetermineDestroySession", parameters);
if (forceLogout) {
iSession.destroy();
}
}
return true;
// END USER CODE
Then, create the microflow Administration.DetermineDestroySession with a User object as input and a boolean as output. Implement the check in that microflow, e.g.
hoursBetween([%CurrentDateTime%], $User/LastLogin) >= 4
Could you not use the last login time in combination with active users? So iterate over all the active users and check if the last login time is more then 4 hours ago.
Regards,
Ronald
Have you found a solution to this?