diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/reports/common/ReportMailer.java | 14 | ||||
-rw-r--r-- | src/main/java/org/traccar/schedule/ScheduleManager.java | 1 |
2 files changed, 5 insertions, 10 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); diff --git a/src/main/java/org/traccar/schedule/ScheduleManager.java b/src/main/java/org/traccar/schedule/ScheduleManager.java index e1de3b3af..450e531a0 100644 --- a/src/main/java/org/traccar/schedule/ScheduleManager.java +++ b/src/main/java/org/traccar/schedule/ScheduleManager.java @@ -39,7 +39,6 @@ public class ScheduleManager implements LifecycleObject { public void start() { executor = Executors.newSingleThreadScheduledExecutor(); var tasks = List.of( - TaskReports.class, TaskDeviceInactivityCheck.class, TaskWebSocketKeepalive.class, TaskHealthCheck.class); |