yunyezhang-work commented on code in PR #748:
URL: https://github.com/apache/ranger/pull/748#discussion_r2589806314


##########
security-admin/src/main/java/org/apache/ranger/common/RangerSearchUtil.java:
##########
@@ -239,14 +239,30 @@ public SearchFilter 
extractCommonCriteriasForFilter(HttpServletRequest request,
                 "Invalid value for parameter startIndex", 
MessageEnums.INVALID_INPUT_DATA, null, SearchFilter.START_INDEX);
 
         startIndex = startIndex < 0 ? 0 : startIndex;
+        logger.info("==> setStartIndex={}" , startIndex);
 
         ret.setStartIndex(startIndex);
 
         int pageSize = 
restErrorUtil.parseInt(request.getParameter(SearchFilter.PAGE_SIZE), 
configUtil.getDefaultMaxRows(),
                 "Invalid value for parameter pageSize", 
MessageEnums.INVALID_INPUT_DATA, null, SearchFilter.PAGE_SIZE);
-
+        logger.info("==> setMaxRows={}" , pageSize);
+        logger.info("==> DefaultMaxRows={}" , configUtil.getDefaultMaxRows());
         ret.setMaxRows(validatePageSize(pageSize));
 
+        int beginIndex = 
restErrorUtil.parseInt(request.getParameter(SearchFilter.BEGIN_INDEX), 0,
+                "Invalid value for parameter beginIndex", 
MessageEnums.INVALID_INPUT_DATA, null,
+                SearchFilter.BEGIN_INDEX);
+        beginIndex = beginIndex < 0 ? startIndex : beginIndex;
+        logger.info("==> setBeginIndex={}" , beginIndex);
+        ret.setBeginIndex(beginIndex);
+
+        int offsetSize = 
restErrorUtil.parseInt(request.getParameter(SearchFilter.OFFSET), 0,
+                "Invalid value for parameter offset", 
MessageEnums.INVALID_INPUT_DATA, null,
+                SearchFilter.OFFSET);
+        logger.info("==> setOffsetIndex={}" , offsetSize);
+        offsetSize = offsetSize < 0 ? pageSize : offsetSize;

Review Comment:
   Thank you for your reply. The offset design here allows exporting any number 
of policies, within the limit of the total number of policies. In a production 
environment, if the number of policies is too large (e.g., over 500,000), and 
the segmentation is limited to a specific page size (e.g., 500), then many 
exports would be needed to complete the data export. There was ambiguity 
between page size and offset in my previous code submission. This ambiguity has 
now been fixed.
   For example, if the current service only has 210 policies, even if the 
offset is set to 300, only these 210 policies can be exported.
   <img width="3480" height="494" alt="Clipboard_Screenshot_1764866366" 
src="https://github.com/user-attachments/assets/a0af1c88-51ee-48c4-847b-abde81a074ec";
 />



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