aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-13 17:31:52 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-13 17:31:52 -0700
commita8e38b74e5fc6789676bf35a9b92594a230e3ad8 (patch)
treeeed89969aecd7c9652f8640742530c96a4fc40b3 /src/main/java/org/traccar/api
parent33733f835e88a62c4a5259ab330723b88037adf1 (diff)
downloadtrackermap-server-a8e38b74e5fc6789676bf35a9b92594a230e3ad8.tar.gz
trackermap-server-a8e38b74e5fc6789676bf35a9b92594a230e3ad8.tar.bz2
trackermap-server-a8e38b74e5fc6789676bf35a9b92594a230e3ad8.zip
Avoid broadcast loops (fix #4894)
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/BaseObjectResource.java6
-rw-r--r--src/main/java/org/traccar/api/resource/PermissionsResource.java2
-rw-r--r--src/main/java/org/traccar/api/resource/ServerResource.java2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/api/BaseObjectResource.java b/src/main/java/org/traccar/api/BaseObjectResource.java
index d10843917..2a3bbe239 100644
--- a/src/main/java/org/traccar/api/BaseObjectResource.java
+++ b/src/main/java/org/traccar/api/BaseObjectResource.java
@@ -71,8 +71,8 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour
entity.setId(storage.addObject(entity, new Request(new Columns.Exclude("id"))));
LogAction.create(getUserId(), entity);
storage.addPermission(new Permission(User.class, getUserId(), baseClass, entity.getId()));
- cacheManager.invalidatePermission(User.class, getUserId(), baseClass, entity.getId());
- connectionManager.invalidatePermission(User.class, getUserId(), baseClass, entity.getId());
+ cacheManager.invalidatePermission(true, User.class, getUserId(), baseClass, entity.getId());
+ connectionManager.invalidatePermission(true, User.class, getUserId(), baseClass, entity.getId());
LogAction.link(getUserId(), User.class, getUserId(), baseClass, entity.getId());
return Response.ok(entity).build();
@@ -98,7 +98,7 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour
storage.updateObject(entity, new Request(
new Columns.Exclude("id"),
new Condition.Equals("id", "id")));
- cacheManager.updateOrInvalidate(entity);
+ cacheManager.updateOrInvalidate(true, entity);
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 44fc897ac..d35cb98bb 100644
--- a/src/main/java/org/traccar/api/resource/PermissionsResource.java
+++ b/src/main/java/org/traccar/api/resource/PermissionsResource.java
@@ -72,6 +72,7 @@ public class PermissionsResource extends BaseResource {
checkPermission(permission);
storage.addPermission(permission);
cacheManager.invalidatePermission(
+ true,
permission.getOwnerClass(), permission.getOwnerId(),
permission.getPropertyClass(), permission.getPropertyId());
LogAction.link(getUserId(),
@@ -96,6 +97,7 @@ public class PermissionsResource extends BaseResource {
checkPermission(permission);
storage.removePermission(permission);
cacheManager.invalidatePermission(
+ true,
permission.getOwnerClass(), permission.getOwnerId(),
permission.getPropertyClass(), permission.getPropertyId());
LogAction.unlink(getUserId(),
diff --git a/src/main/java/org/traccar/api/resource/ServerResource.java b/src/main/java/org/traccar/api/resource/ServerResource.java
index 3e6792f5b..4fc76a0d7 100644
--- a/src/main/java/org/traccar/api/resource/ServerResource.java
+++ b/src/main/java/org/traccar/api/resource/ServerResource.java
@@ -77,7 +77,7 @@ public class ServerResource extends BaseResource {
storage.updateObject(entity, new Request(
new Columns.Exclude("id"),
new Condition.Equals("id", "id")));
- cacheManager.updateOrInvalidate(entity);
+ cacheManager.updateOrInvalidate(true, entity);
LogAction.edit(getUserId(), entity);
return Response.ok(entity).build();
}