aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/api')
-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();