aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormerabtenei <i.merabtene.gd@gmail.com>2023-05-28 21:56:55 +0100
committermerabtenei <i.merabtene.gd@gmail.com>2023-05-28 21:56:55 +0100
commit729df52ea52ce5807b6328eb04cf55d3e9cbea81 (patch)
treef515f7d7ae213766ec9fa13e0993629aa5eb38c8 /src
parentdee954b9f28c129215e9fa600e6860e2d4adb673 (diff)
downloadtrackermap-server-729df52ea52ce5807b6328eb04cf55d3e9cbea81.tar.gz
trackermap-server-729df52ea52ce5807b6328eb04cf55d3e9cbea81.tar.bz2
trackermap-server-729df52ea52ce5807b6328eb04cf55d3e9cbea81.zip
do not add permission if user is serviceAccount
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/api/BaseObjectResource.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/api/BaseObjectResource.java b/src/main/java/org/traccar/api/BaseObjectResource.java
index 904781e54..b007b7bcd 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.api.security.ServiceAccountUser;
import org.traccar.helper.LogAction;
import org.traccar.model.BaseModel;
import org.traccar.model.Group;
@@ -70,10 +71,13 @@ 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(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());
+
+ if (getUserId() != ServiceAccountUser.ID) {
+ storage.addPermission(new Permission(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();
}