@Override
    public Set<PermissionType> retrievePermissions(ModeledAuthenticatedUser user,
            ModeledPermissions<? extends EntityModel> targetEntity,
            Set<String> effectiveGroups) throws GuacamoleException {

        // Retrieve permissions only if allowed
        if (canReadPermissions(user, targetEntity))
            return getPermissionInstances(getPermissionMapper().select(
                    targetEntity.getModel(),
                    effectiveGroups,
                    getCaseSensitivity()));

        // User cannot read this entity's permissions
        throw new GuacamoleSecurityException("Permission denied.");

    }
Runs the provided consumer function on subsets of the original collection
of objects, with each subset being no larger than the maximum batch size
configured for the JDBC environment. Any permission update that involves
passing potentially-large lists of models to a mapper should use this
method to perform the update to ensure that the maximum number of
parameters for an individual query is not exceeded.

@param <T>
    The type of object stored in the provided objects list, and consumed
    by the provided consumer.

@param objects
    A collection of objects to be partitioned.

@param consumer
    A function that will consume subsets of the objects from the provided
    collection of objects, performing any update as needed.

@throws GuacamoleException
    If the batch size cannot be determined for the JDBC environment.
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/permission/ModeledPermissionService.java