diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-01-11 07:20:18 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-11 07:20:18 +1300 |
commit | df584abd8c0be33c21870dc107ea3dd0d8bc2dfd (patch) | |
tree | 93d1eaebb6f638179912dd787f06034096b35650 | |
parent | 232de5f0daef98f31b28d177d991fdbfa191f195 (diff) | |
parent | 11601949460beb5ef621e9f2c776900f48b3e96c (diff) | |
download | traccar-server-df584abd8c0be33c21870dc107ea3dd0d8bc2dfd.tar.gz traccar-server-df584abd8c0be33c21870dc107ea3dd0d8bc2dfd.tar.bz2 traccar-server-df584abd8c0be33c21870dc107ea3dd0d8bc2dfd.zip |
Merge pull request #3709 from parveenkumardeeva/master
Odometer permission to both Admin or Manager
-rw-r--r-- | src/org/traccar/api/resource/DeviceResource.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/api/resource/DeviceResource.java b/src/org/traccar/api/resource/DeviceResource.java index 0ea532567..ddf8832ed 100644 --- a/src/org/traccar/api/resource/DeviceResource.java +++ b/src/org/traccar/api/resource/DeviceResource.java @@ -88,7 +88,10 @@ public class DeviceResource extends BaseObjectResource<Device> { @Path("{id}/distance") @PUT public Response updateTotalDistance(DeviceTotalDistance entity) throws SQLException { - Context.getPermissionsManager().checkAdmin(getUserId()); + if (!Context.getPermissionsManager().getUserAdmin(getUserId())) { + Context.getPermissionsManager().checkManager(getUserId()); + Context.getPermissionsManager().checkPermission(Device.class, getUserId(), entity.getDeviceId()); + } Context.getDeviceManager().resetTotalDistance(entity); LogAction.resetTotalDistance(getUserId(), entity.getDeviceId()); return Response.noContent().build(); |