aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-04 10:01:55 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-04 10:01:55 +1200
commit15bccd650ea2236ba2ca7296a9c76bfb51208d5a (patch)
treeee16f37f035303b9166cf54195f8f68de4e92861 /src/org/traccar
parent8effc28a59e132982eced64ee470132bfe5a38b9 (diff)
downloadtraccar-server-15bccd650ea2236ba2ca7296a9c76bfb51208d5a.tar.gz
traccar-server-15bccd650ea2236ba2ca7296a9c76bfb51208d5a.tar.bz2
traccar-server-15bccd650ea2236ba2ca7296a9c76bfb51208d5a.zip
Security check for adding device
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/web/DeviceServlet.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/org/traccar/web/DeviceServlet.java b/src/org/traccar/web/DeviceServlet.java
index 6b65efa8b..f091be1af 100644
--- a/src/org/traccar/web/DeviceServlet.java
+++ b/src/org/traccar/web/DeviceServlet.java
@@ -51,8 +51,9 @@ public class DeviceServlet extends BaseServlet {
private void add(HttpServletRequest req, HttpServletResponse resp) throws Exception {
Device device = JsonConverter.objectFromJson(req.getReader(), new Device());
+ long userId = getUserId(req);
Context.getDataManager().addDevice(device);
- Context.getDataManager().linkDevice(getUserId(req), device.getId());
+ Context.getDataManager().linkDevice(userId, device.getId());
Context.getPermissionsManager().refresh();
sendResponse(resp.getWriter(), JsonConverter.objectToJson(device));
}