jmuehlner commented on code in PR #821:
URL: https://github.com/apache/guacamole-client/pull/821#discussion_r1157556072


##########
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/base/ModeledDirectoryObjectService.java:
##########
@@ -387,25 +396,36 @@ public Collection<InternalType> 
retrieveObjects(ModeledAuthenticatedUser user,
             Collection<String> identifiers) throws GuacamoleException {
 
         // Ignore invalid identifiers
-        identifiers = filterIdentifiers(identifiers);
+        List<String> filteredIdentifiers = filterIdentifiers(identifiers);
 
         // Do not query if no identifiers given
-        if (identifiers.isEmpty())
+        if (filteredIdentifiers.isEmpty())
             return Collections.<InternalType>emptyList();
 
-        Collection<ModelType> objects;
+        int batchSize = environment.getDefaultBatchSize();
 
-        // Bypass permission checks if the user is privileged
-        if (user.isPrivileged())
-            objects = getObjectMapper().select(identifiers);
+        Collection<ModelType> allObjects = new 
ArrayList<>(filteredIdentifiers.size());
+
+        for (int startIndex = 0; startIndex < filteredIdentifiers.size(); 
startIndex += batchSize) {

Review Comment:
   I do dig functional-style programming, but this still looks a little overly 
complex. Did you look into the function I mentioned above? All this IntStream + 
filter + map stuff looks like it could be replaced by
   
   ```
           Collection<ModelType> allObjects = 
Lists.partition(filteredIdentifiers, batchSize).stream()
                   .flatMap(chunk -> {
                        ...
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to