Repository: ranger
Updated Branches:
  refs/heads/master 091ad6f95 -> 122172a0b


RANGER-2059 : Write unit tests for export/import functionality

Signed-off-by: Mehul Parikh <me...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/122172a0
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/122172a0
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/122172a0

Branch: refs/heads/master
Commit: 122172a0baa4c899a145e119038243da1370788d
Parents: 091ad6f
Author: Bhavik Patel <bhavikpatel...@gmail.com>
Authored: Thu Apr 5 15:37:56 2018 +0530
Committer: Mehul Parikh <me...@apache.org>
Committed: Fri Apr 6 16:44:24 2018 +0530

----------------------------------------------------------------------
 pom.xml                                         |   1 +
 .../org/apache/ranger/rest/TestServiceREST.java | 245 +++++++++++
 .../importPolicy/import_policy_test_file.json   | 426 +++++++++++++++++++
 3 files changed, 672 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/122172a0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a3ef325..bf363f8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -601,6 +601,7 @@
                         <exclude>**/*.jaas</exclude>
                         <exclude>**/target/apidocs/**</exclude>
                         <exclude>**/target/kms/apidocs/**</exclude>
+                        <exclude>**/importPolicy/*.json</exclude>
                     </excludes>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/ranger/blob/122172a0/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java 
b/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java
index fec5912..b1417d7 100644
--- a/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java
+++ b/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java
@@ -1,4 +1,5 @@
 /*
+
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -16,17 +17,25 @@
  */
 package org.apache.ranger.rest;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.WebApplicationException;
 
+
+
+
 import org.apache.commons.lang.StringUtils;
 import org.apache.ranger.admin.client.datatype.RESTResponse;
 import org.apache.ranger.biz.AssetMgr;
@@ -77,6 +86,7 @@ import org.apache.ranger.service.RangerPolicyService;
 import org.apache.ranger.service.RangerServiceDefService;
 import org.apache.ranger.service.RangerServiceService;
 import org.apache.ranger.service.XUserService;
+import org.apache.ranger.view.RangerExportPolicyList;
 import org.apache.ranger.view.RangerPolicyList;
 import org.apache.ranger.view.RangerServiceDefList;
 import org.apache.ranger.view.RangerServiceList;
@@ -94,6 +104,7 @@ import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.junit.MockitoJUnitRunner;
+import com.sun.jersey.core.header.FormDataContentDisposition;
 
 @RunWith(MockitoJUnitRunner.class)
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -101,6 +112,8 @@ public class TestServiceREST {
 
        private static Long Id = 8L;
 
+        String importPoliceTestFilePath = 
"./src/test/java/org/apache/ranger/rest/importPolicy/import_policy_test_file.json";
+
        @InjectMocks
        ServiceREST serviceREST = new ServiceREST();
 
@@ -122,6 +135,9 @@ public class TestServiceREST {
        @Mock
        RangerDataHistService dataHistService;
 
+        @Mock
+        RangerExportPolicyList rangerExportPolicyList;
+
        @Mock
        RangerServiceDefService serviceDefService;
 
@@ -1422,4 +1438,233 @@ public class TestServiceREST {
                Mockito.verify(searchUtil).getSearchFilter(request,
                                policyLabelsService.sortFields);
        }
+
+        @Test
+        public void test45exportPoliciesInJSON() throws Exception {
+                HttpServletRequest request = 
Mockito.mock(HttpServletRequest.class);
+
+                List<RangerPolicy> rangerPolicyList = new 
ArrayList<RangerPolicy>();
+
+                RangerPolicy rangerPolicy = rangerPolicy();
+                rangerPolicyList.add(rangerPolicy);
+                XXService xService = xService();
+
+                XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class);
+                XXServiceDef xServiceDef = serviceDef();
+                XXServiceDefDao xServiceDefDao = 
Mockito.mock(XXServiceDefDao.class);
+
+                request.setAttribute("serviceType", 
"hdfs,hbase,hive,yarn,knox,storm,solr,kafka,nifi,atlas,sqoop");
+                HttpServletResponse response = 
Mockito.mock(HttpServletResponse.class);
+                SearchFilter filter = new SearchFilter();
+
+                Mockito.when(searchUtil.getSearchFilter(request, 
policyService.sortFields)).thenReturn(filter);
+                
Mockito.when(svcStore.getPolicies(filter)).thenReturn(rangerPolicyList);
+                Mockito.when(bizUtil.isAdmin()).thenReturn(true);
+                Mockito.when(bizUtil.isKeyAdmin()).thenReturn(false);
+                
Mockito.when(bizUtil.getCurrentUserLoginId()).thenReturn("admin");
+                Mockito.when(bizUtil.isAuditAdmin()).thenReturn(false);
+                Mockito.when(bizUtil.isAuditKeyAdmin()).thenReturn(false);
+                
Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
+
+                
Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
+
+
+                
Mockito.when(daoManager.getXXService().findByName("HDFS_1-1-20150316062453")).thenReturn(xService);
+                
Mockito.when(daoManager.getXXServiceDef().getById(xService.getType())).thenReturn(xServiceDef);
+                serviceREST.getPoliciesInJson(request, response, false);
+
+                Mockito.verify(svcStore).getPoliciesInJson(rangerPolicyList, 
response);
+        }
+
+        @Test
+        public void test46exportPoliciesInCSV() throws Exception {
+                HttpServletRequest request = 
Mockito.mock(HttpServletRequest.class);
+
+                List<RangerPolicy> rangerPolicyList = new 
ArrayList<RangerPolicy>();
+
+                RangerPolicy rangerPolicy = rangerPolicy();
+                rangerPolicyList.add(rangerPolicy);
+                XXService xService = xService();
+
+                XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class);
+                XXServiceDef xServiceDef = serviceDef();
+                XXServiceDefDao xServiceDefDao = 
Mockito.mock(XXServiceDefDao.class);
+
+                request.setAttribute("serviceType", 
"hdfs,hbase,hive,yarn,knox,storm,solr,kafka,nifi,atlas,sqoop");
+                HttpServletResponse response = 
Mockito.mock(HttpServletResponse.class);
+                SearchFilter filter = new SearchFilter();
+
+                Mockito.when(searchUtil.getSearchFilter(request, 
policyService.sortFields)).thenReturn(filter);
+                
Mockito.when(svcStore.getPolicies(filter)).thenReturn(rangerPolicyList);
+                Mockito.when(bizUtil.isAdmin()).thenReturn(true);
+                Mockito.when(bizUtil.isKeyAdmin()).thenReturn(false);
+                
Mockito.when(bizUtil.getCurrentUserLoginId()).thenReturn("admin");
+                Mockito.when(bizUtil.isAuditAdmin()).thenReturn(false);
+                Mockito.when(bizUtil.isAuditKeyAdmin()).thenReturn(false);
+                
Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
+
+                
Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
+
+
+                
Mockito.when(daoManager.getXXService().findByName("HDFS_1-1-20150316062453")).thenReturn(xService);
+                
Mockito.when(daoManager.getXXServiceDef().getById(xService.getType())).thenReturn(xServiceDef);
+                serviceREST.getPoliciesInCsv(request, response);
+
+                Mockito.verify(svcStore).getPoliciesInCSV(rangerPolicyList, 
response);
+        }
+
+        @Test
+        public void test47WhenPolicyListIsEmpty() throws Exception {
+                HttpServletRequest request = 
Mockito.mock(HttpServletRequest.class);
+
+                List<RangerPolicy> rangerPolicyList = new 
ArrayList<RangerPolicy>();
+                request.setAttribute("serviceType", 
"hdfs,hbase,hive,yarn,knox,storm,solr,kafka,nifi,atlas,sqoop");
+                HttpServletResponse response = 
Mockito.mock(HttpServletResponse.class);
+                SearchFilter filter = new SearchFilter();
+
+                Mockito.when(searchUtil.getSearchFilter(request, 
policyService.sortFields)).thenReturn(filter);
+                
Mockito.when(svcStore.getPolicies(filter)).thenReturn(rangerPolicyList);
+
+                Mockito.when(response.getStatus()).thenReturn(204);
+                serviceREST.getPoliciesInCsv(request, response);
+
+                Assert.assertEquals(HttpServletResponse.SC_NO_CONTENT, 
response.getStatus());
+                }
+
+        @Test
+        public void test48exportPoliciesInExcel() throws Exception {
+                HttpServletRequest request = 
Mockito.mock(HttpServletRequest.class);
+
+                List<RangerPolicy> rangerPolicyList = new 
ArrayList<RangerPolicy>();
+
+                RangerPolicy rangerPolicy = rangerPolicy();
+                rangerPolicyList.add(rangerPolicy);
+                XXService xService = xService();
+
+                XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class);
+                XXServiceDef xServiceDef = serviceDef();
+                XXServiceDefDao xServiceDefDao = 
Mockito.mock(XXServiceDefDao.class);
+
+                request.setAttribute("serviceType", 
"hdfs,hbase,hive,yarn,knox,storm,solr,kafka,nifi,atlas,sqoop");
+                HttpServletResponse response = 
Mockito.mock(HttpServletResponse.class);
+                SearchFilter filter = new SearchFilter();
+
+                Mockito.when(searchUtil.getSearchFilter(request, 
policyService.sortFields)).thenReturn(filter);
+                
Mockito.when(svcStore.getPolicies(filter)).thenReturn(rangerPolicyList);
+                Mockito.when(bizUtil.isAdmin()).thenReturn(true);
+                Mockito.when(bizUtil.isKeyAdmin()).thenReturn(false);
+                
Mockito.when(bizUtil.getCurrentUserLoginId()).thenReturn("admin");
+                Mockito.when(bizUtil.isAuditAdmin()).thenReturn(false);
+                Mockito.when(bizUtil.isAuditKeyAdmin()).thenReturn(false);
+                
Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
+
+                
Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
+
+
+                
Mockito.when(daoManager.getXXService().findByName("HDFS_1-1-20150316062453")).thenReturn(xService);
+                
Mockito.when(daoManager.getXXServiceDef().getById(xService.getType())).thenReturn(xServiceDef);
+                serviceREST.getPoliciesInExcel(request, response);
+                Mockito.verify(svcStore).getPoliciesInExcel(rangerPolicyList, 
response);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Test
+        public void test49importPoliciesFromFileAllowingOverride() throws 
Exception{
+                HttpServletRequest request = 
Mockito.mock(HttpServletRequest.class);
+
+                Map<String, RangerPolicy> policiesMap = new 
LinkedHashMap<String, RangerPolicy>();
+
+                RangerPolicy rangerPolicy = rangerPolicy();
+
+                XXService xService = xService();
+                policiesMap.put("Name", rangerPolicy);
+                XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class);
+                XXServiceDef xServiceDef = serviceDef();
+                XXServiceDefDao xServiceDefDao = 
Mockito.mock(XXServiceDefDao.class);
+
+                String PARAM_SERVICE_TYPE = "serviceType";
+                String serviceTypeList = 
"hdfs,hbase,hive,yarn,knox,storm,solr,kafka,nifi,atlas,sqoop";
+                request.setAttribute("serviceType", 
"hdfs,hbase,hive,yarn,knox,storm,solr,kafka,nifi,atlas,sqoop");
+                SearchFilter filter = new SearchFilter();
+                filter.setParam("serviceType", "value");
+                Mockito.when(
+                                searchUtil.getSearchFilter(request, 
policyService.sortFields))
+                                .thenReturn(filter);
+
+                
Mockito.when(request.getParameter(PARAM_SERVICE_TYPE)).thenReturn(serviceTypeList);
+                File jsonPolicyFile = new File(importPoliceTestFilePath);
+                InputStream uploadedInputStream = new 
FileInputStream(jsonPolicyFile);
+                FormDataContentDisposition fileDetail = 
FormDataContentDisposition
+                                                                               
                 .name("file")
+                                                                               
                 .fileName(jsonPolicyFile.getName())
+                                                                               
                 .size(uploadedInputStream.toString().length())
+                                                                               
                 .build();
+                boolean isOverride = true;
+
+                Mockito.when(svcStore.createPolicyMap(Mockito.any(Map.class), 
Mockito.any(List.class), Mockito.any(List.class), 
Mockito.any(RangerPolicy.class), 
Mockito.any(Map.class))).thenReturn(policiesMap);
+                
Mockito.when(validatorFactory.getPolicyValidator(svcStore)).thenReturn(policyValidator);
+                Mockito.when(bizUtil.isAdmin()).thenReturn(true);
+                
Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
+
+                
Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
+
+                
Mockito.when(daoManager.getXXService().findByName("HDFS_1-1-20150316062453")).thenReturn(xService);
+                
Mockito.when(daoManager.getXXServiceDef().getById(xService.getType())).thenReturn(xServiceDef);
+
+                serviceREST.importPoliciesFromFile(request, null, 
uploadedInputStream, fileDetail, isOverride);
+                Mockito.verify(svcStore).createPolicy(rangerPolicy);
+
+
+        }
+
+
+        @SuppressWarnings("unchecked")
+        @Test
+        public void test50importPoliciesFromFileNotAllowingOverride() throws 
Exception{
+                HttpServletRequest request = 
Mockito.mock(HttpServletRequest.class);
+
+                Map<String, RangerPolicy> policiesMap = new 
LinkedHashMap<String, RangerPolicy>();
+
+                RangerPolicy rangerPolicy = rangerPolicy();
+
+                XXService xService = xService();
+                policiesMap.put("Name", rangerPolicy);
+                XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class);
+                XXServiceDef xServiceDef = serviceDef();
+                XXServiceDefDao xServiceDefDao = 
Mockito.mock(XXServiceDefDao.class);
+
+                String PARAM_SERVICE_TYPE = "serviceType";
+                String serviceTypeList = 
"hdfs,hbase,hive,yarn,knox,storm,solr,kafka,nifi,atlas,sqoop";
+                request.setAttribute("serviceType", 
"hdfs,hbase,hive,yarn,knox,storm,solr,kafka,nifi,atlas,sqoop");
+                SearchFilter filter = new SearchFilter();
+                filter.setParam("serviceType", "value");
+                Mockito.when(
+                                searchUtil.getSearchFilter(request, 
policyService.sortFields))
+                                .thenReturn(filter);
+
+                
Mockito.when(request.getParameter(PARAM_SERVICE_TYPE)).thenReturn(serviceTypeList);
+                File jsonPolicyFile = new File(importPoliceTestFilePath);
+                InputStream uploadedInputStream = new 
FileInputStream(jsonPolicyFile);
+                FormDataContentDisposition fileDetail = 
FormDataContentDisposition
+                                                                               
                 .name("file")
+                                                                               
                 .fileName(jsonPolicyFile.getName())
+                                                                               
                 .size(uploadedInputStream.toString().length())
+                                                                               
                 .build();
+                boolean isOverride = false;
+
+                Mockito.when(svcStore.createPolicyMap(Mockito.any(Map.class), 
Mockito.any(List.class), Mockito.any(List.class), 
Mockito.any(RangerPolicy.class), 
Mockito.any(Map.class))).thenReturn(policiesMap);
+                
Mockito.when(validatorFactory.getPolicyValidator(svcStore)).thenReturn(policyValidator);
+                Mockito.when(bizUtil.isAdmin()).thenReturn(true);
+                
Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
+
+                
Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
+
+                
Mockito.when(daoManager.getXXService().findByName("HDFS_1-1-20150316062453")).thenReturn(xService);
+                
Mockito.when(daoManager.getXXServiceDef().getById(xService.getType())).thenReturn(xServiceDef);
+
+                serviceREST.importPoliciesFromFile(request, null, 
uploadedInputStream, fileDetail, isOverride);
+                Mockito.verify(svcStore).createPolicy(rangerPolicy);
+
+
+        }
 }

http://git-wip-us.apache.org/repos/asf/ranger/blob/122172a0/security-admin/src/test/java/org/apache/ranger/rest/importPolicy/import_policy_test_file.json
----------------------------------------------------------------------
diff --git 
a/security-admin/src/test/java/org/apache/ranger/rest/importPolicy/import_policy_test_file.json
 
b/security-admin/src/test/java/org/apache/ranger/rest/importPolicy/import_policy_test_file.json
new file mode 100644
index 0000000..70ebe06
--- /dev/null
+++ 
b/security-admin/src/test/java/org/apache/ranger/rest/importPolicy/import_policy_test_file.json
@@ -0,0 +1,426 @@
+{
+  "metaDataInfo": {
+    "Host name": "dhaval-Vostro-15-3568",
+    "Exported by": "admin",
+    "Export time": "Mar 21, 2018 6:36:51 AM",
+    "Ranger apache version": "0.7.0.2.6.5.0-SNAPSHOT"
+  },
+  "policies": [
+    {
+      "service": "Atlas_service_new_test",
+      "name": "all - type-category, type",
+      "policyType": 0,
+      "policyPriority": 0,
+      "description": "Policy for all - type-category, type",
+      "isAuditEnabled": true,
+      "resources": {
+        "type-category": {
+          "values": [
+            "*"
+          ],
+          "isExcludes": false,
+          "isRecursive": false
+        },
+        "type": {
+          "values": [
+            "*"
+          ],
+          "isExcludes": false,
+          "isRecursive": false
+        }
+      },
+      "policyItems": [
+        {
+          "accesses": [
+            {
+              "type": "type-create",
+              "isAllowed": true
+            },
+            {
+              "type": "type-update",
+              "isAllowed": true
+            },
+            {
+              "type": "type-delete",
+              "isAllowed": true
+            }
+          ],
+          "users": [
+            "dhaval",
+            "admin"
+          ],
+          "groups": [],
+          "conditions": [],
+          "delegateAdmin": true
+        }
+      ],
+      "denyPolicyItems": [],
+      "allowExceptions": [],
+      "denyExceptions": [],
+      "dataMaskPolicyItems": [],
+      "rowFilterPolicyItems": [],
+      "options": {},
+      "validitySchedules": [],
+      "policyLabels": [],
+      "id": 1,
+      "guid": "a27cefc9-9a71-41eb-9847-bc2cf7242ac4",
+      "isEnabled": true,
+      "version": 1
+    },
+    {
+      "service": "Atlas_service_new_test",
+      "name": "all - entity-type, entity-classification, entity",
+      "policyType": 0,
+      "policyPriority": 0,
+      "description": "Policy for all - entity-type, entity-classification, 
entity",
+      "isAuditEnabled": true,
+      "resources": {
+        "entity-type": {
+          "values": [
+            "*"
+          ],
+          "isExcludes": false,
+          "isRecursive": false
+        },
+        "entity-classification": {
+          "values": [
+            "*"
+          ],
+          "isExcludes": false,
+          "isRecursive": false
+        },
+        "entity": {
+          "values": [
+            "*"
+          ],
+          "isExcludes": false,
+          "isRecursive": false
+        }
+      },
+      "policyItems": [
+        {
+          "accesses": [
+            {
+              "type": "entity-read",
+              "isAllowed": true
+            },
+            {
+              "type": "entity-create",
+              "isAllowed": true
+            },
+            {
+              "type": "entity-update",
+              "isAllowed": true
+            },
+            {
+              "type": "entity-delete",
+              "isAllowed": true
+            },
+            {
+              "type": "entity-read-classification",
+              "isAllowed": true
+            },
+            {
+              "type": "entity-add-classification",
+              "isAllowed": true
+            },
+            {
+              "type": "entity-update-classification",
+              "isAllowed": true
+            },
+            {
+              "type": "entity-remove-classification",
+              "isAllowed": true
+            }
+          ],
+          "users": [
+            "dhaval",
+            "admin"
+          ],
+          "groups": [],
+          "conditions": [],
+          "delegateAdmin": true
+        }
+      ],
+      "denyPolicyItems": [],
+      "allowExceptions": [],
+      "denyExceptions": [],
+      "dataMaskPolicyItems": [],
+      "rowFilterPolicyItems": [],
+      "options": {},
+      "validitySchedules": [],
+      "policyLabels": [],
+      "id": 2,
+      "guid": "33ad075c-05d0-453e-bfbf-2173affc09e7",
+      "isEnabled": true,
+      "version": 1
+    },
+    {
+      "service": "Atlas_service_new_test",
+      "name": "all - atlas-service",
+      "policyType": 0,
+      "policyPriority": 0,
+      "description": "Policy for all - atlas-service",
+      "isAuditEnabled": true,
+      "resources": {
+        "atlas-service": {
+          "values": [
+            "*"
+          ],
+          "isExcludes": false,
+          "isRecursive": false
+        }
+      },
+      "policyItems": [
+        {
+          "accesses": [
+            {
+              "type": "admin-export",
+              "isAllowed": true
+            },
+            {
+              "type": "admin-import",
+              "isAllowed": true
+            }
+          ],
+          "users": [
+            "dhaval",
+            "admin"
+          ],
+          "groups": [],
+          "conditions": [],
+          "delegateAdmin": true
+        }
+      ],
+      "denyPolicyItems": [],
+      "allowExceptions": [],
+      "denyExceptions": [],
+      "dataMaskPolicyItems": [],
+      "rowFilterPolicyItems": [],
+      "options": {},
+      "validitySchedules": [],
+      "policyLabels": [],
+      "id": 3,
+      "guid": "941d8bfe-3db0-4006-8fee-d50101e53a0b",
+      "isEnabled": true,
+      "version": 1
+    },
+    {
+      "service": "hdfs service",
+      "name": "all - path",
+      "policyType": 0,
+      "policyPriority": 0,
+      "description": "Policy for all - path",
+      "isAuditEnabled": true,
+      "resources": {
+        "path": {
+          "values": [
+            "/*"
+          ],
+          "isExcludes": false,
+          "isRecursive": true
+        }
+      },
+      "policyItems": [
+        {
+          "accesses": [
+            {
+              "type": "read",
+              "isAllowed": true
+            },
+            {
+              "type": "write",
+              "isAllowed": true
+            },
+            {
+              "type": "execute",
+              "isAllowed": true
+            }
+          ],
+          "users": [
+            "dhaval"
+          ],
+          "groups": [],
+          "conditions": [],
+          "delegateAdmin": true
+        }
+      ],
+      "denyPolicyItems": [],
+      "allowExceptions": [],
+      "denyExceptions": [],
+      "dataMaskPolicyItems": [],
+      "rowFilterPolicyItems": [],
+      "options": {},
+      "validitySchedules": [],
+      "policyLabels": [],
+      "id": 24,
+      "guid": "a25c9fe8-138d-4a70-8985-37bd08b0f5b3",
+      "isEnabled": true,
+      "version": 1
+    },
+    {
+      "service": "hdfs service",
+      "name": "kms-audit-path",
+      "policyType": 0,
+      "policyPriority": 0,
+      "description": "Policy for kms-audit-path",
+      "isAuditEnabled": true,
+      "resources": {
+        "path": {
+          "values": [
+            "/ranger/audit/kms"
+          ],
+          "isExcludes": false,
+          "isRecursive": true
+        }
+      },
+      "policyItems": [
+        {
+          "accesses": [
+            {
+              "type": "read",
+              "isAllowed": true
+            },
+            {
+              "type": "write",
+              "isAllowed": true
+            },
+            {
+              "type": "execute",
+              "isAllowed": true
+            }
+          ],
+          "users": [
+            "keyadmin"
+          ],
+          "groups": [],
+          "conditions": [],
+          "delegateAdmin": false
+        }
+      ],
+      "denyPolicyItems": [],
+      "allowExceptions": [],
+      "denyExceptions": [],
+      "dataMaskPolicyItems": [],
+      "rowFilterPolicyItems": [],
+      "options": {},
+      "validitySchedules": [],
+      "policyLabels": [],
+      "id": 25,
+      "guid": "38974e39-1e53-4e5a-ba31-dd4e3d9137e5",
+      "isEnabled": true,
+      "version": 1
+    },
+    {
+      "service": "hdfs service 2d",
+      "name": "all - path",
+      "policyType": 0,
+      "policyPriority": 0,
+      "description": "Policy for all - path",
+      "isAuditEnabled": true,
+      "resources": {
+        "path": {
+          "values": [
+            "/*"
+          ],
+          "isExcludes": false,
+          "isRecursive": true
+        }
+      },
+      "policyItems": [
+        {
+          "accesses": [
+            {
+              "type": "read",
+              "isAllowed": true
+            },
+            {
+              "type": "write",
+              "isAllowed": true
+            },
+            {
+              "type": "execute",
+              "isAllowed": true
+            }
+          ],
+          "users": [
+            "dhaval"
+          ],
+          "groups": [],
+          "conditions": [],
+          "delegateAdmin": true
+        }
+      ],
+      "denyPolicyItems": [],
+      "allowExceptions": [],
+      "denyExceptions": [],
+      "dataMaskPolicyItems": [],
+      "rowFilterPolicyItems": [],
+      "options": {},
+      "validitySchedules": [],
+      "policyLabels": [],
+      "id": 26,
+      "guid": "235c5b07-83a8-4c68-aeb8-371abb270be8",
+      "isEnabled": true,
+      "version": 1
+    },
+    {
+      "service": "hdfs service 2d",
+      "name": "kms-audit-path",
+      "policyType": 0,
+      "policyPriority": 0,
+      "description": "Policy for kms-audit-path",
+      "isAuditEnabled": true,
+      "resources": {
+        "path": {
+          "values": [
+            "/ranger/audit/kms"
+          ],
+          "isExcludes": false,
+          "isRecursive": true
+        }
+      },
+      "policyItems": [
+        {
+          "accesses": [
+            {
+              "type": "read",
+              "isAllowed": true
+            },
+            {
+              "type": "write",
+              "isAllowed": true
+            },
+            {
+              "type": "execute",
+              "isAllowed": true
+            }
+          ],
+          "users": [
+            "keyadmin"
+          ],
+          "groups": [],
+          "conditions": [],
+          "delegateAdmin": false
+        }
+      ],
+      "denyPolicyItems": [],
+      "allowExceptions": [],
+      "denyExceptions": [],
+      "dataMaskPolicyItems": [],
+      "rowFilterPolicyItems": [],
+      "options": {},
+      "validitySchedules": [],
+      "policyLabels": [],
+      "id": 27,
+      "guid": "b9990454-ec19-4743-887b-b1b4672c1cc8",
+      "isEnabled": true,
+      "version": 1
+    }
+  ],
+  "startIndex": 0,
+  "pageSize": 0,
+  "totalCount": 0,
+  "resultSize": 0,
+  "queryTimeMS": 1521614211412
+}

Reply via email to