aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/security
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/api/security')
-rw-r--r--src/main/java/org/traccar/api/security/PermissionsService.java4
1 files changed, 2 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 b4a375109..12a2189e9 100644
--- a/src/main/java/org/traccar/api/security/PermissionsService.java
+++ b/src/main/java/org/traccar/api/security/PermissionsService.java
@@ -138,13 +138,13 @@ public class PermissionsService {
public <T extends BaseModel> void checkPermission(
Class<T> clazz, long userId, long objectId) throws StorageException, SecurityException {
if (!getUser(userId).getAdministrator() && !(clazz.equals(User.class) && userId == objectId)) {
- var objects = storage.getObjects(clazz, new Request(
+ var object = storage.getObject(clazz, new Request(
new Columns.Include("id"),
new Condition.And(
new Condition.Equals("id", "id", objectId),
new Condition.Permission(
User.class, userId, clazz.equals(User.class) ? ManagedUser.class : clazz))));
- if (!objects.isEmpty()) {
+ if (object == null) {
throw new SecurityException(clazz.getSimpleName() + " access denied");
}
}