aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/DriverResource.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-07-20 08:56:29 +0500
committerAbyss777 <abyss@fox5.ru>2017-07-20 09:52:27 +0500
commitafb9a199f57824ec06c993b6028c35b616f64885 (patch)
tree1ab2531846dc1ff4c9b5e0d6d71ebcec231aff89 /src/org/traccar/api/resource/DriverResource.java
parenta9478ded48de140d47d17def1ee5329267fe6088 (diff)
downloadtrackermap-server-afb9a199f57824ec06c993b6028c35b616f64885.tar.gz
trackermap-server-afb9a199f57824ec06c993b6028c35b616f64885.tar.bz2
trackermap-server-afb9a199f57824ec06c993b6028c35b616f64885.zip
Combine permission resources and reuse common database functions
Diffstat (limited to 'src/org/traccar/api/resource/DriverResource.java')
-rw-r--r--src/org/traccar/api/resource/DriverResource.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/api/resource/DriverResource.java b/src/org/traccar/api/resource/DriverResource.java
index 3d6a12795..91a502790 100644
--- a/src/org/traccar/api/resource/DriverResource.java
+++ b/src/org/traccar/api/resource/DriverResource.java
@@ -19,6 +19,7 @@ package org.traccar.api.resource;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.Set;
import javax.ws.rs.Consumes;
@@ -86,7 +87,10 @@ public class DriverResource extends BaseResource {
public Response add(Driver entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
Context.getDriversManager().addItem(entity);
- Context.getDataManager().linkDriver(getUserId(), entity.getId());
+ LinkedHashMap<String, Long> link = new LinkedHashMap<>();
+ link.put("userId", getUserId());
+ link.put("driverId", entity.getId());
+ Context.getDataManager().linkObject(link, true);
Context.getDriversManager().refreshUserItems();
return Response.ok(entity).build();
}