aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-10-22 18:55:34 +0500
committerAbyss777 <abyss@fox5.ru>2017-10-22 19:22:49 +0500
commited72ff6e7f964bc56a4948c15c97f37c072bf326 (patch)
tree70568d6af20bc90a071c907583ccb951059bcd2a /src/org/traccar/api/resource
parent9ace2318b9ea5a2d949800eedff8398808d3a6ce (diff)
downloadtraccar-server-ed72ff6e7f964bc56a4948c15c97f37c072bf326.tar.gz
traccar-server-ed72ff6e7f964bc56a4948c15c97f37c072bf326.tar.bz2
traccar-server-ed72ff6e7f964bc56a4948c15c97f37c072bf326.zip
Set deviceId in Saved Command before send
Diffstat (limited to 'src/org/traccar/api/resource')
-rw-r--r--src/org/traccar/api/resource/CommandResource.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/org/traccar/api/resource/CommandResource.java b/src/org/traccar/api/resource/CommandResource.java
index 996c15daf..a25421e31 100644
--- a/src/org/traccar/api/resource/CommandResource.java
+++ b/src/org/traccar/api/resource/CommandResource.java
@@ -62,17 +62,14 @@ public class CommandResource extends ExtendedObjectResource<Command> {
Context.getPermissionsManager().checkReadonly(getUserId());
long deviceId = entity.getDeviceId();
long id = entity.getId();
- boolean sent;
- if (deviceId != 0 && id != 0) {
+ Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
+ if (id != 0) {
Context.getPermissionsManager().checkPermission(Command.class, getUserId(), id);
- Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
Context.getPermissionsManager().checkUserDeviceCommand(getUserId(), deviceId, id);
- sent = Context.getCommandsManager().sendCommand(id, deviceId);
} else {
Context.getPermissionsManager().checkLimitCommands(getUserId());
- Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
- sent = Context.getCommandsManager().sendCommand(entity, deviceId);
}
+ boolean sent = Context.getCommandsManager().sendCommand(entity);
if (!sent) {
return Response.accepted(entity).build();
}