code: public <T> Page<T> findWithPermission(final Class<T> type,
                                            final Object criteria,
                                            final Pageable page,
                                            final String privilegeKey) {
          FilterConverter.QueryPart queryPart = FilterConverter.toJpql(criteria);
  
          Page<T> result;
          if (queryPart.isEmpty()) {
              result = permittedRepository.findAll(page, type, privilegeKey);
          } else {
              log.debug("find with condition: {}", queryPart);
              result = permittedRepository.findByCondition(queryPart.getQuery().toString(),
                  queryPart.getParams(),
                  page,
                  type,
                  privilegeKey);
          }
          return result;
      }
docs: Find entities with applied filtering and dynamic permissions written in SpEL (rresource condition).
  
  @param type         Entity class
  @param criteria     Filtering criteria from request
  @param page         page
  @param privilegeKey privilege key
  @param <T>          Entity type
  @return Entity page.