[
https://issues.apache.org/jira/browse/RANGER-1025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pradeep Agrawal updated RANGER-1025:
------------------------------------
Attachment: RANGER-1025-1.patch
> Policy search REST API implemented in public api V1 is not returning results
> as expected
> ----------------------------------------------------------------------------------------
>
> Key: RANGER-1025
> URL: https://issues.apache.org/jira/browse/RANGER-1025
> Project: Ranger
> Issue Type: Bug
> Components: Ranger
> Affects Versions: 0.6.0
> Reporter: Pradeep Agrawal
> Assignee: Pradeep Agrawal
> Fix For: 0.6.0
>
> Attachments: RANGER-1025-1.patch
>
>
> If pageSize is big enough to include the policies we are searching for we get
> the results we expect.
> curl -u admin:admin -p -k -X GET
> "http://localhost:6080/service/public/api/policy?repositoryName=Sandbox_hadoop&resourceName=test&pageSize=2”
> {
> "startIndex": 0,
> "pageSize": 1,
> "totalCount": 1,
> "resultSize": 1,
> "queryTimeMS": 1465234633007,
> "vXPolicies": [
> {
> "id": 7,
> "createDate": "2016-03-14T14:49:35Z",
> "updateDate": "2016-06-06T16:14:52Z",
> "owner": "Admin",
> "updatedBy": "Admin",
> "policyName": "HDFS Global Allow",
> "resourceName": "/,/*,test",
> "description": "This policy gives global permission for all users. Disable
> this to test Apache Ranger",
> "repositoryName": "Sandbox_hadoop",
> "repositoryType": "hdfs",
> "permMapList": [
> { "userList": [], "groupList": [ "public" ], "permList": [ "Read", "Write",
> "Execute", "Admin" ] }
> ],
> "isEnabled": true,
> "isRecursive": true,
> "isAuditEnabled": true,
> "version": "7",
> "replacePerm": false
> }
> ]
> }
> Not returning a policy as expected. It seems as if the filtering is happening
> after retrieving the first n policies where n is the pageSize.
> curl -u admin:admin -p -k -X GET
> "http://localhost:6080/service/public/api/policy?repositoryName=Sandbox_hadoop&resourceName=test&pageSize=1”
> {"startIndex":0,"pageSize":0,"totalCount":0,"resultSize":0,"queryTimeMS":1465234722982,"vXPolicies":[]}
> This shows page size of 1 is clipping the results:
> You can see pageSize=1 returns the first policy ordered by id
> curl -u admin:admin -p -k -X GET
> "http://localhost:6080/service/public/api/policy?repositoryName=Sandbox_hadoop&pageSize=1”
> {
> "startIndex": 0,
> "pageSize": 1,
> "totalCount": 1,
> "resultSize": 1,
> "queryTimeMS": 1465234853741,
> "vXPolicies": [
> {
> "id": 5,
> "createDate": "2016-03-14T14:45:45Z",
> "updateDate": "2016-03-14T14:45:46Z",
> "owner": "ranger_admin",
> "updatedBy": "ranger_admin",
> "policyName": "Sandbox_hadoop-1-20160314144545",
> "resourceName": "/*",
> "description": "Default Policy for Service: Sandbox_hadoop",
> "repositoryName": "Sandbox_hadoop",
> "repositoryType": "hdfs",
> "permMapList": [
> { "userList": [ "ambari-qa" ], "groupList": [], "permList": [ "Read",
> "Write", "Execute", "Admin" ] }
> ],
> "isEnabled": true,
> "isRecursive": true,
> "isAuditEnabled": true,
> "version": "2",
> "replacePerm": false
> }
> ]
> }
> And this shows with default page size, all results are returned:
> All the HDFS policies (I believe default pageSize is 200):
> curl -u admin:admin -p -k -X GET
> "http://localhost:6080/service/public/api/policy?repositoryName=Sandbox_hadoop”
> {
> "startIndex": 0,
> "pageSize": 2,
> "totalCount": 2,
> "resultSize": 2,
> "queryTimeMS": 1465234768768,
> "vXPolicies": [
> {
> "id": 5,
> "createDate": "2016-03-14T14:45:45Z",
> "updateDate": "2016-03-14T14:45:46Z",
> "owner": "ranger_admin",
> "updatedBy": "ranger_admin",
> "policyName": "Sandbox_hadoop-1-20160314144545",
> "resourceName": "/*",
> "description": "Default Policy for Service: Sandbox_hadoop",
> "repositoryName": "Sandbox_hadoop",
> "repositoryType": "hdfs",
> "permMapList": [
> { "userList": [ "ambari-qa" ], "groupList": [], "permList": [ "Read",
> "Write", "Execute", "Admin" ] }
> ],
> "isEnabled": true,
> "isRecursive": true,
> "isAuditEnabled": true,
> "version": "2",
> "replacePerm": false
> },
> {
> "id": 7,
> "createDate": "2016-03-14T14:49:35Z",
> "updateDate": "2016-06-06T16:14:52Z",
> "owner": "Admin",
> "updatedBy": "Admin",
> "policyName": "HDFS Global Allow",
> "resourceName": "/,/*,test",
> "description": "This policy gives global permission for all users. Disable
> this to test Apache Ranger",
> "repositoryName": "Sandbox_hadoop",
> "repositoryType": "hdfs",
> "permMapList": [
> { "userList": [], "groupList": [ "public" ], "permList": [ "Read", "Write",
> "Execute", "Admin" ] }
> ],
> "isEnabled": true,
> "isRecursive": true,
> "isAuditEnabled": true,
> "version": "7",
> "replacePerm": false
> }
> ]
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)