system.util.getSessionInfo
This function is used in Python Scripting.
Descriptionβ
Returns a PyDataSet holding information about all of the open Designer sessions and Vision Clients. Optional regular-expression based filters can be provided to filter the username or the username and the project returned.
| Key | Description | Value |
|---|---|---|
| username | The username of the Session. | String |
| project | The project name associated with the Session. | String |
| address | The client's network address (IP address or hostname). | String |
| isDesigner | Whether the Session is a Designer Session (True or False) | Boolean |
| clientId | The unique ID of the client. | String |
| creationTime | The date when the Session was created. | Date |
This function will not return all sessions across a cluster - only the cluster node that is being communicated with by the client who makes the call.
tip
This function accepts keyword arguments.
Client Permission Restrictionsβ
This scripting function has no Client Permission restrictions.
Syntaxβ
system.util.getSessionInfo([usernameFilter], [projectFilter])
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| String | usernameFilter | A regular-expression based filter string to restrict the list by username. [optional] |
| String | projectFilter | A regular-expression based filter string to restrict the list by project [optional] |
Returnsβ
PyDataSet - A dataset representing the Gateway's current sessions.
Scopeβ
Gateway, Vision Client, Perspective Session
Code Examplesβ
Example #1
# This code would get the entire table of sessions and put it in an adjacent table
table = event.source.parent.getComponent("Table")
sessions = system.util.getSessionInfo()
table.data = system.db.toDataSet(sessions)
Example #2
# This code would count the number of times a user named "billy" is logged in
sessions = system.util.getSessionInfo("billy")
system.gui.messageBox("Billy has %d sessions" % len(sessions))
Example #3
# This code would return session info on all users starting with the letters "bi"
sessions = system.util.getSessionInfo("bi.*")
Example #4
# This code uses a single character wildcard in the username
sessions = system.util.getSessionInfo("bi.ly")
Example #5
# This code would return session info on a user named "bill.smith"
sessions = system.util.getSessionInfo("bill\.smith")