-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/74604/#review225760
-----------------------------------------------------------




security-admin/src/main/java/org/apache/ranger/biz/GdsDBStore.java
Lines 227 (patched)
<https://reviews.apache.org/r/74604/#comment314182>

    Consider avoiding duplicate code in getDatasetNames() and searchDatasets(), 
by having getDatasetNames() call searchDatasets():
    
      PList<RangerDataset> datasets = searchDatasets(searchFilter);
      PList<String>        ret = new PList<>(new ArrayList<>(), 
datasets.getStartIndex(), datasets.getPageSize(), datasets.getTotalCount(), 
datasets.getResultSize(), datasets.getSortType(), datasets.getSortBy());
    
      ret.setQueryTimeMS(datasets.getQueryTimeMS());
      
      if (datasets.getList() != null) {
        for (RangerDataset dataset : datasets.getList()) {
          ret.getList().add(dataset.getName());
        }
      }
    
    Similar update for getProjectNames() as well.


- Madhan Neethiraj


On Sept. 15, 2023, 7:23 a.m., Subhrat Chaudhary wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/74604/
> -----------------------------------------------------------
> 
> (Updated Sept. 15, 2023, 7:23 a.m.)
> 
> 
> Review request for ranger, Anand Nadar, Ankita Sinha, Madhan Neethiraj, 
> Monika Kachhadiya, and Prashant Satam.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/RANGER-4413
>     
> https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/RANGER-4413
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> In Ranger, we have pagination parameters (pageSize and startIndex) to get 
> paginated records, which build queries and get records from DB accordingly. 
> For GDS APIs, this will not work in we have to do ACL evaluation on the 
> records from DB. Pagination for GDS APIs needs to be done in Java.
> 
> 
> Diffs
> -----
> 
>   security-admin/src/main/java/org/apache/ranger/biz/GdsDBStore.java 
> 55c8495e4 
> 
> 
> Diff: https://reviews.apache.org/r/74604/diff/1/
> 
> 
> Testing
> -------
> 
> Validated pagination for GET Dataset API for which ACL evaluation is in place 
> - /service/gds/dataset:
> API: 
> http://localhost:6080/service/gds/dataset?gdsPermission=LIST&pageSize=5&startIndex=10
> Response:
> {
>     "startIndex": 10,
>     "pageSize": 5,
>     "totalCount": 12,
>     "resultSize": 2,
>     "sortType": "datasetId",
>     "sortBy": "asc",
>     "list": [
>         {
>             "id": 11,
>             "guid": "c902ce32-9bed-4422-a43b-4a4c478f5515",
>             "isEnabled": true,
>             "createdBy": "Admin",
>             "updatedBy": "Admin",
>             "createTime": 1694710751099,
>             "updateTime": 1694710751100,
>             "version": 1,
>             "description": "This is GDS description",
>             "name": "Dataset95",
>             "termsOfUse": "Gds Terms of Use"
>         },
>         {
>             "id": 12,
>             "guid": "8fa813d0-9dd4-44cf-b283-4c50fcb28839",
>             "isEnabled": true,
>             "createdBy": "Admin",
>             "updatedBy": "Admin",
>             "createTime": 1694710756341,
>             "updateTime": 1694710756342,
>             "version": 1,
>             "description": "This is GDS description",
>             "name": "Dataset96",
>             "termsOfUse": "Gds Terms of Use"
>         }
>     ],
>     "listSize": 2
> }
> 
> 
> Thanks,
> 
> Subhrat Chaudhary
> 
>

Reply via email to