aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/BaseResource.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api/BaseResource.java')
-rw-r--r--src/org/traccar/api/BaseResource.java30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/org/traccar/api/BaseResource.java b/src/org/traccar/api/BaseResource.java
index 920bb3931..502591efe 100644
--- a/src/org/traccar/api/BaseResource.java
+++ b/src/org/traccar/api/BaseResource.java
@@ -16,15 +16,11 @@
package org.traccar.api;
import java.sql.SQLException;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
import javax.ws.rs.core.SecurityContext;
import org.traccar.Context;
-import org.traccar.database.DataManager;
import org.traccar.model.BaseModel;
-import org.traccar.model.Device;
import org.traccar.model.User;
public class BaseResource {
@@ -40,32 +36,6 @@ public class BaseResource {
return 0;
}
- protected void checkAndLinkPermission(LinkedHashMap<String, Long> entity, boolean link)
- throws SQLException, ClassNotFoundException {
- Iterator<String> iterator = entity.keySet().iterator();
- String owner = iterator.next();
- Class<?> ownerClass = DataManager.getClassByName(owner);
- String property = iterator.next();
- Class<?> propertyClass = DataManager.getClassByName(property);
-
- long ownerId = entity.get(owner);
- long propertyId = entity.get(property);
-
- if (!link && ownerClass.equals(User.class)
- && propertyClass.equals(Device.class)) {
- if (getUserId() != ownerId) {
- Context.getPermissionsManager().checkUser(getUserId(), ownerId);
- } else {
- Context.getPermissionsManager().checkAdmin(getUserId());
- }
- } else {
- Context.getPermissionsManager().checkPermission(ownerClass, getUserId(), ownerId);
- }
- Context.getPermissionsManager().checkPermission(propertyClass, getUserId(), propertyId);
-
- Context.getDataManager().linkObject(ownerClass, ownerId, propertyClass, propertyId, link);
- }
-
protected void linkNewEntity(BaseModel entity) throws SQLException {
Context.getDataManager().linkObject(User.class, getUserId(), entity.getClass(), entity.getId(), true);
}