aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/resource
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/api/resource')
-rw-r--r--src/main/java/org/traccar/api/resource/PermissionsResource.java5
-rw-r--r--src/main/java/org/traccar/api/resource/ServerResource.java4
2 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/api/resource/PermissionsResource.java b/src/main/java/org/traccar/api/resource/PermissionsResource.java
index 36ee0c213..b92e6e9d9 100644
--- a/src/main/java/org/traccar/api/resource/PermissionsResource.java
+++ b/src/main/java/org/traccar/api/resource/PermissionsResource.java
@@ -20,6 +20,7 @@ import org.traccar.Context;
import org.traccar.api.BaseResource;
import org.traccar.helper.LogAction;
import org.traccar.model.Permission;
+import org.traccar.model.UserRestrictions;
import org.traccar.session.cache.CacheManager;
import org.traccar.storage.StorageException;
@@ -65,7 +66,7 @@ public class PermissionsResource extends BaseResource {
@Path("bulk")
@POST
public Response add(List<LinkedHashMap<String, Long>> entities) throws StorageException, ClassNotFoundException {
- Context.getPermissionsManager().checkReadonly(getUserId());
+ permissionsService.checkRestriction(getUserId(), UserRestrictions::getReadonly);
checkPermissionTypes(entities);
for (LinkedHashMap<String, Long> entity: entities) {
Permission permission = new Permission(entity);
@@ -90,7 +91,7 @@ public class PermissionsResource extends BaseResource {
@DELETE
@Path("bulk")
public Response remove(List<LinkedHashMap<String, Long>> entities) throws StorageException, ClassNotFoundException {
- Context.getPermissionsManager().checkReadonly(getUserId());
+ permissionsService.checkRestriction(getUserId(), UserRestrictions::getReadonly);
checkPermissionTypes(entities);
for (LinkedHashMap<String, Long> entity: entities) {
Permission permission = new Permission(entity);
diff --git a/src/main/java/org/traccar/api/resource/ServerResource.java b/src/main/java/org/traccar/api/resource/ServerResource.java
index 18230a2b3..b66f5a931 100644
--- a/src/main/java/org/traccar/api/resource/ServerResource.java
+++ b/src/main/java/org/traccar/api/resource/ServerResource.java
@@ -15,7 +15,6 @@
*/
package org.traccar.api.resource;
-import org.traccar.Context;
import org.traccar.api.BaseResource;
import org.traccar.database.MailManager;
import org.traccar.geocoder.Geocoder;
@@ -66,8 +65,7 @@ public class ServerResource extends BaseResource {
@PUT
public Response update(Server entity) throws StorageException {
- Context.getPermissionsManager().checkAdmin(getUserId());
- Context.getPermissionsManager().updateServer(entity);
+ permissionsService.checkAdmin(getUserId());
LogAction.edit(getUserId(), entity);
return Response.ok(entity).build();
}