From 9345f8e086105ba30e9e9cf87b3fc5b0740d68e8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 28 Jun 2022 10:47:42 -0700 Subject: Fix device creation issue --- src/main/java/org/traccar/api/security/PermissionsService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/traccar/api/security/PermissionsService.java b/src/main/java/org/traccar/api/security/PermissionsService.java index e5bc52f22..a3e7a182f 100644 --- a/src/main/java/org/traccar/api/security/PermissionsService.java +++ b/src/main/java/org/traccar/api/security/PermissionsService.java @@ -102,8 +102,9 @@ public class PermissionsService { if (getServer().getReadonly() || getUser(userId).getReadonly()) { denied = true; } else if (clazz.equals(Device.class)) { - denied = getServer().getDeviceReadonly() || getUser(userId).getDeviceReadonly(); - if (addition) { + denied = getServer().getDeviceReadonly() || getUser(userId).getDeviceReadonly() + || addition && getUser(userId).getDeviceLimit() == 0; + if (addition && getUser(userId).getDeviceLimit() > 0) { int deviceCount = storage.getObjects(Device.class, new Request( new Columns.Include("id"), new Condition.Permission(User.class, userId, Device.class))).size(); -- cgit v1.2.3