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 via the main menu "Users / Schema manager" and there select the class "Users" in the left column. A new attribute can then be created via the "Edit" menu.
Make the following settings here:
-
Name and title: Session Timeout
-
Type: Integer
-
DB column name: SESSIONTIMEOUT
Click on "OK" to create the new attribute and close the dialog.
Also close the Schema Manager by clicking "OK".
The attribute can now be found in each user account on the "More attributes" tab. The desired session timeout in seconds can now be entered in the "Value" column.
Edit portal properties
Open the portal properties via the main menu "Extras / Portal properties" and set the setting "Enable login process event" in the options there. Then restart the portal service.
Create process
Create a process in the "Processes" module via the "File / New process" main menu item. Remove any existing process elements and create a Generic event handler. In the properties dialog of the element, 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 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 "OK" and save the process. Subsequently, the session timeout is set accordingly for each login.