aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/PermissionsManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-03-11 16:22:40 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-03-11 16:22:40 +1300
commit5e2ad583f62db56fe81ec4c41756fb3fc28747a5 (patch)
treeaa920439e487ba8f28d1bea116534a350985c0d6 /src/org/traccar/database/PermissionsManager.java
parent8a449b2b2f8a1c250543ad5c6134dedf302c75c5 (diff)
downloadtrackermap-server-5e2ad583f62db56fe81ec4c41756fb3fc28747a5.tar.gz
trackermap-server-5e2ad583f62db56fe81ec4c41756fb3fc28747a5.tar.bz2
trackermap-server-5e2ad583f62db56fe81ec4c41756fb3fc28747a5.zip
Add devices to group tree
Diffstat (limited to 'src/org/traccar/database/PermissionsManager.java')
-rw-r--r--src/org/traccar/database/PermissionsManager.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java
index 0aefb9605..dc37bbc84 100644
--- a/src/org/traccar/database/PermissionsManager.java
+++ b/src/org/traccar/database/PermissionsManager.java
@@ -16,7 +16,6 @@
package org.traccar.database;
import java.sql.SQLException;
-import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -69,23 +68,23 @@ public class PermissionsManager {
users.put(user.getId(), user);
}
- GroupTree groupTree = new GroupTree(dataManager.getAllGroups());
+ GroupTree groupTree = new GroupTree(dataManager.getAllGroups(), dataManager.getAllDevices());
for (GroupPermission permission : dataManager.getGroupPermissions()) {
Set<Long> userGroupPermissions = getGroupPermissions(permission.getUserId());
+ Set<Long> userDevicePermissions = getDevicePermissions(permission.getUserId());
userGroupPermissions.add(permission.getGroupId());
- for (Group group : groupTree.getDescendants(permission.getGroupId())) {
+ for (Group group : groupTree.getGroups(permission.getGroupId())) {
userGroupPermissions.add(group.getId());
}
+ for (Device device : groupTree.getDevices(permission.getGroupId())) {
+ userDevicePermissions.add(device.getId());
+ }
}
for (DevicePermission permission : dataManager.getDevicePermissions()) {
getDevicePermissions(permission.getUserId()).add(permission.getDeviceId());
}
- for (Device device : dataManager.getAllDevices()) {
- // TODO
- }
-
} catch (SQLException error) {
Log.warning(error);
}