aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-15 15:26:25 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-15 15:26:25 +1300
commit6ce1f7d481aec69107ef34924bda57fafbce67ed (patch)
treebbd4aaab6a22457391a6a6f99ca4dfd28704336f /src/org/traccar
parentd3ca7de349f1d8ab0d02bf783a2c7627af44c6fd (diff)
downloadtraccar-server-6ce1f7d481aec69107ef34924bda57fafbce67ed.tar.gz
traccar-server-6ce1f7d481aec69107ef34924bda57fafbce67ed.tar.bz2
traccar-server-6ce1f7d481aec69107ef34924bda57fafbce67ed.zip
Service call to get all devices
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/web/DeviceServlet.java8
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 {