@Test @SuppressWarnings("unchecked") public void testGetUsers() { List<User> users = IteratorUtils.toList(directory.getUsers()); Assert.assertEquals(2, users.size()); }
@Override public Iterator<User> getUsers() { final Organization org = securityService.getOrganization(); if (org == null) throw new IllegalStateException("No organization is set"); final List<User> users = new ArrayList<>(); for (final UserProvider userProvider : userProviders) { final String providerOrgId = userProvider.getOrganization(); if (ALL_ORGANIZATIONS.equals(providerOrgId) || org.getId().equals(providerOrgId)) { userProvider.getUsers().forEachRemaining(users::add); } } return users.stream().sorted(Comparator.comparing(User::getUsername)).iterator(); }
UserAndRoleDirectoryServiceImpl implements UserDirectoryService, UserDetailsService, RoleDirectoryService { @Override public Iterator<User> getUsers() { final Organization org = securityService.getOrganization(); if (org == null) throw new IllegalStateException("No organization is set"); final List<User> users = new ArrayList<>(); for (final UserProvider userProvider : userProviders) { final String providerOrgId = userProvider.getOrganization(); if (ALL_ORGANIZATIONS.equals(providerOrgId) || org.getId().equals(providerOrgId)) { userProvider.getUsers().forEachRemaining(users::add); } } return users.stream().sorted(Comparator.comparing(User::getUsername)).iterator(); } }
UserAndRoleDirectoryServiceImpl implements UserDirectoryService, UserDetailsService, RoleDirectoryService { @Override public Iterator<User> getUsers() { final Organization org = securityService.getOrganization(); if (org == null) throw new IllegalStateException("No organization is set"); final List<User> users = new ArrayList<>(); for (final UserProvider userProvider : userProviders) { final String providerOrgId = userProvider.getOrganization(); if (ALL_ORGANIZATIONS.equals(providerOrgId) || org.getId().equals(providerOrgId)) { userProvider.getUsers().forEachRemaining(users::add); } } return users.stream().sorted(Comparator.comparing(User::getUsername)).iterator(); }  }
UserAndRoleDirectoryServiceImpl implements UserDirectoryService, UserDetailsService, RoleDirectoryService { @Override public Iterator<User> getUsers() { final Organization org = securityService.getOrganization(); if (org == null) throw new IllegalStateException("No organization is set"); final List<User> users = new ArrayList<>(); for (final UserProvider userProvider : userProviders) { final String providerOrgId = userProvider.getOrganization(); if (ALL_ORGANIZATIONS.equals(providerOrgId) || org.getId().equals(providerOrgId)) { userProvider.getUsers().forEachRemaining(users::add); } } return users.stream().sorted(Comparator.comparing(User::getUsername)).iterator(); }  @Override Iterator<User> getUsers(); @Override User loadUser(String userName); @Override Iterator<User> loadUsers(Collection<String> userNames); @Override UserDetails loadUserByUsername(String userName); @Reference(name = "securityService") void setSecurityService(SecurityService securityService); @Override Iterator<User> findUsers(String query, int offset, int limit); @Override List<Role> findRoles(String query, Role.Target target, int offset, int limit); @Override long countUsers(); @Override void invalidate(String userName); }
UserAndRoleDirectoryServiceImpl implements UserDirectoryService, UserDetailsService, RoleDirectoryService { @Override public Iterator<User> getUsers() { final Organization org = securityService.getOrganization(); if (org == null) throw new IllegalStateException("No organization is set"); final List<User> users = new ArrayList<>(); for (final UserProvider userProvider : userProviders) { final String providerOrgId = userProvider.getOrganization(); if (ALL_ORGANIZATIONS.equals(providerOrgId) || org.getId().equals(providerOrgId)) { userProvider.getUsers().forEachRemaining(users::add); } } return users.stream().sorted(Comparator.comparing(User::getUsername)).iterator(); }  @Override Iterator<User> getUsers(); @Override User loadUser(String userName); @Override Iterator<User> loadUsers(Collection<String> userNames); @Override UserDetails loadUserByUsername(String userName); @Reference(name = "securityService") void setSecurityService(SecurityService securityService); @Override Iterator<User> findUsers(String query, int offset, int limit); @Override List<Role> findRoles(String query, Role.Target target, int offset, int limit); @Override long countUsers(); @Override void invalidate(String userName); static final String USER_CACHE_SIZE_KEY; static final String USER_CACHE_EXPIRY_KEY; }