From efec5fb5b749196e4b4ea5e3b0d6ac19edd52706 Mon Sep 17 00:00:00 2001 From: HerbertYiga Date: Wed, 2 Jun 2021 16:42:41 +0300 Subject: [PATCH] RA-552:Adding the View Logged in Users functionality to core --- api/src/main/java/org/openmrs/util/CurrentUsers.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/src/main/java/org/openmrs/util/CurrentUsers.java b/api/src/main/java/org/openmrs/util/CurrentUsers.java index 862cad23ff03..e46ebffe573a 100644 --- a/api/src/main/java/org/openmrs/util/CurrentUsers.java +++ b/api/src/main/java/org/openmrs/util/CurrentUsers.java @@ -14,6 +14,7 @@ import java.util.Set; import org.openmrs.User; import org.openmrs.UserSessionListener; +import org.openmrs.api.context.Context; import org.springframework.stereotype.Component; @Component @@ -27,10 +28,12 @@ public void loggedInOrOut(User user, Event event, Status status) { return; } if(event == Event.LOGIN) { + currentlyLoggedInUsers.add(user.getUsername()); } else if(event == Event.LOGOUT) { currentlyLoggedInUsers.remove(user.getUsername()); + Context.clearSession(); } }