Skip to content

Commit

Permalink
Fixed duplicated devices loading for 'manager' user
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalidze committed Apr 27, 2015
1 parent dc85c7e commit 1e881ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public List<Device> getDevices() {
if (user.getAdmin()) {
return getSessionEntityManager().createQuery("SELECT x FROM Device x LEFT JOIN FETCH x.latestPosition").getResultList();
}
return user.getAllAvailableDevices();
return new LinkedList<Device>(user.getAllAvailableDevices());
}

@Transactional
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/traccar/web/shared/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ public List<Device> getDevices() {
return devices;
}

public List<Device> getAllAvailableDevices() {
List<Device> devices = new LinkedList<Device>();
public Set<Device> getAllAvailableDevices() {
Set<Device> devices = new HashSet<Device>();
devices.addAll(getDevices());
if (getManager()) {
for (User managedUser : getManagedUsers()) {
Expand Down

0 comments on commit 1e881ec

Please sign in to comment.