aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/BaseObjectResource.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-01-23 22:15:29 +1300
committerGitHub <noreply@github.com>2018-01-23 22:15:29 +1300
commit00534cbfde4883dc6264aef1d7a913b89a712fb1 (patch)
tree21f687b4fcbb8d66d91b96c7b1b0a704ec139f26 /src/org/traccar/api/BaseObjectResource.java
parente2e0501877c501cdf09158684df046e4e4c41734 (diff)
parent2fc0683c9611c55997e85c5775a8b82f71b575ae (diff)
downloadtrackermap-server-00534cbfde4883dc6264aef1d7a913b89a712fb1.tar.gz
trackermap-server-00534cbfde4883dc6264aef1d7a913b89a712fb1.tar.bz2
trackermap-server-00534cbfde4883dc6264aef1d7a913b89a712fb1.zip
Merge pull request #3736 from Abyss777/notification_calendar
Implement scheduled notifications
Diffstat (limited to 'src/org/traccar/api/BaseObjectResource.java')
-rw-r--r--src/org/traccar/api/BaseObjectResource.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/org/traccar/api/BaseObjectResource.java b/src/org/traccar/api/BaseObjectResource.java
index 3914f8cce..e4e00938f 100644
--- a/src/org/traccar/api/BaseObjectResource.java
+++ b/src/org/traccar/api/BaseObjectResource.java
@@ -1,6 +1,6 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
+ * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,9 +33,11 @@ import org.traccar.database.ManagableObjects;
import org.traccar.database.SimpleObjectManager;
import org.traccar.helper.LogAction;
import org.traccar.model.BaseModel;
+import org.traccar.model.Calendar;
import org.traccar.model.Command;
import org.traccar.model.Device;
import org.traccar.model.Group;
+import org.traccar.model.ScheduledModel;
import org.traccar.model.User;
public abstract class BaseObjectResource<T extends BaseModel> extends BaseResource {
@@ -77,6 +79,9 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour
Context.getPermissionsManager().checkDeviceLimit(getUserId());
} else if (baseClass.equals(Command.class)) {
Context.getPermissionsManager().checkLimitCommands(getUserId());
+ } else if (entity instanceof ScheduledModel) {
+ Context.getPermissionsManager().checkPermission(Calendar.class, getUserId(),
+ ((ScheduledModel) entity).getCalendarId());
}
BaseObjectManager<T> manager = Context.getManager(baseClass);
@@ -106,6 +111,9 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour
Context.getPermissionsManager().checkUserUpdate(getUserId(), before, (User) entity);
} else if (baseClass.equals(Command.class)) {
Context.getPermissionsManager().checkLimitCommands(getUserId());
+ } else if (entity instanceof ScheduledModel) {
+ Context.getPermissionsManager().checkPermission(Calendar.class, getUserId(),
+ ((ScheduledModel) entity).getCalendarId());
}
Context.getPermissionsManager().checkPermission(baseClass, getUserId(), entity.getId());
@@ -151,6 +159,9 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour
} else {
Context.getPermissionsManager().refreshAllExtendedPermissions();
}
+ } else if (baseClass.equals(Calendar.class)) {
+ Context.getGeofenceManager().refreshItems();
+ Context.getNotificationManager().refreshItems();
}
return Response.noContent().build();
}