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


##########
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:
   That said, there's also probably easier ways to do this (splitting a list 
into chunks). Have a look at 
https://guava.dev/releases/19.0/api/docs/com/google/common/collect/Lists.html#partition(java.util.List,%20int)
 for example (the JDBC extensions already include guava as a dependency).



-- 
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