From e40094735b4ddaf4de68bcf3858a9317adc8b3b7 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 26 Jan 2017 11:33:24 +0500 Subject: Device readonly user can't edit attribute aliases --- src/org/traccar/api/resource/AttributeAliasResource.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/org/traccar') diff --git a/src/org/traccar/api/resource/AttributeAliasResource.java b/src/org/traccar/api/resource/AttributeAliasResource.java index db767616f..b2636acf1 100644 --- a/src/org/traccar/api/resource/AttributeAliasResource.java +++ b/src/org/traccar/api/resource/AttributeAliasResource.java @@ -55,6 +55,7 @@ public class AttributeAliasResource extends BaseResource { @POST public Response add(AttributeAlias entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); + Context.getPermissionsManager().checkDeviceReadonly(getUserId()); if (!Context.getPermissionsManager().isAdmin(getUserId())) { Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId()); } @@ -66,6 +67,7 @@ public class AttributeAliasResource extends BaseResource { @PUT public Response update(AttributeAlias entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); + Context.getPermissionsManager().checkDeviceReadonly(getUserId()); if (!Context.getPermissionsManager().isAdmin(getUserId())) { AttributeAlias oldEntity = Context.getAliasesManager().getAttributeAlias(entity.getId()); Context.getPermissionsManager().checkDevice(getUserId(), oldEntity.getDeviceId()); @@ -79,6 +81,7 @@ public class AttributeAliasResource extends BaseResource { @DELETE public Response remove(@PathParam("id") long id) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); + Context.getPermissionsManager().checkDeviceReadonly(getUserId()); if (!Context.getPermissionsManager().isAdmin(getUserId())) { AttributeAlias entity = Context.getAliasesManager().getAttributeAlias(id); Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId()); -- cgit v1.2.3