Skip to content

Commit

Permalink
Merge pull request #2485 from dilekamadushan/TRUNK-5048
Browse files Browse the repository at this point in the history
TRUNK-5048 Code in UserServiceImpl.getUsers might not be reached
  • Loading branch information
teleivo committed Dec 29, 2017
2 parents eeaefae + 1a04418 commit 6172ced
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api/src/main/java/org/openmrs/api/impl/UserServiceImpl.java
Expand Up @@ -587,20 +587,20 @@ public List<User> getUsers(String name, List<Role> roles, boolean includeRetired
if (roles == null) {
roles = new ArrayList<>();
}

// add the requested roles and all child roles for consideration
Set<Role> allRoles = new HashSet<>();
for (Role r : roles) {
allRoles.add(r);
allRoles.addAll(r.getAllChildRoles());
}


// if the authenticated role is in the list of searched roles, then all
// persons should be searched
Role authRole = getRole(RoleConstants.AUTHENTICATED);
if (roles.contains(authRole)) {
return dao.getUsers(name, new ArrayList<>(), includeRetired, start, length);
}

// add the requested roles and all child roles for consideration
Set<Role> allRoles = new HashSet<>();
for (Role r : roles) {
allRoles.add(r);
allRoles.addAll(r.getAllChildRoles());
}

return dao.getUsers(name, new ArrayList<>(allRoles), includeRetired, start, length);
}
Expand Down

0 comments on commit 6172ced

Please sign in to comment.