aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/session/ConnectionManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-16 07:18:33 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-16 07:18:33 -0700
commitcc342a9ba371b0dca8d87ca9e74c5907ccb58bc6 (patch)
tree6d0354e4a357eb314eeaad044ad9591f9f98f867 /src/main/java/org/traccar/session/ConnectionManager.java
parentd3e83f9fa0d066e5a15fde225599cc43071c031a (diff)
downloadtrackermap-server-cc342a9ba371b0dca8d87ca9e74c5907ccb58bc6.tar.gz
trackermap-server-cc342a9ba371b0dca8d87ca9e74c5907ccb58bc6.tar.bz2
trackermap-server-cc342a9ba371b0dca8d87ca9e74c5907ccb58bc6.zip
Permissions manager refactor
Diffstat (limited to 'src/main/java/org/traccar/session/ConnectionManager.java')
-rw-r--r--src/main/java/org/traccar/session/ConnectionManager.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/session/ConnectionManager.java b/src/main/java/org/traccar/session/ConnectionManager.java
index dc714379b..c8c07f9c7 100644
--- a/src/main/java/org/traccar/session/ConnectionManager.java
+++ b/src/main/java/org/traccar/session/ConnectionManager.java
@@ -31,6 +31,7 @@ import org.traccar.handler.events.OverspeedEventHandler;
import org.traccar.model.Device;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import org.traccar.model.User;
import org.traccar.session.cache.CacheManager;
import org.traccar.storage.Storage;
import org.traccar.storage.StorageException;
@@ -297,9 +298,9 @@ public class ConnectionManager {
}
public synchronized void updateDevice(Device device) {
- for (long userId : Context.getPermissionsManager().getDeviceUsers(device.getId())) {
- if (listeners.containsKey(userId)) {
- for (UpdateListener listener : listeners.get(userId)) {
+ for (User user : cacheManager.getDeviceObjects(device.getId(), User.class)) {
+ if (listeners.containsKey(user.getId())) {
+ for (UpdateListener listener : listeners.get(user.getId())) {
listener.onUpdateDevice(device);
}
}
@@ -308,10 +309,9 @@ public class ConnectionManager {
public synchronized void updatePosition(Position position) {
long deviceId = position.getDeviceId();
-
- for (long userId : Context.getPermissionsManager().getDeviceUsers(deviceId)) {
- if (listeners.containsKey(userId)) {
- for (UpdateListener listener : listeners.get(userId)) {
+ for (User user : cacheManager.getDeviceObjects(deviceId, User.class)) {
+ if (listeners.containsKey(user.getId())) {
+ for (UpdateListener listener : listeners.get(user.getId())) {
listener.onUpdatePosition(position);
}
}