Invalidate service now session in all nodes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 02:01 PM
Hey Developers,
I have a requirement where a user wants an ability to kill another user's service now session .
Now, i did quite a bit of research and i learned that logged in users will only have the information of users who logged into the same node and doesnt communicate with the records of the other nodes (v_user_session).
Also there is an another table which says sys_user_session to get all the session records irrespective of nodes but i dont see a way to connect the dots and kill the session of the user.
Is there a way at all to achieve this ?
Thank you for all the help .
Sanjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 10:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 10:50 PM
Yes gurpreet , I tried it and it doesnt work since that business rule also works specific to the nodes..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 10:57 PM
What if you run this code from background script of in a Ui action.
- var sessions = GlideSessions.get().getLoggedInSessionList();
- var it = sessions.iterator();
- while(it.hasNext()) {
- var session = it.next();
- // If session is current users session, invalidate the session
- if (session.getUser() == user_id) { //user id of the user you want to invalidate the session
- var httpSession = session.getHS();
- httpSession.setAttribute("locked_out", "true");
- }
- }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 11:26 PM
Nope , i was hoping that will work.. but Does not work ...
I donno somehow it's not picking up the information present in the other node.
You can try the following example.
login to your instance.(normal window)
Login to a different user in a private window
Now go to logged in users(normal window) , see if the user session of the private window shows up .
If not then try the script in the normal window ... you see that it will not invalidate the session of the private window.