aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java2
-rw-r--r--src/main/java/org/traccar/database/PermissionsManager.java27
2 files changed, 1 insertions, 28 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java
index 29c17c41f..bd100245c 100644
--- a/src/main/java/org/traccar/database/DeviceManager.java
+++ b/src/main/java/org/traccar/database/DeviceManager.java
@@ -368,7 +368,7 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
}
}
if (result == null && lookupServer) {
- Server server = Context.getPermissionsManager().getServer();
+ Server server = cacheManager.getServer();
result = server.getAttributes().get(attributeName);
}
if (result == null && lookupConfig) {
diff --git a/src/main/java/org/traccar/database/PermissionsManager.java b/src/main/java/org/traccar/database/PermissionsManager.java
index 595e236fa..3d4e6425a 100644
--- a/src/main/java/org/traccar/database/PermissionsManager.java
+++ b/src/main/java/org/traccar/database/PermissionsManager.java
@@ -22,7 +22,6 @@ import org.traccar.api.security.PermissionsService;
import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.model.Permission;
-import org.traccar.model.Server;
import org.traccar.model.User;
import org.traccar.storage.Storage;
import org.traccar.storage.StorageException;
@@ -44,8 +43,6 @@ public class PermissionsManager {
private final DataManager dataManager;
private final Storage storage;
- private volatile Server server;
-
private final ReadWriteLock lock = new ReentrantReadWriteLock();
private final Map<Long, Set<Long>> groupPermissions = new HashMap<>();
@@ -56,7 +53,6 @@ public class PermissionsManager {
public PermissionsManager(DataManager dataManager, Storage storage) {
this.dataManager = dataManager;
this.storage = storage;
- refreshServer();
refreshDeviceAndGroupPermissions();
}
@@ -148,14 +144,6 @@ public class PermissionsManager {
}
}
- public void refreshServer() {
- try {
- server = dataManager.getServer();
- } catch (StorageException error) {
- LOGGER.warn("Refresh server config error", error);
- }
- }
-
public final void refreshDeviceAndGroupPermissions() {
writeLock();
try {
@@ -229,12 +217,6 @@ public class PermissionsManager {
return user != null && user.getReadonly();
}
- public void checkReadonly(long userId) throws SecurityException {
- if (!getUserAdmin(userId) && (server.getReadonly() || getUserReadonly(userId))) {
- throw new SecurityException("Account is readonly");
- }
- }
-
public void checkUserEnabled(long userId) throws SecurityException {
User user = getUser(userId);
if (user == null) {
@@ -265,15 +247,6 @@ public class PermissionsManager {
}
}
- public Server getServer() {
- return server;
- }
-
- public void updateServer(Server server) throws StorageException {
- dataManager.updateObject(server);
- this.server = server;
- }
-
public User login(String email, String password) throws StorageException {
User user = dataManager.login(email, password);
if (user != null) {