aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/PermissionsResource.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api/resource/PermissionsResource.java')
-rw-r--r--src/org/traccar/api/resource/PermissionsResource.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/org/traccar/api/resource/PermissionsResource.java b/src/org/traccar/api/resource/PermissionsResource.java
index ac7acb93f..e22ffae36 100644
--- a/src/org/traccar/api/resource/PermissionsResource.java
+++ b/src/org/traccar/api/resource/PermissionsResource.java
@@ -39,6 +39,9 @@ public class PermissionsResource extends BaseResource {
@POST
public Response add(Map<String, Long> entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
+ if (entity.size() != 2) {
+ throw new IllegalArgumentException();
+ }
for (String key : entity.keySet()) {
Context.getPermissionsManager().checkPermission(key.replace("Id", ""), getUserId(), entity.get(key));
}
@@ -51,6 +54,9 @@ public class PermissionsResource extends BaseResource {
@DELETE
public Response remove(Map<String, Long> entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
+ if (entity.size() != 2) {
+ throw new IllegalArgumentException();
+ }
for (String key : entity.keySet()) {
Context.getPermissionsManager().checkPermission(key.replace("Id", ""), getUserId(), entity.get(key));
}