Who's Logged In ??

I can get the current user and the number of logged in Clients but I’d also like to be able to list all the currently logged in users (logged into the server/solution. The purpose is so that Clients can look at the ‘security info page’ of our solution, see who’s hogging the licenses :shock: and contact them to log-out if necessary.

Is it possible to do this, and if so what are the methods available for it (i.e. to show users in a list).

As always - appreciate feedback.

You could have a look at our UserManager plugin… It should allow you to do what you want plus a lot more.

Hi Ian,

If you deployed with Servoy 5, you can take a look at the default ‘maintenance’ plugin which is in Servoy 5 right now.
There’s a function called: ‘getConnectedClients()’, from which you can get hold of more user information…

Hope this helps!

[EDIT] you can even send the message you want or disconnect the client… :-)

Patrick - thanks for that info. We are attempting to minimise the number of external plugins we use (actuially our target is to use only Servoy supplied plugins) for our current development. As we become more familiar with the enviro`nment we’ll doubtless move on that decision. All of your plugins look excellent and in particular I’m looking forward to trying out the table bean/plugin sometimes soon. Thanks for all the effort.

mboegem:
Hi Ian,

getConnectedClients()', from which you can get hold of more user information.

This does indeed help Marc - however it returns the (I think) a UUID of the user, and so far, I cant see how I can convert that into a login name for use by the end user? Do you know of a way to reconcile this UUID with a user name?

Hi Ian,

The function returns an array with JSClientInformation objects. This object has functions to get more information like the username.
Just check the JSClientInformation node under the Maintainance plugin.

Hope this helps.

Kahuna:
This does indeed help Marc - however it returns the (I think) a UUID of the user, and so far, I cant see how I can convert that into a login name for use by the end user? Do you know of a way to reconcile this UUID with a user name?

The array this function returns is an array with JSClientInformation elements.

From each array position you can request more information from the element using the ‘JSClientInformation’ node which can be found under the Maintenance plugin (see attached screenshot)[attachment=1]maintenance.jpg[/attachment]

These are the available functions:[attachment=0]JSClientInfo.jpg[/attachment]

This is the sample code from Servoy which will further clarify it I guess:

var clients = plugins.maintenance.getConnectedClients();
	application.output('There are ' + clients.length + ' connected clients.');
	for (var i = 0; i < clients.length; i++)
	{
		var client = clients[i];
		application.output('Client details:');
		application.output('\tID: ' + client.getClientID());
		application.output('\tApplication type: ' + client.getApplicationType());
		application.output('\tHost address: ' + client.getHostAddress());
		application.output('\tHost identifier: ' + client.getHostIdentifier());
		application.output('\tHost name: ' + client.getHostName());
		application.output('\tUser name: ' + client.getUserName());
		application.output('\tUsed UID: ' + client.getUserUID());
	}

maintenance.jpg

Thanks guys - blind as usual. Got it all working in my test form - with 1 exception.

I’m working in developer and testing this from from here and can get all of the relevant data from the array including the ClientID, HostName and number of clients attached but getUserName() returns nothing?

I’m assuming its something to do with working in developer and not on a running server? Obviously I can get the username from my login for the current user but I’m looking for the user attached to the id in the array.

maintenance plugin only works for batch processors/clients running on the server.