diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-22 13:26:22 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-22 13:26:22 -0700 |
commit | d2b164d54e4ae831b562ca7917d3117f2fe78c24 (patch) | |
tree | 9632fd5fbf9103d4eacf32a56b9d6522c8fed233 /src/main/java/org | |
parent | 6c4294b9a3f59c9615be74c04d4c8e047ef3ff4f (diff) | |
download | trackermap-server-d2b164d54e4ae831b562ca7917d3117f2fe78c24.tar.gz trackermap-server-d2b164d54e4ae831b562ca7917d3117f2fe78c24.tar.bz2 trackermap-server-d2b164d54e4ae831b562ca7917d3117f2fe78c24.zip |
Fix permission requests
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/api/ExtendedObjectResource.java | 4 | ||||
-rw-r--r-- | src/main/java/org/traccar/storage/query/Condition.java | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/api/ExtendedObjectResource.java b/src/main/java/org/traccar/api/ExtendedObjectResource.java index 40d679ded..1c306630c 100644 --- a/src/main/java/org/traccar/api/ExtendedObjectResource.java +++ b/src/main/java/org/traccar/api/ExtendedObjectResource.java @@ -56,11 +56,11 @@ public class ExtendedObjectResource<T extends BaseModel> extends BaseObjectResou if (groupId > 0) { permissionsService.checkPermission(Group.class, getUserId(), groupId); - conditions.add(new Condition.Permission(Group.class, groupId, baseClass)); + conditions.add(new Condition.Permission(Group.class, groupId, baseClass).excludeGroups()); } if (deviceId > 0) { permissionsService.checkPermission(Device.class, getUserId(), deviceId); - conditions.add(new Condition.Permission(Device.class, deviceId, baseClass)); + conditions.add(new Condition.Permission(Device.class, deviceId, baseClass).excludeGroups()); } return storage.getObjects(baseClass, new Request(new Columns.All(), Condition.merge(conditions))); diff --git a/src/main/java/org/traccar/storage/query/Condition.java b/src/main/java/org/traccar/storage/query/Condition.java index 91ede236c..4cfdc907f 100644 --- a/src/main/java/org/traccar/storage/query/Condition.java +++ b/src/main/java/org/traccar/storage/query/Condition.java @@ -165,10 +165,6 @@ public interface Condition { this(ownerClass, ownerId, propertyClass, 0, false); } - public Permission(Class<?> ownerClass, Class<?> propertyClass, long propertyId) { - this(ownerClass, 0, propertyClass, propertyId, false); - } - public Permission excludeGroups() { return new Permission(this.ownerClass, this.ownerId, this.propertyClass, this.propertyId, true); } |