aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database/PermissionsManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-04 06:33:02 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-04 06:33:02 -0700
commitec76482c15094a7e04964c67d3011a7e8e1ad6a9 (patch)
tree3ef0d23e1b9f4ba7ef02f68b08db33f3db1972ab /src/main/java/org/traccar/database/PermissionsManager.java
parent4030d3207c157a3fcee2653c18440898b6b2a2e6 (diff)
downloadtrackermap-server-ec76482c15094a7e04964c67d3011a7e8e1ad6a9.tar.gz
trackermap-server-ec76482c15094a7e04964c67d3011a7e8e1ad6a9.tar.bz2
trackermap-server-ec76482c15094a7e04964c67d3011a7e8e1ad6a9.zip
Refactor commands manager
Diffstat (limited to 'src/main/java/org/traccar/database/PermissionsManager.java')
-rw-r--r--src/main/java/org/traccar/database/PermissionsManager.java31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/main/java/org/traccar/database/PermissionsManager.java b/src/main/java/org/traccar/database/PermissionsManager.java
index 29bb8a27b..4d5c59fcc 100644
--- a/src/main/java/org/traccar/database/PermissionsManager.java
+++ b/src/main/java/org/traccar/database/PermissionsManager.java
@@ -20,7 +20,6 @@ import org.slf4j.LoggerFactory;
import org.traccar.Context;
import org.traccar.model.BaseModel;
import org.traccar.model.Calendar;
-import org.traccar.model.Command;
import org.traccar.model.Device;
import org.traccar.model.Driver;
import org.traccar.model.Geofence;
@@ -274,18 +273,6 @@ public class PermissionsManager {
}
}
- public void checkLimitCommands(long userId) throws SecurityException {
- if (!getUserAdmin(userId) && (server.getLimitCommands() || getUserLimitCommands(userId))) {
- throw new SecurityException("Account has limit sending commands");
- }
- }
-
- 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");
- }
- }
-
public void checkUserEnabled(long userId) throws SecurityException {
User user = getUser(userId);
if (user == null) {
@@ -367,21 +354,9 @@ public class PermissionsManager {
if (object.equals(Device.class)) {
checkDevice(userId, objectId);
- } else if (object.equals(Command.class)) {
- manager = Context.getCommandsManager();
} else {
throw new IllegalArgumentException("Unknown object type");
}
-
- if (manager != null && !manager.checkItemPermission(userId, objectId) && !getUserAdmin(userId)) {
- checkManager(userId);
- for (long managedUserId : usersManager.getManagedItems(userId)) {
- if (manager.checkItemPermission(managedUserId, objectId)) {
- return;
- }
- }
- throw new SecurityException("Type " + object + " access denied");
- }
}
public void refreshAllUsersPermissions() {
@@ -390,7 +365,6 @@ public class PermissionsManager {
}
Context.getCalendarManager().refreshUserItems();
Context.getDriversManager().refreshUserItems();
- Context.getCommandsManager().refreshUserItems();
Context.getMaintenancesManager().refreshUserItems();
if (Context.getNotificationManager() != null) {
Context.getNotificationManager().refreshUserItems();
@@ -402,7 +376,6 @@ public class PermissionsManager {
Context.getGeofenceManager().refreshExtendedPermissions();
}
Context.getDriversManager().refreshExtendedPermissions();
- Context.getCommandsManager().refreshExtendedPermissions();
Context.getMaintenancesManager().refreshExtendedPermissions();
}
@@ -420,8 +393,6 @@ public class PermissionsManager {
Context.getDriversManager().refreshUserItems();
} else if (permission.getPropertyClass().equals(Calendar.class)) {
Context.getCalendarManager().refreshUserItems();
- } else if (permission.getPropertyClass().equals(Command.class)) {
- Context.getCommandsManager().refreshUserItems();
} else if (permission.getPropertyClass().equals(Maintenance.class)) {
Context.getMaintenancesManager().refreshUserItems();
} else if (permission.getPropertyClass().equals(Order.class)) {
@@ -435,8 +406,6 @@ public class PermissionsManager {
Context.getGeofenceManager().refreshExtendedPermissions();
} else if (permission.getPropertyClass().equals(Driver.class)) {
Context.getDriversManager().refreshExtendedPermissions();
- } else if (permission.getPropertyClass().equals(Command.class)) {
- Context.getCommandsManager().refreshExtendedPermissions();
} else if (permission.getPropertyClass().equals(Maintenance.class)) {
Context.getMaintenancesManager().refreshExtendedPermissions();
} else if (permission.getPropertyClass().equals(Order.class)) {