aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/PermissionsManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/database/PermissionsManager.java')
-rw-r--r--src/org/traccar/database/PermissionsManager.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java
index a38a29c32..0a43f4ff4 100644
--- a/src/org/traccar/database/PermissionsManager.java
+++ b/src/org/traccar/database/PermissionsManager.java
@@ -22,6 +22,7 @@ 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;
@@ -82,4 +83,11 @@ public class PermissionsManager {
}
}
+ public <T> void check(Class<T> clazz, long userId, long entityId) throws SecurityException {
+ if (clazz.equals(User.class)) {
+ checkUser(userId, entityId);
+ } else if (clazz.equals(Device.class)) {
+ checkDevice(userId, entityId);
+ }
+ }
}