aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/BaseObjectResource.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-12-14 13:36:19 +0500
committerAbyss777 <abyss@fox5.ru>2017-12-18 16:59:55 +0500
commit6028f7b37c4fc8bf1e771b33aee09e5f4276c5cf (patch)
treea347ad1207b2621843b64b5796a0e1670205b6f3 /src/org/traccar/api/BaseObjectResource.java
parent30c269bb3e7994eb94e3f53704b3c6ef6d3d124a (diff)
downloadtrackermap-server-6028f7b37c4fc8bf1e771b33aee09e5f4276c5cf.tar.gz
trackermap-server-6028f7b37c4fc8bf1e771b33aee09e5f4276c5cf.tar.bz2
trackermap-server-6028f7b37c4fc8bf1e771b33aee09e5f4276c5cf.zip
Log user actions
Diffstat (limited to 'src/org/traccar/api/BaseObjectResource.java')
-rw-r--r--src/org/traccar/api/BaseObjectResource.java5
1 files changed, 5 insertions, 0 deletions
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<T extends BaseModel> extends BaseResour
BaseObjectManager<T> 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<T>) manager).refreshUserItems();
@@ -107,6 +110,7 @@ public abstract class BaseObjectResource<T extends BaseModel> 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<T extends BaseModel> extends BaseResour
BaseObjectManager<T> manager = Context.getManager(baseClass);
manager.removeItem(id);
+ LogAction.remove(getUserId(), baseClass, id);
if (manager instanceof SimpleObjectManager) {
((SimpleObjectManager<T>) manager).refreshUserItems();