diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/api/resource/PermissionsResource.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/main/java/org/traccar/api/resource/PermissionsResource.java b/src/main/java/org/traccar/api/resource/PermissionsResource.java index 50ae11aaf..54d3964b6 100644 --- a/src/main/java/org/traccar/api/resource/PermissionsResource.java +++ b/src/main/java/org/traccar/api/resource/PermissionsResource.java @@ -59,9 +59,14 @@ public class PermissionsResource extends BaseResource { permission.getPropertyClass(), getUserId(), permission.getPropertyId()); } - @POST - public Response add(LinkedHashMap<String, Long> entity) throws SQLException, ClassNotFoundException { - return add(Collections.singletonList(entity)); + private void checkPermissionTypes(List<LinkedHashMap<String, Long>> entities) { + Set<String> keys = null; + for (LinkedHashMap<String, Long> entity: entities) { + if (keys != null & !entity.keySet().equals(keys)) { + throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).build()); + } + keys = entity.keySet(); + } } @Path("bulk") @@ -83,19 +88,9 @@ public class PermissionsResource extends BaseResource { return Response.noContent().build(); } - private void checkPermissionTypes(List<LinkedHashMap<String, Long>> entities) { - Set<String> keys = null; - for (LinkedHashMap<String, Long> entity: entities) { - if (keys != null & !entity.keySet().equals(keys)) { - throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).build()); - } - keys = entity.keySet(); - } - } - - @DELETE - public Response remove(LinkedHashMap<String, Long> entity) throws SQLException, ClassNotFoundException { - return remove(Collections.singletonList(entity)); + @POST + public Response add(LinkedHashMap<String, Long> entity) throws SQLException, ClassNotFoundException { + return add(Collections.singletonList(entity)); } @DELETE @@ -117,4 +112,9 @@ public class PermissionsResource extends BaseResource { return Response.noContent().build(); } + @DELETE + public Response remove(LinkedHashMap<String, Long> entity) throws SQLException, ClassNotFoundException { + return remove(Collections.singletonList(entity)); + } + } |