aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 12:30:26 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 12:30:26 -0700
commit589582c7ecc0d1cd5321cb6e9f4b823284369498 (patch)
tree9661f33c98c5deee384488d83ed8d4d8560f9769 /src/main/java/org/traccar/api
parent3f1c4e293f7d7d267a64fa9561fe77e9ba02477b (diff)
downloadtrackermap-server-589582c7ecc0d1cd5321cb6e9f4b823284369498.tar.gz
trackermap-server-589582c7ecc0d1cd5321cb6e9f4b823284369498.tar.bz2
trackermap-server-589582c7ecc0d1cd5321cb6e9f4b823284369498.zip
Simplify storage interface
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/security/PermissionsService.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/api/security/PermissionsService.java b/src/main/java/org/traccar/api/security/PermissionsService.java
index f39ded2b7..ea7a9d572 100644
--- a/src/main/java/org/traccar/api/security/PermissionsService.java
+++ b/src/main/java/org/traccar/api/security/PermissionsService.java
@@ -100,7 +100,9 @@ public class PermissionsService {
} else if (clazz.equals(Device.class)) {
denied = getServer().getDeviceReadonly() || getUser(userId).getDeviceReadonly();
if (addition) {
- int deviceCount = storage.getPermissions(User.class, userId, Device.class).size();
+ int deviceCount = storage.getObjects(Device.class, new Request(
+ new Columns.Include("id"),
+ new Condition.Permission(User.class, userId, Device.class))).size();
denied = deviceCount >= getUser(userId).getDeviceLimit();
}
} else if (clazz.equals(Command.class)) {