aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-06-01 07:57:30 -0700
committerAnton Tananaev <anton@traccar.org>2024-06-01 07:57:30 -0700
commit8b46ee99757a0c0c02051bba07679a2c37be08e7 (patch)
treebe7b9acff6aad57635c6d58751713103efc4bf29 /src/main/java/org/traccar/api
parentc21ca48b6b255cde193efb476f83b1fac5c894f2 (diff)
downloadtrackermap-server-8b46ee99757a0c0c02051bba07679a2c37be08e7.tar.gz
trackermap-server-8b46ee99757a0c0c02051bba07679a2c37be08e7.tar.bz2
trackermap-server-8b46ee99757a0c0c02051bba07679a2c37be08e7.zip
Log command actions
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/resource/CommandResource.java3
-rw-r--r--src/main/java/org/traccar/api/resource/ReportResource.java22
2 files changed, 14 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/api/resource/CommandResource.java b/src/main/java/org/traccar/api/resource/CommandResource.java
index c23d91e77..66ec0f8a3 100644
--- a/src/main/java/org/traccar/api/resource/CommandResource.java
+++ b/src/main/java/org/traccar/api/resource/CommandResource.java
@@ -23,6 +23,7 @@ import org.traccar.BaseProtocol;
import org.traccar.ServerManager;
import org.traccar.api.ExtendedObjectResource;
import org.traccar.database.CommandsManager;
+import org.traccar.helper.LogAction;
import org.traccar.helper.model.DeviceUtil;
import org.traccar.model.Command;
import org.traccar.model.Device;
@@ -140,6 +141,8 @@ public class CommandResource extends ExtendedObjectResource<Command> {
return Response.accepted(queuedCommand).build();
}
}
+
+ LogAction.command(getUserId(), groupId, entity.getDeviceId(), entity.getType());
return Response.ok(entity).build();
}
diff --git a/src/main/java/org/traccar/api/resource/ReportResource.java b/src/main/java/org/traccar/api/resource/ReportResource.java
index 2ed119298..81f409c0f 100644
--- a/src/main/java/org/traccar/api/resource/ReportResource.java
+++ b/src/main/java/org/traccar/api/resource/ReportResource.java
@@ -113,7 +113,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("from") Date from,
@QueryParam("to") Date to) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
- LogAction.logReport(getUserId(), false, "combined", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "combined", from, to, deviceIds, groupIds);
return combinedReportProvider.getObjects(getUserId(), deviceIds, groupIds, from, to);
}
@@ -125,7 +125,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("from") Date from,
@QueryParam("to") Date to) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
- LogAction.logReport(getUserId(), false, "route", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "route", from, to, deviceIds, groupIds);
return routeReportProvider.getObjects(getUserId(), deviceIds, groupIds, from, to);
}
@@ -140,7 +140,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("mail") boolean mail) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
return executeReport(getUserId(), mail, stream -> {
- LogAction.logReport(getUserId(), false, "route", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "route", from, to, deviceIds, groupIds);
routeReportProvider.getExcel(stream, getUserId(), deviceIds, groupIds, from, to);
});
}
@@ -166,7 +166,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("from") Date from,
@QueryParam("to") Date to) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
- LogAction.logReport(getUserId(), false, "events", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "events", from, to, deviceIds, groupIds);
return eventsReportProvider.getObjects(getUserId(), deviceIds, groupIds, types, from, to);
}
@@ -182,7 +182,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("mail") boolean mail) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
return executeReport(getUserId(), mail, stream -> {
- LogAction.logReport(getUserId(), false, "events", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "events", from, to, deviceIds, groupIds);
eventsReportProvider.getExcel(stream, getUserId(), deviceIds, groupIds, types, from, to);
});
}
@@ -209,7 +209,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("to") Date to,
@QueryParam("daily") boolean daily) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
- LogAction.logReport(getUserId(), false, "summary", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "summary", from, to, deviceIds, groupIds);
return summaryReportProvider.getObjects(getUserId(), deviceIds, groupIds, from, to, daily);
}
@@ -225,7 +225,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("mail") boolean mail) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
return executeReport(getUserId(), mail, stream -> {
- LogAction.logReport(getUserId(), false, "summary", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "summary", from, to, deviceIds, groupIds);
summaryReportProvider.getExcel(stream, getUserId(), deviceIds, groupIds, from, to, daily);
});
}
@@ -251,7 +251,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("from") Date from,
@QueryParam("to") Date to) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
- LogAction.logReport(getUserId(), false, "trips", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "trips", from, to, deviceIds, groupIds);
return tripsReportProvider.getObjects(getUserId(), deviceIds, groupIds, from, to);
}
@@ -266,7 +266,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("mail") boolean mail) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
return executeReport(getUserId(), mail, stream -> {
- LogAction.logReport(getUserId(), false, "trips", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "trips", from, to, deviceIds, groupIds);
tripsReportProvider.getExcel(stream, getUserId(), deviceIds, groupIds, from, to);
});
}
@@ -291,7 +291,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("from") Date from,
@QueryParam("to") Date to) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
- LogAction.logReport(getUserId(), false, "stops", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "stops", from, to, deviceIds, groupIds);
return stopsReportProvider.getObjects(getUserId(), deviceIds, groupIds, from, to);
}
@@ -306,7 +306,7 @@ public class ReportResource extends SimpleObjectResource<Report> {
@QueryParam("mail") boolean mail) throws StorageException {
permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
return executeReport(getUserId(), mail, stream -> {
- LogAction.logReport(getUserId(), false, "stops", from, to, deviceIds, groupIds);
+ LogAction.report(getUserId(), false, "stops", from, to, deviceIds, groupIds);
stopsReportProvider.getExcel(stream, getUserId(), deviceIds, groupIds, from, to);
});
}