powered by Jive Software

Get all [online] users (with LDAP auth)

For a variety of reasons, my company is rolling out chat gradually, rather than to everyone at once; one consequence of this is that we need a way for people to see who else has chat available, or who else is logged on.

I’‘d like to set up a page that’‘s basically like the Client Sessions page in the admin console (except it can be even more stripped down - no need for IPs or anything like that). Searching the forums revealed that there’‘s no straightforward way to get this from JM, and that the recommended solution is to use the presence plugin. Sounds good - get the list of users, check to see who’'s online - ready to roll.

The problem, however, is that we’‘re using AD/LDAP for authentication - so I don’‘t have a list of users to work off of. Querying the database (MySQL, though I don’‘t think it matters) doesn’‘t seem to be a good way out - jiveUsers doesn’‘t have anything useful (which makes sense - it’‘s all in LDAP), while jiveRoster has a lot of junk (mostly caused by user typos). I tried a few variations like “SELECT DISTINCT username FROM jiveRoster”, but they all seem to return way more users than have actually used the system (and some records that aren’'t valid usernames at all).

Am I missing something, or is there really no straightforward (i.e. 1-2 SQL queries) way of finding all valid users if you’'re using LDAP?


PS - To save everyone time: Yes, I do have alternate means of getting that information, but for reasons that don’‘t merit space here, I’'d prefer a more JM-based solution - if one exists.

If you are comfortable with java, html, and jsp you can modify the existing jsp pages to get the information that you desire.


I started to go down that road, and successfully built Jive from source, but digging into session-summary.jsp convinced me that it would probably be too much of a headache - cleaning it up and then making it available to anyone looks like about as much work as just writing a new plugin from scratch… which is certainly doable, just not a great use of time at the moment.

As lame as it sounds, I might just go the cowardly route and push the manually updated list of chat users to a database, and then use the presence plugin to ascertain, well, presence.

Thanks for the advice anyway - a plugin like that might be useful, particularly for a corporate environment where you may want all users to know who’‘s online (obviously not something you’‘d encourage in a public server!) If I ever get some more time to play, I’'ll contribute one.

Ok, what I’‘m about to share is a total hack, so Matt, Gato, et. al - don’'t shoot me…

I ran into a similar problem, and I had to make some compromises (though I was able to implement what you need by having our LDAP folks accept a list of ‘‘registered’’ users from me so that we can just use LDAP for the search). I generate our list of valid ‘‘registered’’ users with this query:

SELECT DISTINCT lower(username) FROM jiveroster WHERE recv != ‘‘1’’ AND status

!= ‘‘D’’"

The ‘‘and status != ‘‘D’’’’ part can be left out, since it is a column we added to the jiveroster table (doesn’'t affect operation of the server, but is there so that if someone leaves the company, we can flag their account as Deleted, and other maintenance scripts skip it). The ‘‘recv != 1’’ is the hack part. Basically, we make an assumption that a registered user is someone who has signed in and added at least one person to their buddy list. If they do that, and the presence information subscription is successfully exchanged, then recv will be a value other than 1.

Hope this helps.

-Guy Martin

P.S. - this is for Postgres, but I don’'t think the query has anything special in it that would prevent if from working elsewhere.