- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2015 01:20 PM
var loggedIn = [];
var sessions = GlideSessions.get().getLoggedInSessionList();
var it = sessions.iterator();
while (it.hasNext())
{
var session = it.next();
var id = session.getUser();
var user = new GlideRecord('sys_user');
user.get('user_name', id);
loggedIn.push(user.sys_id);
}
Above is an excerpt of a script that I wanted to use to get the sys_ids of all currently logged in users. It works perfectly fine, however it only picks up users logged into the current node. Is there a way to get a session reference for all users across all nodes on a given instance?
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2015 09:21 PM
The first idea that came to my mind is to run this code as a part of script executed by sys_trigger records attached to each of your UI nodes and populate a custom table with some schedule. Next you will be able to query that table data from anu none. The only negative effect is that your list is not real-time but a historical snapshot (we have a schedule-based population). Other than that I do not see any other method of exchanging informtion about logged in users between your UI nodes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2015 09:21 PM
The first idea that came to my mind is to run this code as a part of script executed by sys_trigger records attached to each of your UI nodes and populate a custom table with some schedule. Next you will be able to query that table data from anu none. The only negative effect is that your list is not real-time but a historical snapshot (we have a schedule-based population). Other than that I do not see any other method of exchanging informtion about logged in users between your UI nodes.