Retrieve the list of logged in users

0
Hi ,   I have been trying to create the overview page that shows the list of logged in users to the application. I found two ways to implement it, but I’m struck in both ways.   First way: I was trying to follow the approach of Call REST service to admin handler as mentioned in following URL. https://docs.mendix.com/refguide/monitoring-mendix-runtime#6-logged-in-users.   What will be the URL endpoint ? for example if application is hosted in URL https://www.abctest.com then endpoint for this request should be https://www.abctest.com:8090 How to find the value of X-M2EE-Authentication: ? as per documentation it is mentioned as password can be fetched from enviroinment variables, which I’m not sure how to find it.   Second approach: Get the list of users via java action, I was trying to implement following code but lot of error was throwing during compilation , can you please help on complete  Java action code, because i’m new to both java and mendix.   {         // BEGIN USER CODE         ArrayList<String> userNameList = new ArrayList<String>();         for (ISession session: Core.getActiveSessions()) {             String userName = session.getUser().getName();             userNameList.add(userName);         }         return userNameList;         // END USER CODE     }   Thanks , Balaji S
asked
2 answers
1

Please check Active Session page in System Administration folder under Administration module. you will get the current logged in users list.

answered
0

Since Mendix 7, there is a far easier way to do this: sessions are persisted, and so you can simply retrieve them from the database. 

 

You can create a Data Grid showing System.User objects, and constrain that with [System.Session_User/System.Session]. This should show all users that currently have a session.

answered