aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-12-03 14:08:07 -0800
committerAnton Tananaev <anton@traccar.org>2023-12-03 14:08:07 -0800
commit8999283ee7344fd7ec33c8a6cb5a7999e0592074 (patch)
tree7d9c69c34b04b74560fabd1a89c4a6042398613c /src/main/java/org/traccar/api
parent1efe470d4df335dfaaad5a9e2c6417c24d8864e1 (diff)
downloadtrackermap-server-8999283ee7344fd7ec33c8a6cb5a7999e0592074.tar.gz
trackermap-server-8999283ee7344fd7ec33c8a6cb5a7999e0592074.tar.bz2
trackermap-server-8999283ee7344fd7ec33c8a6cb5a7999e0592074.zip
Update broadcast interface
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/BaseObjectResource.java7
-rw-r--r--src/main/java/org/traccar/api/resource/PermissionsResource.java6
-rw-r--r--src/main/java/org/traccar/api/resource/ServerResource.java3
3 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/api/BaseObjectResource.java b/src/main/java/org/traccar/api/BaseObjectResource.java
index 2aaed2bb5..02e1c2cbe 100644
--- a/src/main/java/org/traccar/api/BaseObjectResource.java
+++ b/src/main/java/org/traccar/api/BaseObjectResource.java
@@ -17,6 +17,7 @@
package org.traccar.api;
import org.traccar.api.security.ServiceAccountUser;
+import org.traccar.broadcast.ObjectOperation;
import org.traccar.helper.LogAction;
import org.traccar.model.BaseModel;
import org.traccar.model.Group;
@@ -74,8 +75,8 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour
if (getUserId() != ServiceAccountUser.ID) {
storage.addPermission(new Permission(User.class, getUserId(), baseClass, entity.getId()));
- cacheManager.invalidatePermission(true, User.class, getUserId(), baseClass, entity.getId());
- connectionManager.invalidatePermission(true, User.class, getUserId(), baseClass, entity.getId());
+ cacheManager.invalidatePermission(true, User.class, getUserId(), baseClass, entity.getId(), true);
+ connectionManager.invalidatePermission(true, User.class, getUserId(), baseClass, entity.getId(), true);
LogAction.link(getUserId(), User.class, getUserId(), baseClass, entity.getId());
}
@@ -110,7 +111,7 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour
new Condition.Equals("id", entity.getId())));
}
}
- cacheManager.updateOrInvalidate(true, entity);
+ cacheManager.updateOrInvalidate(true, entity, ObjectOperation.UPDATE);
LogAction.edit(getUserId(), entity);
return Response.ok(entity).build();
diff --git a/src/main/java/org/traccar/api/resource/PermissionsResource.java b/src/main/java/org/traccar/api/resource/PermissionsResource.java
index e8e4e96eb..2a8ac62f7 100644
--- a/src/main/java/org/traccar/api/resource/PermissionsResource.java
+++ b/src/main/java/org/traccar/api/resource/PermissionsResource.java
@@ -74,7 +74,8 @@ public class PermissionsResource extends BaseResource {
cacheManager.invalidatePermission(
true,
permission.getOwnerClass(), permission.getOwnerId(),
- permission.getPropertyClass(), permission.getPropertyId());
+ permission.getPropertyClass(), permission.getPropertyId(),
+ true);
LogAction.link(getUserId(),
permission.getOwnerClass(), permission.getOwnerId(),
permission.getPropertyClass(), permission.getPropertyId());
@@ -99,7 +100,8 @@ public class PermissionsResource extends BaseResource {
cacheManager.invalidatePermission(
true,
permission.getOwnerClass(), permission.getOwnerId(),
- permission.getPropertyClass(), permission.getPropertyId());
+ permission.getPropertyClass(), permission.getPropertyId(),
+ false);
LogAction.unlink(getUserId(),
permission.getOwnerClass(), permission.getOwnerId(),
permission.getPropertyClass(), permission.getPropertyId());
diff --git a/src/main/java/org/traccar/api/resource/ServerResource.java b/src/main/java/org/traccar/api/resource/ServerResource.java
index 8149ec3b8..bcd36a32e 100644
--- a/src/main/java/org/traccar/api/resource/ServerResource.java
+++ b/src/main/java/org/traccar/api/resource/ServerResource.java
@@ -16,6 +16,7 @@
package org.traccar.api.resource;
import org.traccar.api.BaseResource;
+import org.traccar.broadcast.ObjectOperation;
import org.traccar.config.Config;
import org.traccar.config.Keys;
import org.traccar.database.OpenIdProvider;
@@ -111,7 +112,7 @@ public class ServerResource extends BaseResource {
storage.updateObject(entity, new Request(
new Columns.Exclude("id"),
new Condition.Equals("id", entity.getId())));
- cacheManager.updateOrInvalidate(true, entity);
+ cacheManager.updateOrInvalidate(true, entity, ObjectOperation.UPDATE);
LogAction.edit(getUserId(), entity);
return Response.ok(entity).build();
}