diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-19 20:41:09 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 20:41:09 +1300 |
commit | f9b786398acee9f73e8591f7b0967be280524045 (patch) | |
tree | 10d544c07400ba89741a275bc1a26182689bad07 /src/org/traccar/api/BaseObjectResource.java | |
parent | 8162c8ea169a39d247747e1731fe713102e6f3cc (diff) | |
parent | 7858975ecb7d78106ad6dec829b838073d0db098 (diff) | |
download | trackermap-server-f9b786398acee9f73e8591f7b0967be280524045.tar.gz trackermap-server-f9b786398acee9f73e8591f7b0967be280524045.tar.bz2 trackermap-server-f9b786398acee9f73e8591f7b0967be280524045.zip |
Merge pull request #3685 from Abyss777/log_actions
Log user actions
Diffstat (limited to 'src/org/traccar/api/BaseObjectResource.java')
-rw-r--r-- | src/org/traccar/api/BaseObjectResource.java | 5 |
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(); |