diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/web/DeviceServlet.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/org/traccar/web/DeviceServlet.java b/src/org/traccar/web/DeviceServlet.java index 3e8c7f115..cbbb41b9a 100644 --- a/src/org/traccar/web/DeviceServlet.java +++ b/src/org/traccar/web/DeviceServlet.java @@ -45,8 +45,14 @@ public class DeviceServlet extends BaseServlet { } private void get(HttpServletRequest req, HttpServletResponse resp) throws Exception { - sendResponse(resp.getWriter(), JsonConverter.arrayToJson( + if (Boolean.parseBoolean(req.getParameter("all"))) { + Context.getPermissionsManager().checkAdmin(getUserId(req)); + sendResponse(resp.getWriter(), JsonConverter.arrayToJson( + Context.getDataManager().getAllDevices())); + } else { + sendResponse(resp.getWriter(), JsonConverter.arrayToJson( Context.getDataManager().getDevices(getUserId(req)))); + } } private void add(HttpServletRequest req, HttpServletResponse resp) throws Exception { |