From 6028f7b37c4fc8bf1e771b33aee09e5f4276c5cf Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 14 Dec 2017 13:36:19 +0500 Subject: Log user actions --- src/org/traccar/api/BaseObjectResource.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/org/traccar/api/BaseObjectResource.java') diff --git a/src/org/traccar/api/BaseObjectResource.java b/src/org/traccar/api/BaseObjectResource.java index 634957a49..806c78624 100644 --- a/src/org/traccar/api/BaseObjectResource.java +++ b/src/org/traccar/api/BaseObjectResource.java @@ -31,6 +31,7 @@ import org.traccar.database.BaseObjectManager; import org.traccar.database.ExtendedObjectManager; import org.traccar.database.ManagableObjects; import org.traccar.database.SimpleObjectManager; +import org.traccar.helper.LogAction; import org.traccar.model.BaseModel; import org.traccar.model.Command; import org.traccar.model.Device; @@ -80,8 +81,10 @@ public abstract class BaseObjectResource extends BaseResour BaseObjectManager manager = Context.getManager(baseClass); manager.addItem(entity); + LogAction.create(getUserId(), entity); Context.getDataManager().linkObject(User.class, getUserId(), baseClass, entity.getId(), true); + LogAction.link(getUserId(), User.class, getUserId(), baseClass, entity.getId()); if (manager instanceof SimpleObjectManager) { ((SimpleObjectManager) manager).refreshUserItems(); @@ -107,6 +110,7 @@ public abstract class BaseObjectResource extends BaseResour Context.getPermissionsManager().checkPermission(baseClass, getUserId(), entity.getId()); Context.getManager(baseClass).updateItem(entity); + LogAction.edit(getUserId(), entity); if (baseClass.equals(Group.class) || baseClass.equals(Device.class)) { Context.getPermissionsManager().refreshDeviceAndGroupPermissions(); @@ -128,6 +132,7 @@ public abstract class BaseObjectResource extends BaseResour BaseObjectManager manager = Context.getManager(baseClass); manager.removeItem(id); + LogAction.remove(getUserId(), baseClass, id); if (manager instanceof SimpleObjectManager) { ((SimpleObjectManager) manager).refreshUserItems(); -- cgit v1.2.3