Repository: incubator-ranger Updated Branches: refs/heads/stack ff4a817e5 -> 188b7b62c
RANGER-203: addming missed file in earlier commit SearchFilter.java file. Indentation updates in servicedef*.json files. Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/188b7b62 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/188b7b62 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/188b7b62 Branch: refs/heads/stack Commit: 188b7b62cbbec5f84201efd7fdd814d87c17f728 Parents: ff4a817 Author: Madhan Neethiraj <[email protected]> Authored: Fri Jan 30 08:55:07 2015 -0800 Committer: Madhan Neethiraj <[email protected]> Committed: Fri Jan 30 08:55:07 2015 -0800 ---------------------------------------------------------------------- .../apache/ranger/plugin/util/SearchFilter.java | 89 ++++++++++++++++++++ .../service-defs/ranger-servicedef-hbase.json | 36 ++++---- .../service-defs/ranger-servicedef-hdfs.json | 58 ++++++------- .../service-defs/ranger-servicedef-hive.json | 22 ++--- .../service-defs/ranger-servicedef-knox.json | 6 +- .../service-defs/ranger-servicedef-storm.json | 6 +- 6 files changed, 153 insertions(+), 64 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/188b7b62/plugin-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java ---------------------------------------------------------------------- diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java b/plugin-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java new file mode 100644 index 0000000..2bff57c --- /dev/null +++ b/plugin-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java @@ -0,0 +1,89 @@ +/* + * 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. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.ranger.plugin.util; + +import java.util.HashMap; +import java.util.Map; + + +public class SearchFilter { + public static final String LOGIN_USER = "loginUser"; + public static final String SERVICE_TYPE = "serviceType"; + public static final String SERVICE_NAME = "serviceName"; + public static final String SERVICE_ID = "serviceId"; + public static final String POLICY_NAME = "policyName"; + public static final String RESOURCE_PREFIX = "resource:"; + public static final String STATUS = "status"; + public static final String USER_NAME = "userName"; + public static final String GROUP_NAME = "groupName"; + public static final String START_INDEX = "startIndex"; + public static final String PAGE_SIZE = "pageSize"; + public static final String SORT_BY = "sortBy"; + + private Map<String, String> params = null; + + public SearchFilter() { + this(null); + } + + public SearchFilter(Map<String, String> values) { + setParams(values); + } + + public Map<String, String> getParams() { + return params; + } + + public void setParams(Map<String, String> params) { + this.params = params; + } + + public String getParam(String name) { + return params == null ? null : params.get(name); + } + + public void setParam(String name, String value) { + if(params == null) { + params = new HashMap<String, String>(); + } + + params.put(name, value); + } + + public Map<String, String> getParamsWithPrefix(String prefix) { + Map<String, String> ret = null; + + if(params != null) { + for(Map.Entry<String, String> e : params.entrySet()) { + String name = e.getKey(); + + if(name.startsWith(prefix)) { + if(ret == null) { + ret = new HashMap<String, String>(); + } + + ret.put(name, e.getValue()); + } + } + } + + return ret; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/188b7b62/plugin-common/src/main/resources/service-defs/ranger-servicedef-hbase.json ---------------------------------------------------------------------- diff --git a/plugin-common/src/main/resources/service-defs/ranger-servicedef-hbase.json b/plugin-common/src/main/resources/service-defs/ranger-servicedef-hbase.json index 9c79c01..e04ee15 100644 --- a/plugin-common/src/main/resources/service-defs/ranger-servicedef-hbase.json +++ b/plugin-common/src/main/resources/service-defs/ranger-servicedef-hbase.json @@ -11,25 +11,25 @@ "enums": [ { - "name":"authnType", - "elements": - [ - {"name":"simple", "label":"Simple"}, - {"name":"kerberos","label":"Kerberos"} - ], - "defaultIndex":0 - } + "name":"authnType", + "elements": + [ + {"name":"simple", "label":"Simple"}, + {"name":"kerberos","label":"Kerberos"} + ], + "defaultIndex":0 + } ], "configs": [ {"name":"username", "type":"string", "subType":"", "mandatory":true, "label":"Username"}, - {"name":"password", "type":"password","subType":"", "mandatory":true, "label":"Password"}, - {"name":"hadoop.security.authentication", "type":"enum", "subType":"authnType","mandatory":true, "defaultValue":"simple"}, - {"name":"hbase.master.kerberos.principal", "type":"string", "subType":"", "mandatory":false,"defaultValue":""}, - {"name":"hbase.security.authentication", "type":"enum", "subType":"authnType","mandatory":true, "defaultValue":"simple"}, - {"name":"hbase.zookeeper.property.clientPort","type":"int", "subType":"", "mandatory":true, "defaultValue":"2181"}, - {"name":"hbase.zookeeper.quorum", "type":"string", "subType":"", "mandatory":true, "defaultValue":""}, - {"name":"zookeeper.znode.parent", "type":"string", "subType":"", "mandatory":true, "defaultValue":"/hbase"} + {"name":"password", "type":"password","subType":"", "mandatory":true, "label":"Password"}, + {"name":"hadoop.security.authentication", "type":"enum", "subType":"authnType","mandatory":true, "defaultValue":"simple"}, + {"name":"hbase.master.kerberos.principal", "type":"string", "subType":"", "mandatory":false,"defaultValue":""}, + {"name":"hbase.security.authentication", "type":"enum", "subType":"authnType","mandatory":true, "defaultValue":"simple"}, + {"name":"hbase.zookeeper.property.clientPort","type":"int", "subType":"", "mandatory":true, "defaultValue":"2181"}, + {"name":"hbase.zookeeper.quorum", "type":"string", "subType":"", "mandatory":true, "defaultValue":""}, + {"name":"zookeeper.znode.parent", "type":"string", "subType":"", "mandatory":true, "defaultValue":"/hbase"} ], "resources": [ @@ -40,9 +40,9 @@ "accessTypes": [ {"name":"read", "label":"Read"}, - {"name":"write", "label":"Write"}, - {"name":"create","label":"Create"}, - {"name":"admin", "label":"Admin","impliedGrants":["read","write","create"]} + {"name":"write", "label":"Write"}, + {"name":"create","label":"Create"}, + {"name":"admin", "label":"Admin","impliedGrants":["read","write","create"]} ], "policyConditions": [ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/188b7b62/plugin-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json ---------------------------------------------------------------------- diff --git a/plugin-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json b/plugin-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json index ee56f12..cf8f008 100644 --- a/plugin-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json +++ b/plugin-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json @@ -11,38 +11,38 @@ "enums": [ { - "name":"authnType", - "elements": - [ - {"name":"simple", "label":"Simple"}, - {"name":"kerberos","label":"Kerberos"} - ], - "defaultIndex":0 - }, + "name":"authnType", + "elements": + [ + {"name":"simple", "label":"Simple"}, + {"name":"kerberos","label":"Kerberos"} + ], + "defaultIndex":0 + }, { - "name":"rpcProtection", - "elements": - [ - {"name":"authentication","label":"Authentication"}, - {"name":"integrity", "label":"Integrity"}, - {"name":"privacy", "label":"Privacy"} - ], - "defaultIndex":0 - }, + "name":"rpcProtection", + "elements": + [ + {"name":"authentication","label":"Authentication"}, + {"name":"integrity", "label":"Integrity"}, + {"name":"privacy", "label":"Privacy"} + ], + "defaultIndex":0 + }, ], "configs": [ {"name":"username", "type":"string", "subType":"", "mandatory":true, "label":"Username"}, - {"name":"password", "type":"password","subType":"", "mandatory":true, "label":"Password"}, - {"name":"fs.default.name", "type":"string", "subType":"", "mandatory":true, "label":"Namenode URL"}, - {"name":"hadoop.security.authorization", "type":"bool", "subType":"TrueFalse", "mandatory":true, "defaultValue":"false"}, - {"name":"hadoop.security.authentication", "type":"enum", "subType":"authnType", "mandatory":true, "defaultValue":"simple"}, - {"name":"hadoop.security.auth_to_local", "type":"string", "subType":"", "mandatory":false}, - {"name":"dfs.datanode.kerberos.principal", "type":"string", "subType":"", "mandatory":false}, - {"name":"dfs.namenode.kerberos.principal", "type":"string", "subType":"", "mandatory":false}, - {"name":"dfs.secondary.namenode.kerberos.principal","type":"string", "subType":"", "mandatory":false}, - {"name":"hadoop.rpc.protection", "type":"enum", "subType":"rpcProtection","mandatory":false,"defaultValue":"authentication"}, - {"name":"certificate.cn", "type":"string", "subType":"", "mandatory":false,"label":"Common Name for Certificate"} + {"name":"password", "type":"password","subType":"", "mandatory":true, "label":"Password"}, + {"name":"fs.default.name", "type":"string", "subType":"", "mandatory":true, "label":"Namenode URL"}, + {"name":"hadoop.security.authorization", "type":"bool", "subType":"TrueFalse", "mandatory":true, "defaultValue":"false"}, + {"name":"hadoop.security.authentication", "type":"enum", "subType":"authnType", "mandatory":true, "defaultValue":"simple"}, + {"name":"hadoop.security.auth_to_local", "type":"string", "subType":"", "mandatory":false}, + {"name":"dfs.datanode.kerberos.principal", "type":"string", "subType":"", "mandatory":false}, + {"name":"dfs.namenode.kerberos.principal", "type":"string", "subType":"", "mandatory":false}, + {"name":"dfs.secondary.namenode.kerberos.principal","type":"string", "subType":"", "mandatory":false}, + {"name":"hadoop.rpc.protection", "type":"enum", "subType":"rpcProtection","mandatory":false,"defaultValue":"authentication"}, + {"name":"certificate.cn", "type":"string", "subType":"", "mandatory":false,"label":"Common Name for Certificate"} ], "resources": [ @@ -51,8 +51,8 @@ "accessTypes": [ {"name":"read","label":"Read"}, - {"name":"write","label":"Write"}, - {"name":"execute","label":"Execute"} + {"name":"write","label":"Write"}, + {"name":"execute","label":"Execute"} ], "policyConditions": [ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/188b7b62/plugin-common/src/main/resources/service-defs/ranger-servicedef-hive.json ---------------------------------------------------------------------- diff --git a/plugin-common/src/main/resources/service-defs/ranger-servicedef-hive.json b/plugin-common/src/main/resources/service-defs/ranger-servicedef-hive.json index e07caae..6414fe3 100644 --- a/plugin-common/src/main/resources/service-defs/ranger-servicedef-hive.json +++ b/plugin-common/src/main/resources/service-defs/ranger-servicedef-hive.json @@ -14,10 +14,10 @@ "configs": [ {"name":"username", "type":"string", "mandatory":true, "label":"Username"}, - {"name":"password", "type":"password","mandatory":true, "label":"Password"}, - {"name":"jdbc.driverClassName","type":"string", "mandatory":true, "defaultValue":"org.apache.hive.jdbc.HiveDriver"}, - {"name":"jdbc.url", "type":"string", "mandatory":true, "defaultValue":""}, - {"name":"certificate.cn", "type":"string", "mandatory":false,"label":"Common Name for Certificate"} + {"name":"password", "type":"password","mandatory":true, "label":"Password"}, + {"name":"jdbc.driverClassName","type":"string", "mandatory":true, "defaultValue":"org.apache.hive.jdbc.HiveDriver"}, + {"name":"jdbc.url", "type":"string", "mandatory":true, "defaultValue":""}, + {"name":"certificate.cn", "type":"string", "mandatory":false,"label":"Common Name for Certificate"} ], "resources": [ @@ -29,13 +29,13 @@ "accessTypes": [ {"name":"select","label":"select"}, - {"name":"update","label":"update"}, - {"name":"create","label":"Create"}, - {"name":"drop", "label":"Drop"}, - {"name":"alter", "label":"Alter"}, - {"name":"index", "label":"Index"}, - {"name":"lock", "label":"Lock"}, - {"name":"all", "label":"All"} + {"name":"update","label":"update"}, + {"name":"create","label":"Create"}, + {"name":"drop", "label":"Drop"}, + {"name":"alter", "label":"Alter"}, + {"name":"index", "label":"Index"}, + {"name":"lock", "label":"Lock"}, + {"name":"all", "label":"All"} ], "policyConditions": [ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/188b7b62/plugin-common/src/main/resources/service-defs/ranger-servicedef-knox.json ---------------------------------------------------------------------- diff --git a/plugin-common/src/main/resources/service-defs/ranger-servicedef-knox.json b/plugin-common/src/main/resources/service-defs/ranger-servicedef-knox.json index 9e775ec..f6a7157 100644 --- a/plugin-common/src/main/resources/service-defs/ranger-servicedef-knox.json +++ b/plugin-common/src/main/resources/service-defs/ranger-servicedef-knox.json @@ -14,9 +14,9 @@ "configs": [ {"name":"username", "type":"string", "mandatory":true, "label":"Username"}, - {"name":"password", "type":"password","mandatory":true, "label":"Password"}, - {"name":"knox.url", "type":"string", "mandatory":true, "defaultValue":""}, - {"name":"certificate.cn","type":"string", "mandatory":false,"label":"Common Name for Certificate"} + {"name":"password", "type":"password","mandatory":true, "label":"Password"}, + {"name":"knox.url", "type":"string", "mandatory":true, "defaultValue":""}, + {"name":"certificate.cn","type":"string", "mandatory":false,"label":"Common Name for Certificate"} ], "resources": [ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/188b7b62/plugin-common/src/main/resources/service-defs/ranger-servicedef-storm.json ---------------------------------------------------------------------- diff --git a/plugin-common/src/main/resources/service-defs/ranger-servicedef-storm.json b/plugin-common/src/main/resources/service-defs/ranger-servicedef-storm.json index 9570eb3..fce10c0 100644 --- a/plugin-common/src/main/resources/service-defs/ranger-servicedef-storm.json +++ b/plugin-common/src/main/resources/service-defs/ranger-servicedef-storm.json @@ -14,9 +14,9 @@ "configs": [ {"name":"username", "type":"string", "mandatory":true, "label":"Username"}, - {"name":"password", "type":"password","mandatory":true, "label":"Password"}, - {"name":"nimbus.url", "type":"string", "mandatory":true, "label":"Nimbus URL","defaultValue":""}, - {"name":"certificate.cn","type":"string", "mandatory":false,"label":"Common Name for Certificate"} + {"name":"password", "type":"password","mandatory":true, "label":"Password"}, + {"name":"nimbus.url", "type":"string", "mandatory":true, "label":"Nimbus URL","defaultValue":""}, + {"name":"certificate.cn","type":"string", "mandatory":false,"label":"Common Name for Certificate"} ], "resources": [
