diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-16 07:45:19 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-16 07:45:19 -0700 |
commit | e74c64f27dc30473d9ef866c5c52e3dd6bee2fc3 (patch) | |
tree | 00ff1a6d2debb857aef0c736d3a68b2607b45ab9 /src/main/java/org/traccar/reports/common | |
parent | cc342a9ba371b0dca8d87ca9e74c5907ccb58bc6 (diff) | |
download | trackermap-server-e74c64f27dc30473d9ef866c5c52e3dd6bee2fc3.tar.gz trackermap-server-e74c64f27dc30473d9ef866c5c52e3dd6bee2fc3.tar.bz2 trackermap-server-e74c64f27dc30473d9ef866c5c52e3dd6bee2fc3.zip |
Refactor device permissions check
Diffstat (limited to 'src/main/java/org/traccar/reports/common')
-rw-r--r-- | src/main/java/org/traccar/reports/common/ReportUtils.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/reports/common/ReportUtils.java b/src/main/java/org/traccar/reports/common/ReportUtils.java index 95c43f8a0..84866a67b 100644 --- a/src/main/java/org/traccar/reports/common/ReportUtils.java +++ b/src/main/java/org/traccar/reports/common/ReportUtils.java @@ -38,8 +38,10 @@ import org.traccar.helper.UnitsConverter; import org.traccar.helper.model.PositionUtil; import org.traccar.helper.model.UserUtil; import org.traccar.model.BaseModel; +import org.traccar.model.Device; import org.traccar.model.Driver; import org.traccar.model.Event; +import org.traccar.model.Group; import org.traccar.model.Position; import org.traccar.model.User; import org.traccar.reports.model.BaseReportItem; @@ -109,6 +111,16 @@ public class ReportUtils { } } + public void checkPermissions( + long userId, Collection<Long> deviceIds, Collection<Long> groupIds) throws StorageException { + for (long deviceId : deviceIds) { + permissionsService.checkPermission(Device.class, userId, deviceId); + } + for (long groupId : groupIds) { + permissionsService.checkPermission(Group.class, userId, groupId); + } + } + public Collection<Long> getDeviceList(Collection<Long> deviceIds, Collection<Long> groupIds) { Collection<Long> result = new LinkedHashSet<>(deviceIds); for (long groupId : groupIds) { |