From 9d159c880ab0fdb3f6f632dcb80577c6c2fb2f11 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 15 Oct 2015 16:28:42 +1300 Subject: Load and select user device list --- src/org/traccar/web/DeviceServlet.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/web/DeviceServlet.java b/src/org/traccar/web/DeviceServlet.java index cbbb41b9a..1ae94c1d0 100644 --- a/src/org/traccar/web/DeviceServlet.java +++ b/src/org/traccar/web/DeviceServlet.java @@ -50,8 +50,16 @@ public class DeviceServlet extends BaseServlet { sendResponse(resp.getWriter(), JsonConverter.arrayToJson( Context.getDataManager().getAllDevices())); } else { + long userId; + String userIdParam = req.getParameter("userId"); + if (userIdParam != null) { + userId = Long.parseLong(userIdParam); + } else { + userId = getUserId(req); + } + Context.getPermissionsManager().checkUser(getUserId(req), userId); sendResponse(resp.getWriter(), JsonConverter.arrayToJson( - Context.getDataManager().getDevices(getUserId(req)))); + Context.getDataManager().getDevices(userId))); } } -- cgit v1.2.3