diff options
Diffstat (limited to 'src/main/java/org/traccar/api/BaseObjectResource.java')
-rw-r--r-- | src/main/java/org/traccar/api/BaseObjectResource.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/api/BaseObjectResource.java b/src/main/java/org/traccar/api/BaseObjectResource.java index 35ff04bf3..403021c6c 100644 --- a/src/main/java/org/traccar/api/BaseObjectResource.java +++ b/src/main/java/org/traccar/api/BaseObjectResource.java @@ -16,6 +16,7 @@ */ package org.traccar.api; +import org.traccar.broadcast.BroadcastService; import org.traccar.helper.LogAction; import org.traccar.model.BaseModel; import org.traccar.model.Group; @@ -41,6 +42,9 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour @Inject private CacheManager cacheManager; + @Inject + private BroadcastService broadcastService; + protected final Class<T> baseClass; public BaseObjectResource(Class<T> baseClass) { @@ -67,7 +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.invalidate(User.class, getUserId(), baseClass, entity.getId()); + cacheManager.invalidatePermission(User.class, getUserId(), baseClass, entity.getId()); + broadcastService.invalidatePermission(User.class, getUserId(), baseClass, entity.getId()); LogAction.link(getUserId(), User.class, getUserId(), baseClass, entity.getId()); return Response.ok(entity).build(); @@ -94,6 +99,7 @@ public abstract class BaseObjectResource<T extends BaseModel> extends BaseResour new Columns.Exclude("id"), new Condition.Equals("id", "id"))); cacheManager.updateOrInvalidate(entity); + broadcastService.invalidateObject(entity.getClass(), entity.getId()); LogAction.edit(getUserId(), entity); return Response.ok(entity).build(); |