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/database/PermissionsManager.java | |
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/database/PermissionsManager.java')
-rw-r--r-- | src/main/java/org/traccar/database/PermissionsManager.java | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/main/java/org/traccar/database/PermissionsManager.java b/src/main/java/org/traccar/database/PermissionsManager.java index 3d4e6425a..f6fbd9489 100644 --- a/src/main/java/org/traccar/database/PermissionsManager.java +++ b/src/main/java/org/traccar/database/PermissionsManager.java @@ -18,7 +18,6 @@ package org.traccar.database; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.traccar.Context; -import org.traccar.api.security.PermissionsService; import org.traccar.model.Device; import org.traccar.model.Group; import org.traccar.model.Permission; @@ -117,21 +116,6 @@ public class PermissionsManager { } } - public Set<Long> getDeviceUsers(long deviceId) { - Device device = Context.getIdentityManager().getById(deviceId); - if (device != null && !device.getDisabled()) { - return getAllDeviceUsers(deviceId); - } else { - Set<Long> result = new HashSet<>(); - for (long userId : getAllDeviceUsers(deviceId)) { - if (getUserAdmin(userId)) { - result.add(userId); - } - } - return result; - } - } - public Set<Long> getGroupDevices(long groupId) { readLock(); try { @@ -195,12 +179,6 @@ public class PermissionsManager { return user != null && user.getAdministrator(); } - public void checkAdmin(long userId) throws SecurityException { - if (!getUserAdmin(userId)) { - throw new SecurityException("Admin access required"); - } - } - public boolean getUserManager(long userId) { User user = getUser(userId); return user != null && user.getUserLimit() != 0; @@ -212,11 +190,6 @@ public class PermissionsManager { } } - public boolean getUserReadonly(long userId) { - User user = getUser(userId); - return user != null && user.getReadonly(); - } - public void checkUserEnabled(long userId) throws SecurityException { User user = getUser(userId); if (user == null) { @@ -230,14 +203,6 @@ public class PermissionsManager { } } - public void checkDevice(long userId, long deviceId) throws SecurityException { - try { - new PermissionsService(storage).checkPermission(Device.class, userId, deviceId); - } catch (StorageException e) { - throw new RuntimeException(e); - } - } - public void refreshPermissions(Permission permission) { if (permission.getOwnerClass().equals(User.class)) { if (permission.getPropertyClass().equals(Device.class) |