diff options
author | Anton Tananaev <anton@traccar.org> | 2022-02-21 17:33:58 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-04-05 15:48:51 -0700 |
commit | 9ec2d09ad8a757d58f70812b9cf5e835321382e6 (patch) | |
tree | 3632335375c62d7e30d32c49b9d952af3eb0b748 /src/main/java/org/traccar/database | |
parent | 307c4dd690c5826e076657fa83f2ddd41cec1126 (diff) | |
download | trackermap-server-9ec2d09ad8a757d58f70812b9cf5e835321382e6.tar.gz trackermap-server-9ec2d09ad8a757d58f70812b9cf5e835321382e6.tar.bz2 trackermap-server-9ec2d09ad8a757d58f70812b9cf5e835321382e6.zip |
Migrate permissions to storage
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r-- | src/main/java/org/traccar/database/DeviceManager.java | 3 | ||||
-rw-r--r-- | src/main/java/org/traccar/database/PermissionsManager.java | 22 |
2 files changed, 1 insertions, 24 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java index 40591e869..a9b8454eb 100644 --- a/src/main/java/org/traccar/database/DeviceManager.java +++ b/src/main/java/org/traccar/database/DeviceManager.java @@ -15,7 +15,6 @@ */ package org.traccar.database; -import java.sql.SQLException; import java.util.Collection; import java.util.HashSet; import java.util.LinkedList; @@ -110,7 +109,7 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity } @Override - public Device getByUniqueId(String uniqueId) throws SQLException { + public Device getByUniqueId(String uniqueId) { boolean forceUpdate; try { readLock(); diff --git a/src/main/java/org/traccar/database/PermissionsManager.java b/src/main/java/org/traccar/database/PermissionsManager.java index 2bb808033..9a673c784 100644 --- a/src/main/java/org/traccar/database/PermissionsManager.java +++ b/src/main/java/org/traccar/database/PermissionsManager.java @@ -264,45 +264,23 @@ public class PermissionsManager { return user != null && user.getReadonly(); } - public boolean getUserDeviceReadonly(long userId) { - User user = getUser(userId); - return user != null && user.getDeviceReadonly(); - } - public boolean getUserLimitCommands(long userId) { User user = getUser(userId); return user != null && user.getLimitCommands(); } - public boolean getUserDisableReport(long userId) { - User user = getUser(userId); - return user != null && user.getDisableReports(); - } - public void checkReadonly(long userId) throws SecurityException { if (!getUserAdmin(userId) && (server.getReadonly() || getUserReadonly(userId))) { throw new SecurityException("Account is readonly"); } } - public void checkDeviceReadonly(long userId) throws SecurityException { - if (!getUserAdmin(userId) && (server.getDeviceReadonly() || getUserDeviceReadonly(userId))) { - throw new SecurityException("Account is device readonly"); - } - } - public void checkLimitCommands(long userId) throws SecurityException { if (!getUserAdmin(userId) && (server.getLimitCommands() || getUserLimitCommands(userId))) { throw new SecurityException("Account has limit sending commands"); } } - public void checkDisableReports(long userId) throws SecurityException { - if (!getUserAdmin(userId) && (server.getDisableReports() || getUserDisableReport(userId))) { - throw new SecurityException("Account has reports disabled"); - } - } - public void checkUserDeviceCommand(long userId, long deviceId, long commandId) throws SecurityException { if (!getUserAdmin(userId) && Context.getCommandsManager().checkDeviceCommand(deviceId, commandId)) { throw new SecurityException("Command can not be sent to this device"); |