diff options
author | parveenkumaryadav <parveenkumardeeva@gmail.com> | 2018-01-10 17:27:41 +0530 |
---|---|---|
committer | parveenkumaryadav <parveenkumardeeva@gmail.com> | 2018-01-10 17:27:41 +0530 |
commit | 11601949460beb5ef621e9f2c776900f48b3e96c (patch) | |
tree | 93d1eaebb6f638179912dd787f06034096b35650 /src/org/traccar/api | |
parent | 6428e67fe7732d15adcf27ffd261e3eda96840cd (diff) | |
download | traccar-server-11601949460beb5ef621e9f2c776900f48b3e96c.tar.gz traccar-server-11601949460beb5ef621e9f2c776900f48b3e96c.tar.bz2 traccar-server-11601949460beb5ef621e9f2c776900f48b3e96c.zip |
Simplify Odometer permission API
Diffstat (limited to 'src/org/traccar/api')
-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 c04b3b474..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().checkDeviceManagerOrAdmin(getUserId(), entity.getDeviceId()); + 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(); |