aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/resource/NotificationResource.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-07 06:48:53 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-07 06:48:53 -0700
commit8eecfdcf5c59f92158a6c339d1622e0e9d67968c (patch)
treef0bd5c9d391549ab7b98f87a86938a1341802a23 /src/main/java/org/traccar/api/resource/NotificationResource.java
parent669bdccecff50eaca46c815598df092ad0fe143d (diff)
downloadtrackermap-server-8eecfdcf5c59f92158a6c339d1622e0e9d67968c.tar.gz
trackermap-server-8eecfdcf5c59f92158a6c339d1622e0e9d67968c.tar.bz2
trackermap-server-8eecfdcf5c59f92158a6c339d1622e0e9d67968c.zip
Pass user to notificators
Diffstat (limited to 'src/main/java/org/traccar/api/resource/NotificationResource.java')
-rw-r--r--src/main/java/org/traccar/api/resource/NotificationResource.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/api/resource/NotificationResource.java b/src/main/java/org/traccar/api/resource/NotificationResource.java
index cf4b66fa1..2fc103e20 100644
--- a/src/main/java/org/traccar/api/resource/NotificationResource.java
+++ b/src/main/java/org/traccar/api/resource/NotificationResource.java
@@ -31,7 +31,9 @@ import org.traccar.api.ExtendedObjectResource;
import org.traccar.model.Event;
import org.traccar.model.Notification;
import org.traccar.model.Typed;
+import org.traccar.model.User;
import org.traccar.notification.MessageException;
+import org.traccar.storage.StorageException;
@Path("notifications")
@Produces(MediaType.APPLICATION_JSON)
@@ -56,10 +58,11 @@ public class NotificationResource extends ExtendedObjectResource<Notification> {
@POST
@Path("test")
- public Response testMessage() throws MessageException, InterruptedException {
+ public Response testMessage() throws MessageException, InterruptedException, StorageException {
+ User user = permissionsService.getUser(getUserId());
for (Typed method : Context.getNotificatorManager().getAllNotificatorTypes()) {
Context.getNotificatorManager()
- .getNotificator(method.getType()).sendSync(getUserId(), new Event("test", 0), null);
+ .getNotificator(method.getType()).sendSync(user, new Event("test", 0), null);
}
return Response.noContent().build();
}
@@ -67,8 +70,9 @@ public class NotificationResource extends ExtendedObjectResource<Notification> {
@POST
@Path("test/{notificator}")
public Response testMessage(@PathParam("notificator") String notificator)
- throws MessageException, InterruptedException {
- Context.getNotificatorManager().getNotificator(notificator).sendSync(getUserId(), new Event("test", 0), null);
+ throws MessageException, InterruptedException, StorageException {
+ User user = permissionsService.getUser(getUserId());
+ Context.getNotificatorManager().getNotificator(notificator).sendSync(user, new Event("test", 0), null);
return Response.noContent().build();
}