From 74471c1fbbb7e8a09a6958fa88930a2905b4a3eb Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 12 Jul 2017 17:15:31 +0500 Subject: Do not generate unathorized events if no one driver linked to device --- src/org/traccar/database/DriversManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/database/DriversManager.java b/src/org/traccar/database/DriversManager.java index 1744936e3..cba2e14c1 100644 --- a/src/org/traccar/database/DriversManager.java +++ b/src/org/traccar/database/DriversManager.java @@ -214,7 +214,11 @@ public class DriversManager { public final boolean authorizeDriverByUniqueId(String driverUniqueId, long deviceId) { if (driversByUniqueId.containsKey(driverUniqueId)) { long chekingDriverId = getDriverByUniqueId(driverUniqueId).getId(); - for (long driverId : getAllDeviceDrivers(deviceId)) { + Set deviceDrivers = getAllDeviceDrivers(deviceId); + if (deviceDrivers.isEmpty()) { + return true; + } + for (long driverId : deviceDrivers) { if (chekingDriverId == driverId) { return true; } -- cgit v1.2.3