aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/reports
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-01-27 07:09:07 -0800
committerAnton Tananaev <anton@traccar.org>2023-01-27 07:09:07 -0800
commit0999180f58cf6a0edaf08461674eae70e839f3ce (patch)
treec417e1e267d1d5332fcfcd7a5e7e20fef13127f1 /src/main/java/org/traccar/reports
parent18387265cd9432a906cd16b7d71547be5bf46086 (diff)
downloadtrackermap-server-0999180f58cf6a0edaf08461674eae70e839f3ce.tar.gz
trackermap-server-0999180f58cf6a0edaf08461674eae70e839f3ce.tar.bz2
trackermap-server-0999180f58cf6a0edaf08461674eae70e839f3ce.zip
Disable scheduling task
Diffstat (limited to 'src/main/java/org/traccar/reports')
-rw-r--r--src/main/java/org/traccar/reports/common/ReportMailer.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/reports/common/ReportMailer.java b/src/main/java/org/traccar/reports/common/ReportMailer.java
index 1723c0e3b..221b35ae1 100644
--- a/src/main/java/org/traccar/reports/common/ReportMailer.java
+++ b/src/main/java/org/traccar/reports/common/ReportMailer.java
@@ -17,13 +17,10 @@ package org.traccar.reports.common;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.traccar.api.security.PermissionsService;
import org.traccar.mail.MailManager;
import org.traccar.model.User;
-import org.traccar.storage.Storage;
import org.traccar.storage.StorageException;
-import org.traccar.storage.query.Columns;
-import org.traccar.storage.query.Condition;
-import org.traccar.storage.query.Request;
import javax.activation.DataHandler;
import javax.inject.Inject;
@@ -37,12 +34,12 @@ public class ReportMailer {
private static final Logger LOGGER = LoggerFactory.getLogger(ReportMailer.class);
- private final Storage storage;
+ private final PermissionsService permissionsService;
private final MailManager mailManager;
@Inject
- public ReportMailer(Storage storage, MailManager mailManager) {
- this.storage = storage;
+ public ReportMailer(PermissionsService permissionsService, MailManager mailManager) {
+ this.permissionsService = permissionsService;
this.mailManager = mailManager;
}
@@ -57,8 +54,7 @@ public class ReportMailer {
attachment.setDataHandler(new DataHandler(new ByteArrayDataSource(
stream.toByteArray(), "application/octet-stream")));
- User user = storage.getObject(
- User.class, new Request(new Columns.All(), new Condition.Equals("id", userId)));
+ User user = permissionsService.getUser(userId);
mailManager.sendMessage(user, "Report", "The report is in the attachment.", attachment);
} catch (StorageException | IOException | MessagingException e) {
LOGGER.warn("Email report failed", e);