aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-07-21 09:59:27 +0500
committerAbyss777 <abyss@fox5.ru>2017-07-21 09:59:27 +0500
commit839e741653c9b61e573fa1cdd0dad0641c79bcec (patch)
tree69ef63138122eb0d8cdebe38f678e1d0e2ff82df /src/org
parente00fbfa466b17e94f59e6ff8fefb83f08999b3ec (diff)
downloadtraccar-server-839e741653c9b61e573fa1cdd0dad0641c79bcec.tar.gz
traccar-server-839e741653c9b61e573fa1cdd0dad0641c79bcec.tar.bz2
traccar-server-839e741653c9b61e573fa1cdd0dad0641c79bcec.zip
Abolish permissions classes and get permissions as Map from DB
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/database/AttributesManager.java5
-rw-r--r--src/org/traccar/database/CalendarManager.java3
-rw-r--r--src/org/traccar/database/DataManager.java8
-rw-r--r--src/org/traccar/database/DriversManager.java5
-rw-r--r--src/org/traccar/database/ExtendedObjectManager.java33
-rw-r--r--src/org/traccar/database/GeofenceManager.java5
-rw-r--r--src/org/traccar/database/PermissionsManager.java24
-rw-r--r--src/org/traccar/database/QueryBuilder.java25
-rw-r--r--src/org/traccar/database/SimpleObjectManager.java23
-rw-r--r--src/org/traccar/model/AttributePermission.java36
-rw-r--r--src/org/traccar/model/BaseDevicePermission.java31
-rw-r--r--src/org/traccar/model/BaseGroupPermission.java31
-rw-r--r--src/org/traccar/model/BasePermission.java23
-rw-r--r--src/org/traccar/model/BaseUserPermission.java31
-rw-r--r--src/org/traccar/model/CalendarPermission.java35
-rw-r--r--src/org/traccar/model/DeviceAttribute.java35
-rw-r--r--src/org/traccar/model/DeviceDriver.java36
-rw-r--r--src/org/traccar/model/DeviceGeofence.java35
-rw-r--r--src/org/traccar/model/DevicePermission.java40
-rw-r--r--src/org/traccar/model/DriverPermission.java35
-rw-r--r--src/org/traccar/model/GeofencePermission.java35
-rw-r--r--src/org/traccar/model/GroupAttribute.java35
-rw-r--r--src/org/traccar/model/GroupDriver.java36
-rw-r--r--src/org/traccar/model/GroupGeofence.java35
-rw-r--r--src/org/traccar/model/GroupPermission.java40
-rw-r--r--src/org/traccar/model/UserPermission.java41
26 files changed, 74 insertions, 647 deletions
diff --git a/src/org/traccar/database/AttributesManager.java b/src/org/traccar/database/AttributesManager.java
index 6531019d1..266fc5526 100644
--- a/src/org/traccar/database/AttributesManager.java
+++ b/src/org/traccar/database/AttributesManager.java
@@ -18,16 +18,13 @@ package org.traccar.database;
import java.sql.SQLException;
-import org.traccar.model.AttributePermission;
import org.traccar.model.Attribute;
-import org.traccar.model.DeviceAttribute;
-import org.traccar.model.GroupAttribute;
import org.traccar.model.BaseModel;
public class AttributesManager extends ExtendedObjectManager {
public AttributesManager(DataManager dataManager) {
- super(dataManager, Attribute.class, AttributePermission.class, DeviceAttribute.class, GroupAttribute.class);
+ super(dataManager, Attribute.class);
refreshItems();
refreshExtendedPermissions();
}
diff --git a/src/org/traccar/database/CalendarManager.java b/src/org/traccar/database/CalendarManager.java
index e00b4faa6..80bb79db2 100644
--- a/src/org/traccar/database/CalendarManager.java
+++ b/src/org/traccar/database/CalendarManager.java
@@ -17,12 +17,11 @@
package org.traccar.database;
import org.traccar.model.Calendar;
-import org.traccar.model.CalendarPermission;
public class CalendarManager extends SimpleObjectManager {
public CalendarManager(DataManager dataManager) {
- super(dataManager, Calendar.class, CalendarPermission.class);
+ super(dataManager, Calendar.class);
refreshItems();
}
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 7497294a1..39ffe6552 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -285,6 +285,14 @@ public class DataManager {
return QueryBuilder.create(dataSource, getQuery(query)).executeQuery(clazz);
}
+ public Collection<Map<String, Long>> getPermissions(String owner, String property) throws SQLException {
+ String query = "database.select"
+ + owner.substring(0, 1).toUpperCase() + owner.substring(1)
+ + property.substring(0, 1).toUpperCase() + property.substring(1)
+ + "s";
+ return QueryBuilder.create(dataSource, getQuery(query)).executeMapQuery(Long.class);
+ }
+
public void addObject(BaseModel entity) throws SQLException {
String query = "database.insert" + entity.getClass().getSimpleName();
entity.setId(QueryBuilder.create(dataSource, getQuery(query), true)
diff --git a/src/org/traccar/database/DriversManager.java b/src/org/traccar/database/DriversManager.java
index dba06a37f..8c35f3ddf 100644
--- a/src/org/traccar/database/DriversManager.java
+++ b/src/org/traccar/database/DriversManager.java
@@ -21,10 +21,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.traccar.helper.Log;
-import org.traccar.model.DeviceDriver;
import org.traccar.model.Driver;
-import org.traccar.model.DriverPermission;
-import org.traccar.model.GroupDriver;
import org.traccar.model.BaseModel;
public class DriversManager extends ExtendedObjectManager {
@@ -32,7 +29,7 @@ public class DriversManager extends ExtendedObjectManager {
private final Map<String, Driver> driversByUniqueId = new ConcurrentHashMap<>();
public DriversManager(DataManager dataManager) {
- super(dataManager, Driver.class, DriverPermission.class, DeviceDriver.class, GroupDriver.class);
+ super(dataManager, Driver.class);
refreshItems();
refreshExtendedPermissions();
}
diff --git a/src/org/traccar/database/ExtendedObjectManager.java b/src/org/traccar/database/ExtendedObjectManager.java
index caad989c2..fce32fb41 100644
--- a/src/org/traccar/database/ExtendedObjectManager.java
+++ b/src/org/traccar/database/ExtendedObjectManager.java
@@ -25,9 +25,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.traccar.Context;
import org.traccar.helper.Log;
-import org.traccar.model.BaseDevicePermission;
-import org.traccar.model.BaseGroupPermission;
-import org.traccar.model.BaseUserPermission;
import org.traccar.model.Device;
import org.traccar.model.BaseModel;
@@ -37,17 +34,9 @@ public abstract class ExtendedObjectManager extends SimpleObjectManager {
private final Map<Long, Set<Long>> deviceItemsWithGroups = new ConcurrentHashMap<>();
private final Map<Long, Set<Long>> groupItems = new ConcurrentHashMap<>();
- private Class<? extends BaseDevicePermission> devicePermissionClass;
- private Class<? extends BaseGroupPermission> groupPermissionClass;
-
protected ExtendedObjectManager(DataManager dataManager,
- Class<? extends BaseModel> baseClass,
- Class<? extends BaseUserPermission> permissionClass,
- Class<? extends BaseDevicePermission> devicePermissionClass,
- Class<? extends BaseGroupPermission> groupPermissionClass) {
- super(dataManager, baseClass, permissionClass);
- this.devicePermissionClass = devicePermissionClass;
- this.groupPermissionClass = groupPermissionClass;
+ Class<? extends BaseModel> baseClass) {
+ super(dataManager, baseClass);
}
public final Set<Long> getGroupItems(long groupId) {
@@ -89,24 +78,24 @@ public abstract class ExtendedObjectManager extends SimpleObjectManager {
if (getDataManager() != null) {
try {
- Collection<? extends BaseGroupPermission> databaseGroupPermissions =
- getDataManager().getObjects(groupPermissionClass);
+ Collection<Map<String, Long>> databaseGroupPermissions =
+ getDataManager().getPermissions("Group", getBaseClassName());
clearGroupItems();
- for (BaseGroupPermission groupPermission : databaseGroupPermissions) {
- getGroupItems(groupPermission.getGroupId()).add(groupPermission.getSlaveId());
+ for (Map<String, Long> groupPermission : databaseGroupPermissions) {
+ getGroupItems(groupPermission.get("groupId")).add(groupPermission.get(getBaseClassIdName()));
}
- Collection<? extends BaseDevicePermission> databaseDevicePermissions =
- getDataManager().getObjects(devicePermissionClass);
+ Collection<Map<String, Long>> databaseDevicePermissions =
+ getDataManager().getPermissions("Device", getBaseClassName());
Collection<Device> allDevices = Context.getDeviceManager().getAllDevices();
clearDeviceItems();
deviceItemsWithGroups.clear();
- for (BaseDevicePermission devicePermission : databaseDevicePermissions) {
- getDeviceItems(devicePermission.getDeviceId()).add(devicePermission.getSlaveId());
- getAllDeviceItems(devicePermission.getDeviceId()).add(devicePermission.getSlaveId());
+ for (Map<String, Long> devicePermission : databaseDevicePermissions) {
+ getDeviceItems(devicePermission.get("deviceId")).add(devicePermission.get(getBaseClassIdName()));
+ getAllDeviceItems(devicePermission.get("deviceId")).add(devicePermission.get(getBaseClassIdName()));
}
for (Device device : allDevices) {
diff --git a/src/org/traccar/database/GeofenceManager.java b/src/org/traccar/database/GeofenceManager.java
index ed1f26f78..bc2c27a65 100644
--- a/src/org/traccar/database/GeofenceManager.java
+++ b/src/org/traccar/database/GeofenceManager.java
@@ -20,16 +20,13 @@ import java.util.List;
import org.traccar.Context;
import org.traccar.model.Device;
-import org.traccar.model.DeviceGeofence;
import org.traccar.model.Geofence;
-import org.traccar.model.GeofencePermission;
-import org.traccar.model.GroupGeofence;
import org.traccar.model.Position;
public class GeofenceManager extends ExtendedObjectManager {
public GeofenceManager(DataManager dataManager) {
- super(dataManager, Geofence.class, GeofencePermission.class, DeviceGeofence.class, GroupGeofence.class);
+ super(dataManager, Geofence.class);
refreshItems();
refreshExtendedPermissions();
}
diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java
index caae86b84..4646071aa 100644
--- a/src/org/traccar/database/PermissionsManager.java
+++ b/src/org/traccar/database/PermissionsManager.java
@@ -18,12 +18,9 @@ package org.traccar.database;
import org.traccar.Context;
import org.traccar.helper.Log;
import org.traccar.model.Device;
-import org.traccar.model.DevicePermission;
import org.traccar.model.Group;
-import org.traccar.model.GroupPermission;
import org.traccar.model.Server;
import org.traccar.model.User;
-import org.traccar.model.UserPermission;
import java.lang.reflect.Method;
import java.sql.SQLException;
@@ -112,8 +109,8 @@ public class PermissionsManager {
public final void refreshUserPermissions() {
userPermissions.clear();
try {
- for (UserPermission permission : dataManager.getObjects(UserPermission.class)) {
- getUserPermissions(permission.getUserId()).add(permission.getManagedUserId());
+ for (Map<String, Long> permission : dataManager.getPermissions("User", "Permission")) {
+ getUserPermissions(permission.get("userId")).add(permission.get("managedUserId"));
}
} catch (SQLException error) {
Log.warning(error);
@@ -126,19 +123,20 @@ public class PermissionsManager {
try {
GroupTree groupTree = new GroupTree(Context.getDeviceManager().getAllGroups(),
Context.getDeviceManager().getAllDevices());
- for (GroupPermission permission : dataManager.getObjects(GroupPermission.class)) {
- Set<Long> userGroupPermissions = getGroupPermissions(permission.getUserId());
- Set<Long> userDevicePermissions = getDevicePermissions(permission.getUserId());
- userGroupPermissions.add(permission.getGroupId());
- for (Group group : groupTree.getGroups(permission.getGroupId())) {
+ for (Map<String, Long> groupPermission : dataManager.getPermissions("Group", "Permission")) {
+ Set<Long> userGroupPermissions = getGroupPermissions(groupPermission.get("userId"));
+ Set<Long> userDevicePermissions = getDevicePermissions(groupPermission.get("userId"));
+ userGroupPermissions.add(groupPermission.get("groupId"));
+ for (Group group : groupTree.getGroups(groupPermission.get("groupId"))) {
userGroupPermissions.add(group.getId());
}
- for (Device device : groupTree.getDevices(permission.getGroupId())) {
+ for (Device device : groupTree.getDevices(groupPermission.get("groupId"))) {
userDevicePermissions.add(device.getId());
}
}
- for (DevicePermission permission : dataManager.getObjects(DevicePermission.class)) {
- getDevicePermissions(permission.getUserId()).add(permission.getDeviceId());
+
+ for (Map<String, Long> devicePermission : dataManager.getPermissions("Device", "Permission")) {
+ getDevicePermissions(devicePermission.get("userId")).add(devicePermission.get("deviceId"));
}
groupDevices.clear();
diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java
index a24e6f0bf..440690a76 100644
--- a/src/org/traccar/database/QueryBuilder.java
+++ b/src/org/traccar/database/QueryBuilder.java
@@ -35,6 +35,7 @@ import java.sql.Types;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -487,4 +488,28 @@ public final class QueryBuilder {
return 0;
}
+ public <T> Collection<Map<String, T>> executeMapQuery(Class<T> clazz) throws SQLException {
+ List<Map<String, T>> result = new LinkedList<>();
+ if (query != null) {
+ try {
+ try (ResultSet resultSet = statement.executeQuery()) {
+ ResultSetMetaData resultMetaData = resultSet.getMetaData();
+ while (resultSet.next()) {
+ LinkedHashMap<String, T> map = new LinkedHashMap<>();
+ for (int i = 1; i <= resultMetaData.getColumnCount(); i++) {
+ String label = resultMetaData.getColumnLabel(i);
+ map.put(label, resultSet.getObject(label, clazz));
+ }
+ result.add(map);
+ }
+ }
+ } finally {
+ statement.close();
+ connection.close();
+ }
+ }
+
+ return result;
+ }
+
}
diff --git a/src/org/traccar/database/SimpleObjectManager.java b/src/org/traccar/database/SimpleObjectManager.java
index aae407b56..c4fc0e97a 100644
--- a/src/org/traccar/database/SimpleObjectManager.java
+++ b/src/org/traccar/database/SimpleObjectManager.java
@@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.traccar.Context;
import org.traccar.helper.Log;
-import org.traccar.model.BaseUserPermission;
import org.traccar.model.BaseModel;
public abstract class SimpleObjectManager {
@@ -37,14 +36,14 @@ public abstract class SimpleObjectManager {
private final Map<Long, Set<Long>> userItems = new ConcurrentHashMap<>();
private Class<? extends BaseModel> baseClass;
- private Class<? extends BaseUserPermission> permissionClass;
+ private String baseClassName;
+ private String baseClassIdName;
- protected SimpleObjectManager(DataManager dataManager,
- Class<? extends BaseModel> baseClass,
- Class<? extends BaseUserPermission> permissionClass) {
+ protected SimpleObjectManager(DataManager dataManager, Class<? extends BaseModel> baseClass) {
this.dataManager = dataManager;
this.baseClass = baseClass;
- this.permissionClass = permissionClass;
+ baseClassName = baseClass.getSimpleName();
+ baseClassIdName = baseClassName.substring(0, 1).toLowerCase() + baseClassName.substring(1) + "Id";
}
protected final DataManager getDataManager() {
@@ -55,6 +54,14 @@ public abstract class SimpleObjectManager {
return baseClass;
}
+ protected final String getBaseClassName() {
+ return baseClassName;
+ }
+
+ protected final String getBaseClassIdName() {
+ return baseClassIdName;
+ }
+
public final BaseModel getById(long itemId) {
return items.get(itemId);
}
@@ -104,8 +111,8 @@ public abstract class SimpleObjectManager {
if (dataManager != null) {
try {
clearUserItems();
- for (BaseUserPermission permission : dataManager.getObjects(this.permissionClass)) {
- getUserItems(permission.getUserId()).add(permission.getSlaveId());
+ for (Map<String, Long> permission : dataManager.getPermissions(baseClassName, "Permission")) {
+ getUserItems(permission.get("userId")).add(permission.get(baseClassIdName));
}
} catch (SQLException error) {
Log.warning(error);
diff --git a/src/org/traccar/model/AttributePermission.java b/src/org/traccar/model/AttributePermission.java
deleted file mode 100644
index e6bbb0f91..000000000
--- a/src/org/traccar/model/AttributePermission.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class AttributePermission extends BaseUserPermission {
-
- private long attributeId;
-
- public long getAttributeId() {
- return attributeId;
- }
-
- public void setAttributeId(long attributeId) {
- this.attributeId = attributeId;
- }
-
- @Override
- public long getSlaveId() {
- return attributeId;
- }
-
-}
diff --git a/src/org/traccar/model/BaseDevicePermission.java b/src/org/traccar/model/BaseDevicePermission.java
deleted file mode 100644
index 6eda15d0e..000000000
--- a/src/org/traccar/model/BaseDevicePermission.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public abstract class BaseDevicePermission implements BasePermission {
-
- private long deviceId;
-
- public long getDeviceId() {
- return deviceId;
- }
-
- public void setDeviceId(long deviceId) {
- this.deviceId = deviceId;
- }
-
-}
diff --git a/src/org/traccar/model/BaseGroupPermission.java b/src/org/traccar/model/BaseGroupPermission.java
deleted file mode 100644
index 5a289cad2..000000000
--- a/src/org/traccar/model/BaseGroupPermission.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public abstract class BaseGroupPermission implements BasePermission {
-
- private long groupId;
-
- public long getGroupId() {
- return groupId;
- }
-
- public void setGroupId(long groupId) {
- this.groupId = groupId;
- }
-
-}
diff --git a/src/org/traccar/model/BasePermission.java b/src/org/traccar/model/BasePermission.java
deleted file mode 100644
index 6f1baffdc..000000000
--- a/src/org/traccar/model/BasePermission.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public interface BasePermission {
-
- long getSlaveId();
-
-}
diff --git a/src/org/traccar/model/BaseUserPermission.java b/src/org/traccar/model/BaseUserPermission.java
deleted file mode 100644
index 64a7be82a..000000000
--- a/src/org/traccar/model/BaseUserPermission.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public abstract class BaseUserPermission implements BasePermission {
-
- private long userId;
-
- public long getUserId() {
- return userId;
- }
-
- public void setUserId(long userId) {
- this.userId = userId;
- }
-
-}
diff --git a/src/org/traccar/model/CalendarPermission.java b/src/org/traccar/model/CalendarPermission.java
deleted file mode 100644
index d95e51b0e..000000000
--- a/src/org/traccar/model/CalendarPermission.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
- * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class CalendarPermission extends BaseUserPermission {
-
- private long calendarId;
-
- public long getCalendarId() {
- return calendarId;
- }
-
- public void setCalendarId(long calendarId) {
- this.calendarId = calendarId;
- }
-
- @Override
- public long getSlaveId() {
- return calendarId;
- }
-}
diff --git a/src/org/traccar/model/DeviceAttribute.java b/src/org/traccar/model/DeviceAttribute.java
deleted file mode 100644
index bfcd873fa..000000000
--- a/src/org/traccar/model/DeviceAttribute.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class DeviceAttribute extends BaseDevicePermission {
-
- private long attributeId;
-
- public long getAttributeId() {
- return attributeId;
- }
-
- public void setAttributeId(long attributeId) {
- this.attributeId = attributeId;
- }
-
- @Override
- public long getSlaveId() {
- return attributeId;
- }
-}
diff --git a/src/org/traccar/model/DeviceDriver.java b/src/org/traccar/model/DeviceDriver.java
deleted file mode 100644
index f5257531d..000000000
--- a/src/org/traccar/model/DeviceDriver.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class DeviceDriver extends BaseDevicePermission {
-
- private long driverId;
-
- public long getDriverId() {
- return driverId;
- }
-
- public void setDriverId(long driverId) {
- this.driverId = driverId;
- }
-
- @Override
- public long getSlaveId() {
- return driverId;
- }
-
-}
diff --git a/src/org/traccar/model/DeviceGeofence.java b/src/org/traccar/model/DeviceGeofence.java
deleted file mode 100644
index 7ea4d3bea..000000000
--- a/src/org/traccar/model/DeviceGeofence.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class DeviceGeofence extends BaseDevicePermission {
-
- private long geofenceId;
-
- public long getGeofenceId() {
- return geofenceId;
- }
-
- public void setGeofenceId(long geofenceId) {
- this.geofenceId = geofenceId;
- }
-
- @Override
- public long getSlaveId() {
- return geofenceId;
- }
-
-}
diff --git a/src/org/traccar/model/DevicePermission.java b/src/org/traccar/model/DevicePermission.java
deleted file mode 100644
index c62173132..000000000
--- a/src/org/traccar/model/DevicePermission.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class DevicePermission {
-
- private long userId;
-
- public long getUserId() {
- return userId;
- }
-
- public void setUserId(long userId) {
- this.userId = userId;
- }
-
- private long deviceId;
-
- public long getDeviceId() {
- return deviceId;
- }
-
- public void setDeviceId(long deviceId) {
- this.deviceId = deviceId;
- }
-
-}
diff --git a/src/org/traccar/model/DriverPermission.java b/src/org/traccar/model/DriverPermission.java
deleted file mode 100644
index 44f34c8e6..000000000
--- a/src/org/traccar/model/DriverPermission.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class DriverPermission extends BaseUserPermission {
-
- private long driverId;
-
- public long getDriverId() {
- return driverId;
- }
-
- public void setDriverId(long driverId) {
- this.driverId = driverId;
- }
-
- @Override
- public long getSlaveId() {
- return driverId;
- }
-}
diff --git a/src/org/traccar/model/GeofencePermission.java b/src/org/traccar/model/GeofencePermission.java
deleted file mode 100644
index 8606cc3e7..000000000
--- a/src/org/traccar/model/GeofencePermission.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class GeofencePermission extends BaseUserPermission {
-
- private long geofenceId;
-
- public long getGeofenceId() {
- return geofenceId;
- }
-
- public void setGeofenceId(long geofenceId) {
- this.geofenceId = geofenceId;
- }
-
- @Override
- public long getSlaveId() {
- return geofenceId;
- }
-
-}
diff --git a/src/org/traccar/model/GroupAttribute.java b/src/org/traccar/model/GroupAttribute.java
deleted file mode 100644
index cfaf9cc2f..000000000
--- a/src/org/traccar/model/GroupAttribute.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class GroupAttribute extends BaseGroupPermission {
-
- private long attributeId;
-
- public long getAttributeId() {
- return attributeId;
- }
-
- public void setAttributeId(long attributeId) {
- this.attributeId = attributeId;
- }
-
- @Override
- public long getSlaveId() {
- return attributeId;
- }
-}
diff --git a/src/org/traccar/model/GroupDriver.java b/src/org/traccar/model/GroupDriver.java
deleted file mode 100644
index 9bf74c214..000000000
--- a/src/org/traccar/model/GroupDriver.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class GroupDriver extends BaseGroupPermission {
-
- private long driverId;
-
- public long getDriverId() {
- return driverId;
- }
-
- public void setDriverId(long driverId) {
- this.driverId = driverId;
- }
-
- @Override
- public long getSlaveId() {
- return driverId;
- }
-
-}
diff --git a/src/org/traccar/model/GroupGeofence.java b/src/org/traccar/model/GroupGeofence.java
deleted file mode 100644
index 89830324d..000000000
--- a/src/org/traccar/model/GroupGeofence.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class GroupGeofence extends BaseGroupPermission {
-
- private long geofenceId;
-
- public long getGeofenceId() {
- return geofenceId;
- }
-
- public void setGeofenceId(long geofenceId) {
- this.geofenceId = geofenceId;
- }
-
- @Override
- public long getSlaveId() {
- return geofenceId;
- }
-
-}
diff --git a/src/org/traccar/model/GroupPermission.java b/src/org/traccar/model/GroupPermission.java
deleted file mode 100644
index 59b41b049..000000000
--- a/src/org/traccar/model/GroupPermission.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class GroupPermission {
-
- private long userId;
-
- public long getUserId() {
- return userId;
- }
-
- public void setUserId(long userId) {
- this.userId = userId;
- }
-
- private long groupId;
-
- public long getGroupId() {
- return groupId;
- }
-
- public void setGroupId(long groupId) {
- this.groupId = groupId;
- }
-
-}
diff --git a/src/org/traccar/model/UserPermission.java b/src/org/traccar/model/UserPermission.java
deleted file mode 100644
index 39ead5ef1..000000000
--- a/src/org/traccar/model/UserPermission.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.traccar.model;
-
-public class UserPermission {
-
- private long userId;
-
- public long getUserId() {
- return userId;
- }
-
- public void setUserId(long userId) {
- this.userId = userId;
- }
-
- private long managedUserId;
-
- public long getManagedUserId() {
- return managedUserId;
- }
-
- public void setManagedUserId(long managedUserId) {
- this.managedUserId = managedUserId;
- }
-
-}