From 5947767811b376a26c550661a7f5362d0d884f84 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 20 Dec 2015 14:42:01 +1300 Subject: Remove generic method for permissions --- src/org/traccar/database/PermissionsManager.java | 9 --------- src/org/traccar/web/CommandServlet.java | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java index 4f3acf00c..a38a29c32 100644 --- a/src/org/traccar/database/PermissionsManager.java +++ b/src/org/traccar/database/PermissionsManager.java @@ -22,7 +22,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import org.traccar.helper.Log; -import org.traccar.model.Device; import org.traccar.model.Permission; import org.traccar.model.User; @@ -83,12 +82,4 @@ public class PermissionsManager { } } - public void check(Class clazz, long userId, long entityId) throws SecurityException { - if (clazz.equals(User.class)) { - checkUser(userId, entityId); - } else if (clazz.equals(Device.class)) { - checkDevice(userId, entityId); - } - } - } diff --git a/src/org/traccar/web/CommandServlet.java b/src/org/traccar/web/CommandServlet.java index d307913df..2f1493193 100644 --- a/src/org/traccar/web/CommandServlet.java +++ b/src/org/traccar/web/CommandServlet.java @@ -51,7 +51,7 @@ public class CommandServlet extends BaseServlet { private void send(HttpServletRequest req, HttpServletResponse resp) throws Exception { Command command = JsonConverter.objectFromJson(req.getReader(), Command.class); - Context.getPermissionsManager().check(Device.class, getUserId(req), command.getDeviceId()); + Context.getPermissionsManager().checkDevice(getUserId(req), command.getDeviceId()); getActiveDevice(command.getDeviceId()).sendCommand(command); sendResponse(resp.getWriter(), true); } @@ -60,7 +60,7 @@ public class CommandServlet extends BaseServlet { JsonObject json = Json.createReader(req.getReader()).readObject(); long deviceId = json.getJsonNumber("deviceId").longValue(); String command = json.getString("command"); - Context.getPermissionsManager().check(Device.class, getUserId(req), deviceId); + Context.getPermissionsManager().checkDevice(getUserId(req), deviceId); getActiveDevice(deviceId).write(command); sendResponse(resp.getWriter(), true); } -- cgit v1.2.3