Skip to content

Commit

Permalink
RA-552:Adding the View Logged in Users functionality to core
Browse files Browse the repository at this point in the history
  • Loading branch information
HerbertYiga committed Jun 2, 2021
1 parent 2c095f5 commit efec5fb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/src/main/java/org/openmrs/util/CurrentUsers.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}

}
Expand Down

0 comments on commit efec5fb

Please sign in to comment.