Tips & Tricks - Setting Custom Timeouts for Interactive Sessions

This post shows how to set an individual session timeout for each 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 a user attribute

In the first step, we create a new user attribute in which the session timeout can be stored in seconds for each user. To do this, open the Schema Manager in the "Users" module via the main menu "Users / Schema Manager" and select the "Users" class in the left column. You can then create a new attribute using the "Edit" menu.

Set the following settings here:

  • Name and Title: SessionTimeout

  • Type: Integer

  • DB column name: SESSIONTIMEOUT

Clicking "OK" creates the new attribute and closes the dialog box.

Close the Schema Manager by clicking "OK."

You can now find this attribute in every user account on the "Additional Attributes" tab. In the "Value" column, you can now enter the desired session timeout in seconds.

Intrexx has no problem handling a large number of user sessions. If you wish to set custom timeouts, please ensure that you specify a valid, sufficient time period (recommended: at least 1,200, max. 36,000 seconds) for each user.

Edit Portal Properties

Open the portal properties via the main menu "Portal/Portal Properties" and, in the options, select the setting "Send login process event upon login." Then restart the portal service.

Create a process

In the "Processes" module, create a process by selecting "File / New Process"from the main menu. Remove any existing process elements and create a generic event handler. In the element's Properties dialog, on the "Generic Event Handler" tab, select the class "de.uplanet.lucy.server.workflow.eventhandler.SessionLoginWorkflowEventHandler." 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 the element, click "Next," and then click the "Open Intrexx Editor" link. Enter the following script into 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 dialog boxes by clicking "OK" and save the process. After that, the session timeout is set accordingly each time a user logs in.