Remove user sessions

0
For a customer if have the requirements that: A user gets logged out after 4 hours An inactive user gets logged out 15 min For removing the inactive user I have set EnableKeepAlive to false , the SessionTimeout to 15 min and ClusterManagerActionInterval to half of 15 min. However, I am at a loss on how to get users timed out based on the age of their session. Since i do not want persistent sessions I cannot delete them in a SE. Any ideas would be very welcome
asked
3 answers
1

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
answered
0

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

answered
0

Have you found a solution to this?

answered