diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-14 19:34:58 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-14 19:34:58 +1200 |
commit | f9b7908c1fe0c04e9dcb93b4261b9fe0b4bb1617 (patch) | |
tree | 057957543cb18c20bf66de6d363fdc821700832d /src/org/traccar/database/PermissionsManager.java | |
parent | e98b18b8b0a8c99d24ac8010c1393978d071baa2 (diff) | |
download | trackermap-server-f9b7908c1fe0c04e9dcb93b4261b9fe0b4bb1617.tar.gz trackermap-server-f9b7908c1fe0c04e9dcb93b4261b9fe0b4bb1617.tar.bz2 trackermap-server-f9b7908c1fe0c04e9dcb93b4261b9fe0b4bb1617.zip |
Reduce dependencies on data manager (fix #954)
Diffstat (limited to 'src/org/traccar/database/PermissionsManager.java')
-rw-r--r-- | src/org/traccar/database/PermissionsManager.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java index 40783ad98..cfbbb9a39 100644 --- a/src/org/traccar/database/PermissionsManager.java +++ b/src/org/traccar/database/PermissionsManager.java @@ -21,13 +21,14 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.traccar.Context; import org.traccar.helper.Log; import org.traccar.model.Permission; import org.traccar.model.User; public class PermissionsManager { + private final DataManager dataManager; + private final Map<Long, User> users = new HashMap<>(); private final Map<Long, Set<Long>> permissions = new HashMap<>(); @@ -39,7 +40,8 @@ public class PermissionsManager { return permissions.get(userId); } - public PermissionsManager() { + public PermissionsManager(DataManager dataManager) { + this.dataManager = dataManager; refresh(); } @@ -47,10 +49,10 @@ public class PermissionsManager { users.clear(); permissions.clear(); try { - for (User user : Context.getDataManager().getUsers()) { + for (User user : dataManager.getUsers()) { users.put(user.getId(), user); } - for (Permission permission : Context.getDataManager().getPermissions()) { + for (Permission permission : dataManager.getPermissions()) { getNotNull(permission.getUserId()).add(permission.getDeviceId()); } } catch (SQLException error) { |