aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/resource
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-05-29 17:35:48 -0700
committerAnton Tananaev <anton@traccar.org>2024-05-29 17:35:48 -0700
commit1ed6886245859754efac76ba8cc412d3ec61523b (patch)
tree5ec5e8dce4c937dedf086ff547aa59f1a1893958 /src/main/java/org/traccar/api/resource
parent4ebc4c6ee6539af45aacf284e331de1fd79b0d0c (diff)
downloadtrackermap-server-1ed6886245859754efac76ba8cc412d3ec61523b.tar.gz
trackermap-server-1ed6886245859754efac76ba8cc412d3ec61523b.tar.bz2
trackermap-server-1ed6886245859754efac76ba8cc412d3ec61523b.zip
Allow regular users edit accumulators
Diffstat (limited to 'src/main/java/org/traccar/api/resource')
-rw-r--r--src/main/java/org/traccar/api/resource/DeviceResource.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/api/resource/DeviceResource.java b/src/main/java/org/traccar/api/resource/DeviceResource.java
index 56253152f..971c29c60 100644
--- a/src/main/java/org/traccar/api/resource/DeviceResource.java
+++ b/src/main/java/org/traccar/api/resource/DeviceResource.java
@@ -137,10 +137,8 @@ public class DeviceResource extends BaseObjectResource<Device> {
@Path("{id}/accumulators")
@PUT
public Response updateAccumulators(DeviceAccumulators entity) throws Exception {
- if (permissionsService.notAdmin(getUserId())) {
- permissionsService.checkManager(getUserId());
- permissionsService.checkPermission(Device.class, getUserId(), entity.getDeviceId());
- }
+ permissionsService.checkEdit(getUserId(), Device.class, false);
+ permissionsService.checkPermission(Device.class, getUserId(), entity.getDeviceId());
Position position = storage.getObject(Position.class, new Request(
new Columns.All(), new Condition.LatestPositions(entity.getDeviceId())));
@@ -171,7 +169,7 @@ public class DeviceResource extends BaseObjectResource<Device> {
throw new IllegalArgumentException();
}
- LogAction.resetDeviceAccumulators(getUserId(), entity.getDeviceId());
+ LogAction.resetAccumulators(getUserId(), entity.getDeviceId());
return Response.noContent().build();
}