diff options
Diffstat (limited to 'src/org/traccar/api/resource')
5 files changed, 9 insertions, 9 deletions
diff --git a/src/org/traccar/api/resource/AttributeAliasResource.java b/src/org/traccar/api/resource/AttributeAliasResource.java index 9e01432d3..db767616f 100644 --- a/src/org/traccar/api/resource/AttributeAliasResource.java +++ b/src/org/traccar/api/resource/AttributeAliasResource.java @@ -64,7 +64,7 @@ public class AttributeAliasResource extends BaseResource { @Path("{id}") @PUT - public Response update(@PathParam("id") long id, AttributeAlias entity) throws SQLException { + public Response update(AttributeAlias entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); if (!Context.getPermissionsManager().isAdmin(getUserId())) { AttributeAlias oldEntity = Context.getAliasesManager().getAttributeAlias(entity.getId()); diff --git a/src/org/traccar/api/resource/DeviceResource.java b/src/org/traccar/api/resource/DeviceResource.java index 0b389ede1..e4ecd3625 100644 --- a/src/org/traccar/api/resource/DeviceResource.java +++ b/src/org/traccar/api/resource/DeviceResource.java @@ -76,9 +76,9 @@ public class DeviceResource extends BaseResource { @Path("{id}") @PUT - public Response update(@PathParam("id") long id, Device entity) throws SQLException { + public Response update(Device entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); - Context.getPermissionsManager().checkDevice(getUserId(), id); + Context.getPermissionsManager().checkDevice(getUserId(), entity.getId()); Context.getDeviceManager().updateDevice(entity); if (Context.getGeofenceManager() != null) { Context.getGeofenceManager().refresh(); @@ -102,7 +102,7 @@ public class DeviceResource extends BaseResource { @Path("{id}/distance") @PUT - public Response updateTotalDistance(@PathParam("id") long id, DeviceTotalDistance entity) throws SQLException { + public Response updateTotalDistance(DeviceTotalDistance entity) throws SQLException { Context.getPermissionsManager().checkAdmin(getUserId()); Context.getDeviceManager().resetTotalDistance(entity); return Response.noContent().build(); diff --git a/src/org/traccar/api/resource/GeofenceResource.java b/src/org/traccar/api/resource/GeofenceResource.java index df5eb2414..591908813 100644 --- a/src/org/traccar/api/resource/GeofenceResource.java +++ b/src/org/traccar/api/resource/GeofenceResource.java @@ -88,9 +88,9 @@ public class GeofenceResource extends BaseResource { @Path("{id}") @PUT - public Response update(@PathParam("id") long id, Geofence entity) throws SQLException { + public Response update(Geofence entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); - Context.getPermissionsManager().checkGeofence(getUserId(), id); + Context.getPermissionsManager().checkGeofence(getUserId(), entity.getId()); Context.getGeofenceManager().updateGeofence(entity); return Response.ok(entity).build(); } diff --git a/src/org/traccar/api/resource/GroupResource.java b/src/org/traccar/api/resource/GroupResource.java index 0bc42ea97..c98a20b7e 100644 --- a/src/org/traccar/api/resource/GroupResource.java +++ b/src/org/traccar/api/resource/GroupResource.java @@ -67,9 +67,9 @@ public class GroupResource extends BaseResource { @Path("{id}") @PUT - public Response update(@PathParam("id") long id, Group entity) throws SQLException { + public Response update(Group entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); - Context.getPermissionsManager().checkGroup(getUserId(), id); + Context.getPermissionsManager().checkGroup(getUserId(), entity.getId()); Context.getDeviceManager().updateGroup(entity); if (Context.getGeofenceManager() != null) { Context.getGeofenceManager().refresh(); diff --git a/src/org/traccar/api/resource/UserResource.java b/src/org/traccar/api/resource/UserResource.java index 2ff1639f6..a9edced25 100644 --- a/src/org/traccar/api/resource/UserResource.java +++ b/src/org/traccar/api/resource/UserResource.java @@ -59,7 +59,7 @@ public class UserResource extends BaseResource { @Path("{id}") @PUT - public Response update(@PathParam("id") long id, User entity) throws SQLException { + public Response update(User entity) throws SQLException { User old = Context.getPermissionsManager().getUser(entity.getId()); if (old.getExpirationTime() == null && entity.getExpirationTime() != null || old.getExpirationTime() != null && !old.getExpirationTime().equals(entity.getExpirationTime()) |