aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/DeviceResource.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-20 21:12:37 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-20 21:12:37 +1300
commit2bb63a0b1c82c42c0d13614c5a67521130165368 (patch)
treeb3f161b35fb74e7996845fab420eec8a868017c8 /src/org/traccar/api/resource/DeviceResource.java
parent5947767811b376a26c550661a7f5362d0d884f84 (diff)
downloadtrackermap-server-2bb63a0b1c82c42c0d13614c5a67521130165368.tar.gz
trackermap-server-2bb63a0b1c82c42c0d13614c5a67521130165368.tar.bz2
trackermap-server-2bb63a0b1c82c42c0d13614c5a67521130165368.zip
Check readonly and registration flags
Diffstat (limited to 'src/org/traccar/api/resource/DeviceResource.java')
-rw-r--r--src/org/traccar/api/resource/DeviceResource.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/org/traccar/api/resource/DeviceResource.java b/src/org/traccar/api/resource/DeviceResource.java
index a25201678..a4bfc1030 100644
--- a/src/org/traccar/api/resource/DeviceResource.java
+++ b/src/org/traccar/api/resource/DeviceResource.java
@@ -55,6 +55,7 @@ public class DeviceResource extends BaseResource {
@POST
public Response add(Device entity) throws SQLException {
+ Context.getPermissionsManager().checkReadonly(getUserId());
Context.getDataManager().addDevice(entity);
Context.getDataManager().linkDevice(getUserId(), entity.getId());
Context.getPermissionsManager().refresh();
@@ -64,6 +65,7 @@ public class DeviceResource extends BaseResource {
@Path("{id}")
@PUT
public Response update(@PathParam("id") long id, Device entity) throws SQLException {
+ Context.getPermissionsManager().checkReadonly(getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), id);
Context.getDataManager().updateDevice(entity);
return Response.ok(entity).build();
@@ -72,6 +74,7 @@ public class DeviceResource extends BaseResource {
@Path("{id}")
@DELETE
public Response remove(@PathParam("id") long id) throws SQLException {
+ Context.getPermissionsManager().checkReadonly(getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), id);
Context.getDataManager().removeDevice(id);
Context.getPermissionsManager().refresh();