From 21a916159a24db0cbec850b90381f9ff392f3c0e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 4 Nov 2022 08:55:31 -0700 Subject: Clean up command resource --- src/main/java/org/traccar/api/resource/CommandResource.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/traccar/api/resource/CommandResource.java b/src/main/java/org/traccar/api/resource/CommandResource.java index 80b9fd18f..6ef6ee9c5 100644 --- a/src/main/java/org/traccar/api/resource/CommandResource.java +++ b/src/main/java/org/traccar/api/resource/CommandResource.java @@ -84,10 +84,10 @@ public class CommandResource extends ExtendedObjectResource { permissionsService.checkPermission(Device.class, getUserId(), deviceId); BaseProtocol protocol = getDeviceProtocol(deviceId); - var commands = storage.getObjects(Command.class, new Request( + var commands = storage.getObjects(baseClass, new Request( new Columns.All(), Condition.merge(List.of( - new Condition.Permission(User.class, getUserId(), Command.class), + new Condition.Permission(User.class, getUserId(), baseClass), new Condition.Permission(Device.class, deviceId, baseClass) )))); @@ -107,7 +107,7 @@ public class CommandResource extends ExtendedObjectResource { public Response send(Command entity) throws Exception { permissionsService.checkRestriction(getUserId(), UserRestrictions::getReadonly); if (entity.getId() > 0) { - permissionsService.checkPermission(Command.class, getUserId(), entity.getId()); + permissionsService.checkPermission(baseClass, getUserId(), entity.getId()); long deviceId = entity.getDeviceId(); entity = storage.getObject(baseClass, new Request( new Columns.All(), new Condition.Equals("id", entity.getId()))); -- cgit v1.2.3