diff options
Diffstat (limited to 'src/org/traccar/web/PositionServlet.java')
-rw-r--r-- | src/org/traccar/web/PositionServlet.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/org/traccar/web/PositionServlet.java b/src/org/traccar/web/PositionServlet.java index 796d6a81f..c63968251 100644 --- a/src/org/traccar/web/PositionServlet.java +++ b/src/org/traccar/web/PositionServlet.java @@ -23,8 +23,9 @@ import org.traccar.model.Position; import java.util.HashMap; import java.util.Map; +import org.traccar.model.Device; -public class PositionServlet extends BaseServlet { +public class PositionServlet extends BaseServletResource<Position> { @Override protected boolean handle(String command, HttpServletRequest req, HttpServletResponse resp) throws Exception { @@ -42,9 +43,10 @@ public class PositionServlet extends BaseServlet { return true; } - private void get(HttpServletRequest req, HttpServletResponse resp) throws Exception { + @Override + protected void get(HttpServletRequest req, HttpServletResponse resp) throws Exception { long deviceId = Long.parseLong(req.getParameter("deviceId")); - Context.getPermissionsManager().checkDevice(getUserId(req), deviceId); + Context.getPermissionsManager().check(Device.class, getUserId(req), deviceId); sendResponse(resp.getWriter(), JsonConverter.arrayToJson( Context.getDataManager().getPositions( getUserId(req), deviceId, @@ -59,7 +61,7 @@ public class PositionServlet extends BaseServlet { for (String deviceIdString : req.getParameterValues("devicesId")) { Long deviceId = Long.parseLong(deviceIdString); - Context.getPermissionsManager().checkDevice(userId, deviceId); + Context.getPermissionsManager().check(Device.class, userId, deviceId); Position position = Context.getConnectionManager().getLastPosition(deviceId); positions.put(deviceId.toString(), position); |