Tips & tricks - Set individual timeouts for interactive sessions

This article shows how to set an individual session timeout per user. To do this, a process responds to a login, reads the value entered in the user account in seconds, and sets the session timeout accordingly in milliseconds.

Create user attribute

In the first step, we create a new user attribute in which the session timeout in seconds can be stored for each user. To do this, open the schema manager in the "User" module via the main menu "User / Schema manager" and select the "User" class in the left-hand column. A new attribute can then be created via the "Edit" menu.

Make the following settings here:

  • Name and title: SessionTimeout

  • Type: Integer

  • DB column name: SESSIONTIMEOUT

Click on "OK" to create the new attribute and close the dialog.

Close the schema manager by clicking on "OK".

You can now find the attribute in every user account on the "Other attributes" tab. The desired session timeout in seconds can now be entered in the "Value" column.

Intrexx has no problem with a high number of user sessions. If you want to set individual timeouts, please ensure that you specify a valid, sufficient time period (recommended minimum 1200, maximum 36,000 seconds) for each user.

Edit portal properties

Open the portal properties via the main menu "Portal/ Portal properties" and set the setting "Send login process event on login" in the options. Then restart the portal service.

Create process

Create a process in the "Processes" module via the main menu "File / New process". Remove any existing process elements and create a generic event handler. Select the "de.uplanet.lucy.server.workflow.eventhandler.SessionLoginWorkflowEventHandler" class on the "Generic event handler" tab in the element's properties dialog. Then add the following properties:

Name

Type

Value

handleManagerLogin

Boolean

true

handleWebLogin

Boolean

true

ignoreAnonymousLogin

Boolean

true

This completes the configuration of the Generic Event Handler.

Now create a new Groovy action and connect it to the generic event handler. Then open the properties dialog by double-clicking on the element, click "Next" and then on the link "Open Intrexx Editor". Enter the following script in the editor:

            def iTimeout = g_session?.user.SessionTimeout
if (iTimeout) {
                def timeoutMS = iTimeout * 1000L // in milliseconds
                g_session.timeout = timeoutMS
                g_syslog.info("Set session timeout to ${timeoutMS} milliseconds.")
}
        

Close all dialogs by clicking on "OK" and save the process. Subsequently, the session timeout is set accordingly for each login.