aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-07-12 17:15:31 +0500
committerAbyss777 <abyss@fox5.ru>2017-07-12 17:15:31 +0500
commit74471c1fbbb7e8a09a6958fa88930a2905b4a3eb (patch)
tree4c55cefc6ca61a3df7d9a66ac84ae8cd302bd29f /src/org
parentc13dce2dd0227f58135c1066461304bbdc551554 (diff)
downloadtraccar-server-74471c1fbbb7e8a09a6958fa88930a2905b4a3eb.tar.gz
traccar-server-74471c1fbbb7e8a09a6958fa88930a2905b4a3eb.tar.bz2
traccar-server-74471c1fbbb7e8a09a6958fa88930a2905b4a3eb.zip
Do not generate unathorized events if no one driver linked to device
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/database/DriversManager.java6
1 files changed, 5 insertions, 1 deletions
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<Long> deviceDrivers = getAllDeviceDrivers(deviceId);
+ if (deviceDrivers.isEmpty()) {
+ return true;
+ }
+ for (long driverId : deviceDrivers) {
if (chekingDriverId == driverId) {
return true;
}