diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-12 11:06:22 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-12 11:06:22 -0700 |
commit | 3f46f759c24746ddd2b8cd05cfc6cb99d5f7fd48 (patch) | |
tree | df5d4afa522f2287a60e351ebf7be972b86b65f9 /src/main/java/org/traccar/session/cache | |
parent | 7ccffa266e87badbbcfde73db86216fd4c667f35 (diff) | |
download | trackermap-server-3f46f759c24746ddd2b8cd05cfc6cb99d5f7fd48.tar.gz trackermap-server-3f46f759c24746ddd2b8cd05cfc6cb99d5f7fd48.tar.bz2 trackermap-server-3f46f759c24746ddd2b8cd05cfc6cb99d5f7fd48.zip |
Filter notifications by device access (fix #4888)
Diffstat (limited to 'src/main/java/org/traccar/session/cache')
-rw-r--r-- | src/main/java/org/traccar/session/cache/CacheManager.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/session/cache/CacheManager.java b/src/main/java/org/traccar/session/cache/CacheManager.java index cd71f5f9f..c1697faf9 100644 --- a/src/main/java/org/traccar/session/cache/CacheManager.java +++ b/src/main/java/org/traccar/session/cache/CacheManager.java @@ -123,10 +123,14 @@ public class CacheManager implements BroadcastInterface { } } - public List<User> getNotificationUsers(long notificationId) { + public List<User> getNotificationUsers(long notificationId, long deviceId) { try { lock.readLock().lock(); - return notificationUsers.get(notificationId); + var users = deviceLinks.get(deviceId).get(User.class).stream() + .collect(Collectors.toUnmodifiableSet()); + return notificationUsers.get(notificationId).stream() + .filter(user -> users.contains(user.getId())) + .collect(Collectors.toUnmodifiableList()); } finally { lock.readLock().unlock(); } |