User login by organization

Is there a query or admin page that can list the active user logins by organization? On the clients admin page, there is a list of all client logins but if difficult to determine the organizations that these users belong.

Hi rmcneilly,

If you want this, you can add client info to every client that connects.

application.addClientInfo('organisation X')

Now you can do a count for all connected clients for ‘organisation X’ by using this function:

application.getClientCountForInfo('organisation X')

Hope this helps.

We have users who all have different legal entities, branches, divisions and departments.
We all put this into our user table to specific fields. In fact, we do not use a separate user table but only one table called “persons”, which includes also all contacts from customers and suppliers.
The users than just have a flag “ps_is_user” (INTEGER) in that table. The advantage is we spare a separate user table and it turned out to be quite useful.

When creating a current user list in an array with plugins.UserManager.getClients(), we then link that list to our own user table and can show everything we want.
I enclose our function which does that:
(_to_persons$initials_anykey is a relation that relates persons table to persons table (itself), and is defined by scopes.utils.anyKey=ps_initials, which in return we get from the getClients() )

/**
 * Returns current logged-in user data-set
 *
 * @return {JSDataSet} dsLoggedInUsers
 *
 * @private
 *
 * @properties={typeid:24,uuid:"0A6C79A9-BF61-434C-A9F7-3FF02B340066"}
 */
function getCurrentUserList() {
	
	var
		/*** @type {Array} */
		arrClients = plugins.UserManager.getClients(),
		/*** @type {JSDataSet} */
		dsLoggedInUsers = databaseManager.createEmptyDataSet(),
		sUserFullName 	= "",
		sUserBranch 	= "";
	
	dsLoggedInUsers.addColumn('client_id');
	dsLoggedInUsers.addColumn('application_type');
	dsLoggedInUsers.addColumn('host_address');
	dsLoggedInUsers.addColumn('host_identifier');
	dsLoggedInUsers.addColumn('host_name');
	dsLoggedInUsers.addColumn('user_name');
	
	dsLoggedInUsers.addColumn('user_fullName');
	dsLoggedInUsers.addColumn('user_branch');
	
	dsLoggedInUsers.addColumn('user_uid');
	dsLoggedInUsers.addColumn('login_time');
	dsLoggedInUsers.addColumn('idle_time');
	dsLoggedInUsers.addColumn('last_update_time');

	
	var	
		dLogin,
		dIdle,
		dLastUpdate,
		sDatePattern = scopes.person.currentDateFormat_dd_mm_yyyy,
		sTimePattern = "HH:mm";
	

	for (var i = 0; i < arrClients.length; i++) {
		
		scopes.utils.anyKey = arrClients[i].userName;
		
		if (utils.hasRecords(_to_persons$initials_anykey)) {
			
			if (utils.hasRecords(_to_persons$initials_anykey.persons_to_org_units)) 

                             sUserBranch = _to_persons$initials_anykey.persons_to_org_units.org_name ;
  			     sUserFullName = _to_persons$initials_anykey.clcs_ps_full_name ;
			
		} else {
			
			sUserBranch 	= "Unknown";
			sUserFullName 	= "Unknown";
		}
		
		dLogin      = utils.dateFormat(arrClients[i].login, sDatePattern) + " " + utils.dateFormat(arrClients[i].login, sTimePattern);
		dIdle       = utils.dateFormat(arrClients[i].idle, sDatePattern) + " " + utils.dateFormat(arrClients[i].idle, sTimePattern);
		dLastUpdate = utils.dateFormat(arrClients[i].lastUpdate, sDatePattern) + " " + utils.dateFormat(arrClients[i].lastUpdate, sTimePattern);
		
			
		dsLoggedInUsers.addRow([arrClients[i].clientId, 
								arrClients[i].applicationType, 
								arrClients[i].hostAddress, 
								arrClients[i].hostIdentifier, 
								arrClients[i].hostName, 
								arrClients[i].userName, 
								sUserFullName,
								sUserBranch,
								arrClients[i].userUid, 
								dLogin, 
								dIdle,
								dLastUpdate]);  
	}
	
	return dsLoggedInUsers;
}