aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/EventResource.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-10-19 18:35:28 +0500
committerAbyss777 <abyss@fox5.ru>2016-10-19 18:35:28 +0500
commit17f5a899a08b992507b574eeb4047b1f6bfa8629 (patch)
tree38044c918384b21e9533452d6a408f0935c96a1e /src/org/traccar/api/resource/EventResource.java
parentc613143105d9f7c898dd3fb236d683b76cf8a42c (diff)
downloadtrackermap-server-17f5a899a08b992507b574eeb4047b1f6bfa8629.tar.gz
trackermap-server-17f5a899a08b992507b574eeb4047b1f6bfa8629.tar.bz2
trackermap-server-17f5a899a08b992507b574eeb4047b1f6bfa8629.zip
- Filter events on server side
- Use common path for templates - Filter events about geofences that user do not have access (minor security fix) - Removed unused function - Visual templates improvements
Diffstat (limited to 'src/org/traccar/api/resource/EventResource.java')
-rw-r--r--src/org/traccar/api/resource/EventResource.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/org/traccar/api/resource/EventResource.java b/src/org/traccar/api/resource/EventResource.java
index 74a748ea5..c0a8f968d 100644
--- a/src/org/traccar/api/resource/EventResource.java
+++ b/src/org/traccar/api/resource/EventResource.java
@@ -1,14 +1,12 @@
package org.traccar.api.resource;
import java.sql.SQLException;
-import java.util.Collection;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.traccar.Context;
@@ -26,14 +24,9 @@ public class EventResource extends BaseResource {
public Event get(@PathParam("id") long id) throws SQLException {
Event event = Context.getDataManager().getEvent(id);
Context.getPermissionsManager().checkDevice(getUserId(), event.getDeviceId());
+ if (event.getGeofenceId() != 0) {
+ Context.getPermissionsManager().checkGeofence(getUserId(), event.getGeofenceId());
+ }
return event;
}
-
- @GET
- public Collection<Event> get(
- @QueryParam("deviceId") long deviceId, @QueryParam("type") String type,
- @QueryParam("interval") int interval) throws SQLException {
- Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
- return Context.getDataManager().getLastEvents(deviceId, type, interval);
- }
}