diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-18 12:26:22 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-18 12:26:22 -0700 |
commit | b23ca6de800be9f2bbedcc4109a65f06bb245713 (patch) | |
tree | 7db9141b1413e7093ec252d9eab6accb4c10e55a /src/main/java/org/traccar/api/resource | |
parent | 24140619789c88d96364673240b172bbd2ae2c82 (diff) | |
download | trackermap-server-b23ca6de800be9f2bbedcc4109a65f06bb245713.tar.gz trackermap-server-b23ca6de800be9f2bbedcc4109a65f06bb245713.tar.bz2 trackermap-server-b23ca6de800be9f2bbedcc4109a65f06bb245713.zip |
Remove permissions manager
Diffstat (limited to 'src/main/java/org/traccar/api/resource')
-rw-r--r-- | src/main/java/org/traccar/api/resource/PermissionsResource.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/main/java/org/traccar/api/resource/PermissionsResource.java b/src/main/java/org/traccar/api/resource/PermissionsResource.java index b92e6e9d9..7174a3eff 100644 --- a/src/main/java/org/traccar/api/resource/PermissionsResource.java +++ b/src/main/java/org/traccar/api/resource/PermissionsResource.java @@ -16,7 +16,6 @@ */ package org.traccar.api.resource; -import org.traccar.Context; import org.traccar.api.BaseResource; import org.traccar.helper.LogAction; import org.traccar.model.Permission; @@ -46,7 +45,7 @@ public class PermissionsResource extends BaseResource { @Inject private CacheManager cacheManager; - private void checkPermission(Permission permission, boolean link) throws StorageException { + private void checkPermission(Permission permission) throws StorageException { if (permissionsService.notAdmin(getUserId())) { permissionsService.checkPermission(permission.getOwnerClass(), getUserId(), permission.getOwnerId()); permissionsService.checkPermission(permission.getOwnerClass(), getUserId(), permission.getOwnerId()); @@ -70,16 +69,13 @@ public class PermissionsResource extends BaseResource { checkPermissionTypes(entities); for (LinkedHashMap<String, Long> entity: entities) { Permission permission = new Permission(entity); - checkPermission(permission, true); + checkPermission(permission); storage.addPermission(permission); cacheManager.invalidate(permission.getOwnerClass(), permission.getOwnerId(), permission.getPropertyClass(), permission.getPropertyId()); LogAction.link(getUserId(), permission.getOwnerClass(), permission.getOwnerId(), permission.getPropertyClass(), permission.getPropertyId()); } - if (!entities.isEmpty()) { - Context.getPermissionsManager().refreshPermissions(new Permission(entities.get(0))); - } return Response.noContent().build(); } @@ -95,16 +91,13 @@ public class PermissionsResource extends BaseResource { checkPermissionTypes(entities); for (LinkedHashMap<String, Long> entity: entities) { Permission permission = new Permission(entity); - checkPermission(permission, false); + checkPermission(permission); storage.removePermission(permission); cacheManager.invalidate(permission.getOwnerClass(), permission.getOwnerId(), permission.getPropertyClass(), permission.getPropertyId()); LogAction.unlink(getUserId(), permission.getOwnerClass(), permission.getOwnerId(), permission.getPropertyClass(), permission.getPropertyId()); } - if (!entities.isEmpty()) { - Context.getPermissionsManager().refreshPermissions(new Permission(entities.get(0))); - } return Response.noContent().build(); } |