aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-04-19 06:29:50 -0700
committerAnton Tananaev <anton@traccar.org>2023-04-19 06:29:50 -0700
commitab801e856521356ff7a33250e1abdb8857ef84b3 (patch)
tree69033f3d4bd7c3fb6dcf00b6974b6ac56410d015 /src/main/java/org/traccar/api
parentf982ed08a3d21e8eb6e9bbf4c25698ecbaad5b37 (diff)
downloadtrackermap-server-ab801e856521356ff7a33250e1abdb8857ef84b3.tar.gz
trackermap-server-ab801e856521356ff7a33250e1abdb8857ef84b3.tar.bz2
trackermap-server-ab801e856521356ff7a33250e1abdb8857ef84b3.zip
Fix group commands
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/resource/CommandResource.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/api/resource/CommandResource.java b/src/main/java/org/traccar/api/resource/CommandResource.java
index 7ba1ee2b4..b69d4d9ac 100644
--- a/src/main/java/org/traccar/api/resource/CommandResource.java
+++ b/src/main/java/org/traccar/api/resource/CommandResource.java
@@ -28,6 +28,7 @@ import org.traccar.model.Command;
import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.model.Position;
+import org.traccar.model.QueuedCommand;
import org.traccar.model.Typed;
import org.traccar.model.User;
import org.traccar.model.UserRestrictions;
@@ -121,8 +122,9 @@ public class CommandResource extends ExtendedObjectResource<Command> {
permissionsService.checkPermission(Group.class, getUserId(), groupId);
var devices = DeviceUtil.getAccessibleDevices(storage, getUserId(), List.of(), List.of(groupId));
for (Device device : devices) {
- entity.setDeviceId(device.getId());
- result = result && commandsManager.sendCommand(entity);
+ Command command = QueuedCommand.fromCommand(entity).toCommand();
+ command.setDeviceId(device.getId());
+ result = result && commandsManager.sendCommand(command);
}
} else {
permissionsService.checkPermission(Device.class, getUserId(), entity.getDeviceId());