Active Users

Description

Applications that use the Security Framework often need to know which users are currently logged in. Tracking “logged in” state alone is unreliable because users may be logged out by inactivity (session expiration) without a logout event firing. It is more practical to track active users.

Overview

Alpha Anywhere allows you to keep track of Active Users in applications that use the Security Framework. A user is considered active when they log in and when they make Ajax callbacks to the server.

To enable tracking, define an Active Users table in Web Project Properties.

Active Users tracking in Web Project Properties
Active Users tracking in Web Project Properties

Quick Setup

If you configure the Security Framework using the Web Security Framework - Quick Setup Genie, you can specify that an Active Users table should be created automatically.

Quick Setup Genie option to create Active Users table
Quick Setup Genie option to create Active Users table

Reading Active Users

Use the a5w_getActiveUsers() server-side function to query activity recorded in the Active Users table.

jsondata

The query result as a JSON string.

timeperiod
  • Relative periods

    e.g. last:5minutes, last:5hours, last:2days

  • Explicit ranges

    e.g. 12/21/2023 05:11 PM::12/25/2023 05:11 PM

type
  • summary

    Returns one record per active user with a count of activity events (e.g. login, ajax callback), sorted most-active first.

  • detailed

    Returns each activity event with its activity type (e.g. login, ajax callback to refresh a List).

c jsondata = a5w_getActiveUsers as c (c timeperiod [, type]])
Retention setting for Active Users
Retention setting for Active Users
By default, when the Active Users table is configured, data are retained for 3 days. To query a longer period (e.g. 5 days), increase Maximum number of days activity in Web Project Properties.

Videos

Template

A sample UX component for viewing data in the Active Users table is available.

The Template name is UX_ActiveUsers_List. Helptext reads "Show a list of Active Users in an application that uses the Security Framework".

UX Component Template - UX_ActiveUsers_List.
UX Component Template - UX_ActiveUsers_List.
The UX Component Template creates several controls.
The UX Component Template creates several controls.

See Also