aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/resource
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 12:26:22 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 12:26:22 -0700
commitb23ca6de800be9f2bbedcc4109a65f06bb245713 (patch)
tree7db9141b1413e7093ec252d9eab6accb4c10e55a /src/main/java/org/traccar/api/resource
parent24140619789c88d96364673240b172bbd2ae2c82 (diff)
downloadtrackermap-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.java13
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();
}