From 6ce1f7d481aec69107ef34924bda57fafbce67ed Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 15 Oct 2015 15:26:25 +1300 Subject: Service call to get all devices --- src/org/traccar/web/DeviceServlet.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/web') 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 { -- cgit v1.2.3