-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RA-552:Adding the View Logged in Users functionality to core
- Loading branch information
1 parent
fb44e6b
commit fcdf1df
Showing
4 changed files
with
55 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.util; | ||
|
||
import java.util.Collections; | ||
import java.util.LinkedHashSet; | ||
import java.util.Set; | ||
import org.openmrs.User; | ||
import org.openmrs.UserSessionListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CurrentUsers implements UserSessionListener { | ||
|
||
private static Set<String> currentlyLoggedInUsers = Collections.synchronizedSet(new LinkedHashSet(500)); | ||
|
||
@Override | ||
public void loggedInOrOut(User user, Event event, Status status) { | ||
if(!(status == Status.SUCCESS)) { | ||
return; | ||
} | ||
if(event == Event.LOGIN) { | ||
currentlyLoggedInUsers.add(user.getUsername()); | ||
} | ||
else if(event == Event.LOGOUT) { | ||
currentlyLoggedInUsers.remove(user.getUsername()); | ||
} | ||
} | ||
|
||
public static Set<String> getCurrentUsernames(){ | ||
return Collections.unmodifiableSet(new LinkedHashSet(currentlyLoggedInUsers)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 0 additions & 121 deletions
121
web/src/main/java/org/openmrs/web/filter/util/CurrentUsers.java
This file was deleted.
Oops, something went wrong.