aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-28 10:47:42 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-28 10:47:42 -0700
commit9345f8e086105ba30e9e9cf87b3fc5b0740d68e8 (patch)
tree056481870b59bd352f970dec39106acae0e69f8a /src/main/java/org/traccar
parenta487c1efa5dff2a7644ee7f2874967f4bb867b6a (diff)
downloadtrackermap-server-9345f8e086105ba30e9e9cf87b3fc5b0740d68e8.tar.gz
trackermap-server-9345f8e086105ba30e9e9cf87b3fc5b0740d68e8.tar.bz2
trackermap-server-9345f8e086105ba30e9e9cf87b3fc5b0740d68e8.zip
Fix device creation issue
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/api/security/PermissionsService.java5
1 files changed, 3 insertions, 2 deletions
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();