aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api/resource')
-rw-r--r--src/org/traccar/api/resource/DeviceGeofenceResource.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/org/traccar/api/resource/DeviceGeofenceResource.java b/src/org/traccar/api/resource/DeviceGeofenceResource.java
index dc7014d79..99d64292b 100644
--- a/src/org/traccar/api/resource/DeviceGeofenceResource.java
+++ b/src/org/traccar/api/resource/DeviceGeofenceResource.java
@@ -17,7 +17,7 @@ package org.traccar.api.resource;
import org.traccar.Context;
import org.traccar.api.BaseResource;
-import org.traccar.model.UserDeviceGeofence;
+import org.traccar.model.DeviceGeofence;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -35,25 +35,21 @@ import java.sql.SQLException;
public class DeviceGeofenceResource extends BaseResource {
@POST
- public Response add(UserDeviceGeofence entity) throws SQLException {
+ public Response add(DeviceGeofence entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
- Context.getPermissionsManager().checkUser(getUserId(), entity.getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId());
Context.getPermissionsManager().checkGeofence(getUserId(), entity.getGeofenceId());
- Context.getDataManager().linkUserDeviceGeofence(entity.getUserId(),
- entity.getDeviceId(), entity.getGeofenceId());
+ Context.getDataManager().linkDeviceGeofence(entity.getDeviceId(), entity.getGeofenceId());
Context.getGeofenceManager().refresh();
return Response.ok(entity).build();
}
@DELETE
- public Response remove(UserDeviceGeofence entity) throws SQLException {
+ public Response remove(DeviceGeofence entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
- Context.getPermissionsManager().checkUser(getUserId(), entity.getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId());
Context.getPermissionsManager().checkGeofence(getUserId(), entity.getGeofenceId());
- Context.getDataManager().unlinkUserDeviceGeofence(entity.getUserId(), entity.getDeviceId(),
- entity.getGeofenceId());
+ Context.getDataManager().unlinkDeviceGeofence(entity.getDeviceId(), entity.getGeofenceId());
Context.getGeofenceManager().refresh();
return Response.noContent().build();
}