aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/CommandTypeResource.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api/resource/CommandTypeResource.java')
-rw-r--r--src/org/traccar/api/resource/CommandTypeResource.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/api/resource/CommandTypeResource.java b/src/org/traccar/api/resource/CommandTypeResource.java
index d5d220547..30f9300cb 100644
--- a/src/org/traccar/api/resource/CommandTypeResource.java
+++ b/src/org/traccar/api/resource/CommandTypeResource.java
@@ -36,8 +36,12 @@ public class CommandTypeResource extends BaseResource {
@GET
public Collection<CommandType> get(@QueryParam("deviceId") long deviceId,
@QueryParam("textChannel") boolean textChannel) {
- Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
- return Context.getDeviceManager().getCommandTypes(deviceId, textChannel);
+ if (deviceId != 0) {
+ Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
+ return Context.getCommandsManager().getCommandTypes(deviceId, textChannel);
+ } else {
+ return Context.getCommandsManager().getAllCommandTypes();
+ }
}
}