Thanks for the links! That was very helpful.
It looks like to get a list of current users (which was one of my questions), I can simply call
org.openmrs.web.user.CurrentUsers,getCurrentUserNames
http://resources.openmrs.org/doc/org/openmrs/web/user/CurrentUsers.htmlWhen we send a message it will likely be in the form of a JSON object tagged with the sender & recipient, I can probably map that to names, but since names may change, it might be better to have a mapping of user ids.
So now I need to determine how to look up a user's id or possibly the entire user object and just grab the id from a method, all of which needs to be based on the name obtained from CurrentUsers.getCurrentUserNames
I can see that regardless of how I get the info, the individual user looking at the webpage is going to be an instance of
http://resources.openmrs.org/doc/org/openmrs/User.htmlWith this I can see that it looks like roles are obtained from either...
org.openmrs.User.getAllRoles() or hasRole(rolename) it also looks like there is a privileges attribute that I've never noticed before.
Maybe it would be a good idea to add a privilege to indicate the user can participate in chat, so instead of using roles we would just use the privilege instead and then add the privilege to the authenticated user role.
In that context, perhaps roles should be utilized for individual "chat rooms", I could see it being useful to get info from other sites...
"Hey other receptionists, does anyone know how I'm supposed to deal with ...?"
Now if I can just sort out how I'm supposed to get the currently logged in user object, I should have everything almost I need to make this happen, except...
One other thing that I had not thought of before, is that this simple module would likely impose a SarbOx load on any organization in the USA that would be using it, in addition to HIPAA.
These messages would probably be something that SarbOx mandates data retention for and because it's very likely that patient information will be traversing this medium, HIPAA is going to want things encrypted and restricted.
It might be a good idea to sign each message with a timestamp and a signature
It would also be a good idea to store the message encrypted with an AES key that is tied to the user roles.
Private messaging (as opposed to group chat) could be implemented by using a public/private key pair, so only the user the message is intended for could decrypt it.
As it turns out, I don't actually see anything related to encryption anywhere in the API yet.
I'll keep digging, but would really like any pointers.
Thanks again!