diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/web/DeviceServlet.java | 10 |
1 files changed, 9 insertions, 1 deletions
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))); } } |