RANGER-470: Renamed attribute 'id' in service-def inner classes to 'itemId' - to avoid confusion with DB object id
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/8cedfa55 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/8cedfa55 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/8cedfa55 Branch: refs/heads/master Commit: 8cedfa55cbdb73b8a3be59d287a6ce02c43cc1ca Parents: f01ac18 Author: Madhan Neethiraj <[email protected]> Authored: Tue May 12 03:04:37 2015 -0700 Committer: Madhan Neethiraj <[email protected]> Committed: Tue May 12 10:27:59 2015 -0700 ---------------------------------------------------------------------- .../ranger/plugin/model/RangerServiceDef.java | 184 +++++++++---------- .../validation/RangerServiceDefValidator.java | 12 +- .../service-defs/ranger-servicedef-hbase.json | 38 ++-- .../service-defs/ranger-servicedef-hdfs.json | 44 ++--- .../service-defs/ranger-servicedef-hive.json | 34 ++-- .../service-defs/ranger-servicedef-kafka.json | 28 +-- .../service-defs/ranger-servicedef-kms.json | 26 +-- .../service-defs/ranger-servicedef-knox.json | 16 +- .../service-defs/ranger-servicedef-solr.json | 22 +-- .../service-defs/ranger-servicedef-storm.json | 38 ++-- .../service-defs/ranger-servicedef-yarn.json | 16 +- .../TestRangerServiceDefValidator.java | 18 +- .../model/validation/ValidationTestUtils.java | 18 +- .../db/mysql/patches/009-updated_schema.sql | 7 + .../db/oracle/patches/009-updated_schema.sql | 7 + .../db/postgres/xa_core_db_postgres.sql | 9 +- .../db/sqlserver/xa_core_db_sqlserver.sql | 9 +- .../org/apache/ranger/biz/ServiceDBStore.java | 28 +-- .../apache/ranger/entity/XXAccessTypeDef.java | 38 +++- .../ranger/entity/XXContextEnricherDef.java | 38 +++- .../org/apache/ranger/entity/XXEnumDef.java | 38 +++- .../apache/ranger/entity/XXEnumElementDef.java | 31 +++- .../ranger/entity/XXPolicyConditionDef.java | 38 +++- .../org/apache/ranger/entity/XXResourceDef.java | 38 +++- .../ranger/entity/XXServiceConfigDef.java | 37 ++++ .../service/RangerServiceDefServiceBase.java | 55 ++---- 26 files changed, 560 insertions(+), 307 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java ---------------------------------------------------------------------- diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java index cd634b8..302da2f 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java @@ -447,7 +447,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public static class RangerEnumDef implements java.io.Serializable { private static final long serialVersionUID = 1L; - private Long id = null; + private Long itemId = null; private String name = null; private List<RangerEnumElementDef> elements = null; private Integer defaultIndex = null; @@ -457,25 +457,25 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S this(null, null, null, null); } - public RangerEnumDef(Long id, String name, List<RangerEnumElementDef> elements, Integer defaultIndex) { - setId(id); + public RangerEnumDef(Long itemId, String name, List<RangerEnumElementDef> elements, Integer defaultIndex) { + setItemId(itemId); setName(name); setElements(elements); setDefaultIndex(defaultIndex); } /** - * @return the id + * @return the itemId */ - public Long getId() { - return id; + public Long getItemId() { + return itemId; } /** - * @param id the id to set + * @param itemId the itemId to set */ - public void setId(Long id) { - this.id = id; + public void setItemId(Long itemId) { + this.itemId = itemId; } /** @@ -545,7 +545,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public StringBuilder toString(StringBuilder sb) { sb.append("RangerEnumDef={"); - sb.append("id={").append(id).append("} "); + sb.append("itemId={").append(itemId).append("} "); sb.append("name={").append(name).append("} "); sb.append("elements={"); if(elements != null) { @@ -566,7 +566,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((itemId == null) ? 0 : itemId.hashCode()); result = prime * result + ((defaultIndex == null) ? 0 : defaultIndex.hashCode()); result = prime * result @@ -584,10 +584,10 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S if (getClass() != obj.getClass()) return false; RangerEnumDef other = (RangerEnumDef) obj; - if (id == null) { - if (other.id != null) + if (itemId == null) { + if (other.itemId != null) return false; - } else if (other.id == null || !id.equals(other.id)) + } else if (other.itemId == null || !itemId.equals(other.itemId)) return false; if (defaultIndex == null) { @@ -613,7 +613,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public static class RangerEnumElementDef implements java.io.Serializable { private static final long serialVersionUID = 1L; - private Long id = null; + private Long itemId = null; private String name = null; private String label = null; private String rbKeyLabel = null; @@ -623,25 +623,25 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S this(null, null, null, null); } - public RangerEnumElementDef(Long id, String name, String label, String rbKeyLabel) { - setId(id); + public RangerEnumElementDef(Long itemId, String name, String label, String rbKeyLabel) { + setItemId(itemId); setName(name); setLabel(label); setRbKeyLabel(rbKeyLabel); } /** - * @return the id + * @return the itemId */ - public Long getId() { - return id; + public Long getItemId() { + return itemId; } /** - * @param id the id to set + * @param itemId the itemId to set */ - public void setId(Long id) { - this.id = id; + public void setItemId(Long itemId) { + this.itemId = itemId; } /** @@ -697,7 +697,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public StringBuilder toString(StringBuilder sb) { sb.append("RangerEnumElementDef={"); - sb.append("id={").append(id).append("} "); + sb.append("itemId={").append(itemId).append("} "); sb.append("name={").append(name).append("} "); sb.append("label={").append(label).append("} "); sb.append("rbKeyLabel={").append(rbKeyLabel).append("} "); @@ -710,7 +710,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((itemId == null) ? 0 : itemId.hashCode()); result = prime * result + ((label == null) ? 0 : label.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result @@ -727,11 +727,11 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S if (getClass() != obj.getClass()) return false; RangerEnumElementDef other = (RangerEnumElementDef) obj; - if (id == null) { - if (other.id != null) { + if (itemId == null) { + if (other.itemId != null) { return false; } - } else if (other.id == null || !id.equals(other.id)) { + } else if (other.itemId == null || !itemId.equals(other.itemId)) { return false; } @@ -758,7 +758,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public static class RangerServiceConfigDef implements java.io.Serializable { private static final long serialVersionUID = 1L; - private Long id = null; + private Long itemId = null; private String name = null; private String type = null; private String subType = null; @@ -778,8 +778,8 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S this(null, null, null, null, null, null, null, null, null, null, null, null, null, null); } - public RangerServiceConfigDef(Long id, String name, String type, String subType, Boolean mandatory, String defaultValue, String validationRegEx, String validationMessage, String uiHint, String label, String description, String rbKeyLabel, String rbKeyDescription, String rbKeyValidationMessage) { - setId(id); + public RangerServiceConfigDef(Long itemId, String name, String type, String subType, Boolean mandatory, String defaultValue, String validationRegEx, String validationMessage, String uiHint, String label, String description, String rbKeyLabel, String rbKeyDescription, String rbKeyValidationMessage) { + setItemId(itemId); setName(name); setType(type); setSubType(subType); @@ -796,17 +796,17 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S } /** - * @return the id + * @return the itemId */ - public Long getId() { - return id; + public Long getItemId() { + return itemId; } /** - * @param id the id to set + * @param itemId the itemId to set */ - public void setId(Long id) { - this.id = id; + public void setItemId(Long itemId) { + this.itemId = itemId; } /** @@ -1002,7 +1002,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public StringBuilder toString(StringBuilder sb) { sb.append("RangerServiceConfigDef={"); - sb.append("id={").append(name).append("} "); + sb.append("itemId={").append(name).append("} "); sb.append("name={").append(name).append("} "); sb.append("type={").append(type).append("} "); sb.append("subType={").append(subType).append("} "); @@ -1142,7 +1142,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public static class RangerResourceDef implements java.io.Serializable { private static final long serialVersionUID = 1L; - private Long id = null; + private Long itemId = null; private String name = null; private String type = null; private Integer level = null; @@ -1167,8 +1167,8 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S this(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); } - public RangerResourceDef(Long id, String name, String type, Integer level, String parent, Boolean mandatory, Boolean lookupSupported, Boolean recursiveSupported, Boolean excludesSupported, String matcher, Map<String, String> matcherOptions, String validationRegEx, String validationMessage, String uiHint, String label, String description, String rbKeyLabel, String rbKeyDescription, String rbKeyValidationMessage) { - setId(id); + public RangerResourceDef(Long itemId, String name, String type, Integer level, String parent, Boolean mandatory, Boolean lookupSupported, Boolean recursiveSupported, Boolean excludesSupported, String matcher, Map<String, String> matcherOptions, String validationRegEx, String validationMessage, String uiHint, String label, String description, String rbKeyLabel, String rbKeyDescription, String rbKeyValidationMessage) { + setItemId(itemId); setName(name); setType(type); setLevel(level); @@ -1190,17 +1190,17 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S } /** - * @return the id + * @return the itemId */ - public Long getId() { - return id; + public Long getItemId() { + return itemId; } /** - * @param id the id to set + * @param itemId the itemId to set */ - public void setId(Long id) { - this.id = id; + public void setItemId(Long itemId) { + this.itemId = itemId; } /** @@ -1466,7 +1466,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public StringBuilder toString(StringBuilder sb) { sb.append("RangerResourceDef={"); - sb.append("id={").append(id).append("} "); + sb.append("itemId={").append(itemId).append("} "); sb.append("name={").append(name).append("} "); sb.append("type={").append(type).append("} "); sb.append("level={").append(level).append("} "); @@ -1653,7 +1653,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public static class RangerAccessTypeDef implements java.io.Serializable { private static final long serialVersionUID = 1L; - private Long id = null; + private Long itemId = null; private String name = null; private String label = null; private String rbKeyLabel = null; @@ -1664,8 +1664,8 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S this(null, null, null, null, null); } - public RangerAccessTypeDef(Long id, String name, String label, String rbKeyLabel, Collection<String> impliedGrants) { - setId(id); + public RangerAccessTypeDef(Long itemId, String name, String label, String rbKeyLabel, Collection<String> impliedGrants) { + setItemId(itemId); setName(name); setLabel(label); setRbKeyLabel(rbKeyLabel); @@ -1673,17 +1673,17 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S } /** - * @return the id + * @return the itemId */ - public Long getId() { - return id; + public Long getItemId() { + return itemId; } /** - * @param id the id to set + * @param itemId the itemId to set */ - public void setId(Long id) { - this.id = id; + public void setItemId(Long itemId) { + this.itemId = itemId; } /** @@ -1767,7 +1767,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public StringBuilder toString(StringBuilder sb) { sb.append("RangerAccessTypeDef={"); - sb.append("id={").append(id).append("} "); + sb.append("itemId={").append(itemId).append("} "); sb.append("name={").append(name).append("} "); sb.append("label={").append(label).append("} "); sb.append("rbKeyLabel={").append(rbKeyLabel).append("} "); @@ -1791,7 +1791,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((itemId == null) ? 0 : itemId.hashCode()); result = prime * result + ((impliedGrants == null) ? 0 : impliedGrants.hashCode()); result = prime * result + ((label == null) ? 0 : label.hashCode()); @@ -1810,10 +1810,10 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S if (getClass() != obj.getClass()) return false; RangerAccessTypeDef other = (RangerAccessTypeDef) obj; - if (id == null) { - if (other.id != null) + if (itemId == null) { + if (other.itemId != null) return false; - } else if (other.id == null || !id.equals(other.id)) + } else if (other.itemId == null || !itemId.equals(other.itemId)) return false; if (impliedGrants == null) { @@ -1844,7 +1844,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public static class RangerPolicyConditionDef implements java.io.Serializable { private static final long serialVersionUID = 1L; - private Long id = null; + private Long itemId = null; private String name = null; private String evaluator = null; private Map<String, String> evaluatorOptions = null; @@ -1862,12 +1862,12 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S this(null, null, null, null, null, null, null, null, null, null, null, null); } - public RangerPolicyConditionDef(Long id, String name, String evaluator, Map<String, String> evaluatorOptions) { - this(id, name, evaluator, evaluatorOptions, null, null, null, null, null, null, null, null); + public RangerPolicyConditionDef(Long itemId, String name, String evaluator, Map<String, String> evaluatorOptions) { + this(itemId, name, evaluator, evaluatorOptions, null, null, null, null, null, null, null, null); } - public RangerPolicyConditionDef(Long id, String name, String evaluator, Map<String, String> evaluatorOptions, String validationRegEx, String vaidationMessage, String uiHint, String label, String description, String rbKeyLabel, String rbKeyDescription, String rbKeyValidationMessage) { - setId(id); + public RangerPolicyConditionDef(Long itemId, String name, String evaluator, Map<String, String> evaluatorOptions, String validationRegEx, String vaidationMessage, String uiHint, String label, String description, String rbKeyLabel, String rbKeyDescription, String rbKeyValidationMessage) { + setItemId(itemId); setName(name); setEvaluator(evaluator); setEvaluatorOptions(evaluatorOptions); @@ -1882,17 +1882,17 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S } /** - * @return the id + * @return the itemId */ - public Long getId() { - return id; + public Long getItemId() { + return itemId; } /** - * @param id the id to set + * @param itemId the itemId to set */ - public void setId(Long id) { - this.id = id; + public void setItemId(Long itemId) { + this.itemId = itemId; } /** @@ -2060,7 +2060,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public StringBuilder toString(StringBuilder sb) { sb.append("RangerPolicyConditionDef={"); - sb.append("id={").append(id).append("} "); + sb.append("itemId={").append(itemId).append("} "); sb.append("name={").append(name).append("} "); sb.append("evaluator={").append(evaluator).append("} "); sb.append("evaluatorOptions={").append(evaluatorOptions).append("} "); @@ -2082,7 +2082,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S final int prime = 31; int result = 1; result = prime * result - + ((id == null) ? 0 : id.hashCode()); + + ((itemId == null) ? 0 : itemId.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result @@ -2125,10 +2125,10 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S if (getClass() != obj.getClass()) return false; RangerPolicyConditionDef other = (RangerPolicyConditionDef) obj; - if (id == null) { - if (other.id != null) + if (itemId == null) { + if (other.itemId != null) return false; - } else if (other.id != null || !id.equals(other.id)) { + } else if (other.itemId != null || !itemId.equals(other.itemId)) { return false; } @@ -2195,7 +2195,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public static class RangerContextEnricherDef implements java.io.Serializable { private static final long serialVersionUID = 1L; - private Long id = null; + private Long itemId = null; private String name = null; private String enricher = null; private Map<String, String> enricherOptions = null; @@ -2205,25 +2205,25 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S this(null, null, null, null); } - public RangerContextEnricherDef(Long id, String name, String enricher, Map<String, String> enricherOptions) { - setId(id); + public RangerContextEnricherDef(Long itemId, String name, String enricher, Map<String, String> enricherOptions) { + setItemId(itemId); setName(name); setEnricher(enricher); setEnricherOptions(enricherOptions); } /** - * @return the id + * @return the itemId */ - public Long getId() { - return id; + public Long getItemId() { + return itemId; } /** - * @param id the id to set + * @param itemId the itemId to set */ - public void setId(Long id) { - this.id = id; + public void setItemId(Long itemId) { + this.itemId = itemId; } /** @@ -2279,7 +2279,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public StringBuilder toString(StringBuilder sb) { sb.append("RangerContextEnricherDef={"); - sb.append("id={").append(id).append("} "); + sb.append("itemId={").append(itemId).append("} "); sb.append("name={").append(name).append("} "); sb.append("enricher={").append(enricher).append("} "); sb.append("enricherOptions={").append(enricherOptions).append("} "); @@ -2292,7 +2292,7 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((itemId == null) ? 0 : itemId.hashCode()); result = prime * result + ((enricher == null) ? 0 : enricher.hashCode()); result = prime @@ -2312,10 +2312,10 @@ public class RangerServiceDef extends RangerBaseModelObject implements java.io.S if (getClass() != obj.getClass()) return false; RangerContextEnricherDef other = (RangerContextEnricherDef) obj; - if (id == null) { - if (other.id != null) + if (itemId == null) { + if (other.itemId != null) return false; - } else if (other.id == null || !id.equals(other.id)) + } else if (other.itemId == null || !itemId.equals(other.itemId)) return false; if (enricher == null) { http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefValidator.java ---------------------------------------------------------------------- diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefValidator.java b/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefValidator.java index c57e5fc..32d0f1a 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefValidator.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefValidator.java @@ -238,7 +238,7 @@ public class RangerServiceDefValidator extends RangerValidator { for (RangerAccessTypeDef def : accessTypeDefs) { String name = def.getName(); valid = isUnique(name, accessNames, "access type name", "access types", failures) && valid; - valid = isUnique(def.getId(), ids, "access type id", "access types", failures) && valid; + valid = isUnique(def.getItemId(), ids, "access type itemId", "access types", failures) && valid; if (CollectionUtils.isNotEmpty(def.getImpliedGrants())) { defsWithImpliedGrants.add(def); } @@ -288,7 +288,7 @@ public class RangerServiceDefValidator extends RangerValidator { Set<Long> ids = new HashSet<Long>(); Set<String> names = new HashSet<String>(); for (RangerPolicyConditionDef conditionDef : policyConditions) { - valid = isUnique(conditionDef.getId(), ids, "policy condition def id", "policy condition defs", failures) && valid; + valid = isUnique(conditionDef.getItemId(), ids, "policy condition def itemId", "policy condition defs", failures) && valid; String name = conditionDef.getName(); valid = isUnique(name, names, "policy condition def name", "policy condition defs", failures) && valid; if (StringUtils.isBlank(conditionDef.getEvaluator())) { @@ -323,7 +323,7 @@ public class RangerServiceDefValidator extends RangerValidator { Set<Long> ids = new HashSet<Long>(configs.size()); Set<String> names = new HashSet<String>(configs.size()); for (RangerServiceConfigDef aConfig : configs) { - valid = isUnique(aConfig.getId(), ids, "config def id", "config defs", failures) && valid; + valid = isUnique(aConfig.getItemId(), ids, "config def itemId", "config defs", failures) && valid; String configName = aConfig.getName(); valid = isUnique(configName, names, "config def name", "config defs", failures) && valid; String type = aConfig.getType(); @@ -445,7 +445,7 @@ public class RangerServiceDefValidator extends RangerValidator { * While id is the natural key, name is a surrogate key. At several places code expects resource name to be unique within a service. */ valid = isUnique(resource.getName(), names, "resource name", "resources", failures) && valid; - valid = isUnique(resource.getId(), ids, "resource id", "resources", failures) && valid; + valid = isUnique(resource.getItemId(), ids, "resource itemId", "resources", failures) && valid; } } @@ -508,7 +508,7 @@ public class RangerServiceDefValidator extends RangerValidator { // enum-names and ids must non-blank and be unique to a service definition String enumName = enumDef.getName(); valid = isUnique(enumName, names, "enum def name", "enum defs", failures) && valid; - valid = isUnique(enumDef.getId(), ids, "enum def id", "enum defs", failures) && valid; + valid = isUnique(enumDef.getItemId(), ids, "enum def itemId", "enum defs", failures) && valid; // enum must contain at least one valid value and those values should be non-blank and distinct if (CollectionUtils.isEmpty(enumDef.getElements())) { failures.add(new ValidationFailureDetailsBuilder() @@ -565,7 +565,7 @@ public class RangerServiceDefValidator extends RangerValidator { valid = false; } else { valid = isUnique(elementDef.getName(), enumName, elementNames, "enum element name", "enum elements", failures) && valid; - valid = isUnique(elementDef.getId(), enumName, ids, "enum element id", "enum elements", failures) && valid; + valid = isUnique(elementDef.getItemId(), enumName, ids, "enum element itemId", "enum elements", failures) && valid; } } } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-hbase.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-hbase.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-hbase.json index 2887e5f..61ff0f3 100644 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-hbase.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-hbase.json @@ -7,7 +7,7 @@ "resources": [ { - "id": 1, + "itemId": 1, "name": "table", "type": "string", "level": 10, @@ -26,7 +26,7 @@ }, { - "id": 2, + "itemId": 2, "name": "column-family", "type": "string", "level": 20, @@ -45,7 +45,7 @@ }, { - "id": 3, + "itemId": 3, "name": "column", "type": "string", "level": 30, @@ -67,25 +67,25 @@ "accessTypes": [ { - "id": 1, + "itemId": 1, "name": "read", "label": "Read" }, { - "id": 2, + "itemId": 2, "name": "write", "label": "Write" }, { - "id": 3, + "itemId": 3, "name": "create", "label": "Create" }, { - "id": 4, + "itemId": 4, "name": "admin", "label": "Admin", "impliedGrants": @@ -100,7 +100,7 @@ "configs": [ { - "id": 1, + "itemId": 1, "name": "username", "type": "string", "subType": "", @@ -112,7 +112,7 @@ }, { - "id": 2, + "itemId": 2, "name": "password", "type": "password", "subType": "", @@ -124,7 +124,7 @@ }, { - "id": 3, + "itemId": 3, "name": "hadoop.security.authentication", "type": "enum", "subType": "authnType", @@ -136,7 +136,7 @@ }, { - "id": 4, + "itemId": 4, "name": "hbase.master.kerberos.principal", "type": "string", "subType": "", @@ -145,7 +145,7 @@ }, { - "id": 5, + "itemId": 5, "name": "hbase.security.authentication", "type": "enum", "subType": "authnType", @@ -157,7 +157,7 @@ }, { - "id": 6, + "itemId": 6, "name": "hbase.zookeeper.property.clientPort", "type": "int", "subType": "", @@ -169,7 +169,7 @@ }, { - "id": 7, + "itemId": 7, "name": "hbase.zookeeper.quorum", "type": "string", "subType": "", @@ -180,7 +180,7 @@ }, { - "id": 8, + "itemId": 8, "name": "zookeeper.znode.parent", "type": "string", "subType": "", @@ -192,7 +192,7 @@ }, { - "id": 9, + "itemId": 9, "name": "commonNameForCertificate", "type": "string", "subType": "", @@ -207,18 +207,18 @@ "enums": [ { - "id": 1, + "itemId": 1, "name": "authnType", "elements": [ { - "id": 1, + "itemId": 1, "name": "simple", "label": "Simple" }, { - "id": 2, + "itemId": 2, "name": "kerberos", "label": "Kerberos" } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json index 75deeb4..37c020b 100755 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-hdfs.json @@ -7,7 +7,7 @@ "resources": [ { - "id": 1, + "itemId": 1, "name": "path", "type": "path", "level": 10, @@ -29,19 +29,19 @@ "accessTypes": [ { - "id": 1, + "itemId": 1, "name": "read", "label": "Read" }, { - "id": 2, + "itemId": 2, "name": "write", "label": "Write" }, { - "id": 3, + "itemId": 3, "name": "execute", "label": "Execute" } @@ -50,7 +50,7 @@ "configs": [ { - "id": 1, + "itemId": 1, "name": "username", "type": "string", "subType": "", @@ -62,7 +62,7 @@ }, { - "id": 2, + "itemId": 2, "name": "password", "type": "password", "subType": "", @@ -74,7 +74,7 @@ }, { - "id": 3, + "itemId": 3, "name": "fs.default.name", "type": "string", "subType": "", @@ -86,7 +86,7 @@ }, { - "id": 4, + "itemId": 4, "name": "hadoop.security.authorization", "type": "bool", "subType": "YesTrue:NoFalse", @@ -99,7 +99,7 @@ }, { - "id": 5, + "itemId": 5, "name": "hadoop.security.authentication", "type": "enum", "subType": "authnType", @@ -112,7 +112,7 @@ }, { - "id": 6, + "itemId": 6, "name": "hadoop.security.auth_to_local", "type": "string", "subType": "", @@ -123,7 +123,7 @@ }, { - "id": 7, + "itemId": 7, "name": "dfs.datanode.kerberos.principal", "type": "string", "subType": "", @@ -134,7 +134,7 @@ }, { - "id": 8, + "itemId": 8, "name": "dfs.namenode.kerberos.principal", "type": "string", "subType": "", @@ -145,7 +145,7 @@ }, { - "id": 9, + "itemId": 9, "name": "dfs.secondary.namenode.kerberos.principal", "type": "string", "subType": "", @@ -156,7 +156,7 @@ }, { - "id": 10, + "itemId": 10, "name": "hadoop.rpc.protection", "type": "enum", "subType": "rpcProtection", @@ -169,7 +169,7 @@ }, { - "id": 11, + "itemId": 11, "name": "commonNameForCertificate", "type": "string", "subType": "", @@ -184,18 +184,18 @@ "enums": [ { - "id": 1, + "itemId": 1, "name": "authnType", "elements": [ { - "id": 1, + "itemId": 1, "name": "simple", "label": "Simple" }, { - "id": 2, + "itemId": 2, "name": "kerberos", "label": "Kerberos" } @@ -205,24 +205,24 @@ }, { - "id": 2, + "itemId": 2, "name": "rpcProtection", "elements": [ { - "id": 1, + "itemId": 1, "name": "authentication", "label": "Authentication" }, { - "id": 2, + "itemId": 2, "name": "integrity", "label": "Integrity" }, { - "id": 3, + "itemId": 3, "name": "privacy", "label": "Privacy" } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-hive.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-hive.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-hive.json index 6d1cab5..cda0efe 100644 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-hive.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-hive.json @@ -7,7 +7,7 @@ "resources": [ { - "id": 1, + "itemId": 1, "name": "database", "type": "string", "level": 10, @@ -26,7 +26,7 @@ }, { - "id": 2, + "itemId": 2, "name": "table", "type": "string", "level": 20, @@ -45,7 +45,7 @@ }, { - "id": 3, + "itemId": 3, "name": "udf", "type": "string", "level": 20, @@ -64,7 +64,7 @@ }, { - "id": 4, + "itemId": 4, "name": "column", "type": "string", "level": 30, @@ -86,49 +86,49 @@ "accessTypes": [ { - "id": 1, + "itemId": 1, "name": "select", "label": "select" }, { - "id": 2, + "itemId": 2, "name": "update", "label": "update" }, { - "id": 3, + "itemId": 3, "name": "create", "label": "Create" }, { - "id": 4, + "itemId": 4, "name": "drop", "label": "Drop" }, { - "id": 5, + "itemId": 5, "name": "alter", "label": "Alter" }, { - "id": 6, + "itemId": 6, "name": "index", "label": "Index" }, { - "id": 7, + "itemId": 7, "name": "lock", "label": "Lock" }, { - "id": 8, + "itemId": 8, "name": "all", "label": "All" } @@ -137,7 +137,7 @@ "configs": [ { - "id": 1, + "itemId": 1, "name": "username", "type": "string", "mandatory": true, @@ -148,7 +148,7 @@ }, { - "id": 2, + "itemId": 2, "name": "password", "type": "password", "mandatory": true, @@ -159,7 +159,7 @@ }, { - "id": 3, + "itemId": 3, "name": "jdbc.driverClassName", "type": "string", "mandatory": true, @@ -170,7 +170,7 @@ }, { - "id": 4, + "itemId": 4, "name": "jdbc.url", "type": "string", "mandatory": true, @@ -181,7 +181,7 @@ }, { - "id": 5, + "itemId": 5, "name": "commonNameForCertificate", "type": "string", "mandatory": false, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json index 98501a2..9928c5d 100644 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-kafka.json @@ -5,7 +5,7 @@ "description":"Apache Kafka", "resources":[ { - "id":1, + "itemId":1, "name":"topic", "type":"string", "level":1, @@ -28,42 +28,42 @@ ], "accessTypes":[ { - "id": 1, + "itemId": 1, "name":"publish", "label":"Publish" }, { - "id": 2, + "itemId": 2, "name":"consume", "label":"Consume" }, { - "id": 3, + "itemId": 3, "name":"create", "label":"Create" }, { - "id": 4, + "itemId": 4, "name":"delete", "label":"Delete" }, { - "id": 5, + "itemId": 5, "name":"configure", "label":"Configure" }, { - "id": 6, + "itemId": 6, "name":"describe", "label":"Describe" }, { - "id": 7, + "itemId": 7, "name":"replicate", "label":"Replicate" }, { - "id": 8, + "itemId": 8, "name":"connect", "label":"Connect" } @@ -71,21 +71,21 @@ ], "configs":[ { - "id": 1, + "itemId": 1, "name":"username", "type":"string", "mandatory":true, "label":"Username" }, { - "id": 2, + "itemId": 2, "name":"password", "type":"password", "mandatory":true, "label":"Password" }, { - "id": 3, + "itemId": 3, "name":"zookeeper.connect", "type":"string", "mandatory":true, @@ -93,7 +93,7 @@ "label":"Zookeeper Connect String" }, { - "id": 4, + "itemId": 4, "name":"commonNameForCertificate", "type":"string", "mandatory":false, @@ -109,7 +109,7 @@ ], "policyConditions":[ { - "id": 1, + "itemId": 1, "name": "ip-range", "evaluator": "org.apache.ranger.plugin.conditionevaluator.RangerIpMatcher", "evaluatorOptions": { }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-kms.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-kms.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-kms.json index 260d351..35d36e5 100755 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-kms.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-kms.json @@ -6,7 +6,7 @@ "resources": [ { - "id": 1, + "itemId": 1, "name": "keyname", "type": "string", "level": 10, @@ -28,55 +28,55 @@ "accessTypes": [ { - "id": 1, + "itemId": 1, "name": "create", "label": "Create" }, { - "id": 2, + "itemId": 2, "name": "delete", "label": "Delete" }, { - "id": 3, + "itemId": 3, "name": "rollover", "label": "Rollover" }, { - "id": 4, + "itemId": 4, "name": "setkeymaterial", "label": "Set Key Material" }, { - "id": 5, + "itemId": 5, "name": "get", "label": "Get" }, { - "id": 6, + "itemId": 6, "name": "getkeys", "label": "Get Keys" }, { - "id": 7, + "itemId": 7, "name": "getmetadata", "label": "Get Metadata" }, { - "id": 8, + "itemId": 8, "name": "generateeek", "label": "Generate EEK" }, { - "id": 9, + "itemId": 9, "name": "decrypteek", "label": "Decrypt EEK" } @@ -85,7 +85,7 @@ "configs": [ { - "id": 1, + "itemId": 1, "name": "provider", "type": "string", "mandatory": true, @@ -93,7 +93,7 @@ }, { - "id": 2, + "itemId": 2, "name": "username", "type": "string", "mandatory": true, @@ -101,7 +101,7 @@ }, { - "id": 3, + "itemId": 3, "name": "password", "type": "password", "mandatory": true, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-knox.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-knox.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-knox.json index e437e6b..33c09d2 100644 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-knox.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-knox.json @@ -7,7 +7,7 @@ "resources": [ { - "id": 1, + "itemId": 1, "name": "topology", "type": "string", "level": 10, @@ -26,7 +26,7 @@ }, { - "id": 2, + "itemId": 2, "name": "service", "type": "string", "level": 20, @@ -48,7 +48,7 @@ "accessTypes": [ { - "id": 1, + "itemId": 1, "name": "allow", "label": "Allow" } @@ -57,7 +57,7 @@ "configs": [ { - "id": 1, + "itemId": 1, "name": "username", "type": "string", "mandatory": true, @@ -68,7 +68,7 @@ }, { - "id": 2, + "itemId": 2, "name": "password", "type": "password", "mandatory": true, @@ -79,7 +79,7 @@ }, { - "id": 3, + "itemId": 3, "name": "knox.url", "type": "string", "mandatory": true, @@ -90,7 +90,7 @@ }, { - "id": 4, + "itemId": 4, "name": "commonNameForCertificate", "type": "string", "mandatory": false, @@ -114,7 +114,7 @@ "policyConditions": [ { - "id": 1, + "itemId": 1, "name": "ip-range", "evaluator": "org.apache.ranger.plugin.conditionevaluator.RangerIpMatcher", "evaluatorOptions": { }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-solr.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-solr.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-solr.json index 2b9fa1a..c2710e7 100644 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-solr.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-solr.json @@ -5,7 +5,7 @@ "description":"Solr", "resources":[ { - "id": 1, + "itemId": 1, "name":"collection", "type":"string", "level":10, @@ -23,7 +23,7 @@ "description":"Solr Collection" }, { - "id": 2, + "itemId": 2, "name":"field", "type":"string", "level":20, @@ -44,22 +44,22 @@ ], "accessTypes":[ { - "id": 1, + "itemId": 1, "name":"create", "label":"Create" }, { - "id": 2, + "itemId": 2, "name":"update", "label":"Update" }, { - "id": 3, + "itemId": 3, "name":"query", "label":"Query" }, { - "id": 4, + "itemId": 4, "name":"solr_admin", "label":"Solr Admin" } @@ -67,7 +67,7 @@ ], "configs":[ { - "id": 1, + "itemId": 1, "name":"username", "type":"string", "mandatory":true, @@ -77,7 +77,7 @@ "label":"Username" }, { - "id": 2, + "itemId": 2, "name":"password", "type":"password", "mandatory":true, @@ -87,7 +87,7 @@ "label":"Password" }, { - "id": 3, + "itemId": 3, "name":"solr.url", "type":"string", "mandatory":true, @@ -98,7 +98,7 @@ "label":"Solr URL" }, { - "id": 4, + "itemId": 4, "name":"commonNameForCertificate", "type":"string", "mandatory":false, @@ -117,7 +117,7 @@ ], "policyConditions":[ { - "id": 1, + "itemId": 1, "name": "ip-range", "evaluator": "org.apache.ranger.plugin.conditionevaluator.RangerIpMatcher", "evaluatorOptions": { }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-storm.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-storm.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-storm.json index 99d9dd1..39ffc37 100644 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-storm.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-storm.json @@ -7,7 +7,7 @@ "resources": [ { - "id": 1, + "itemId": 1, "name": "topology", "type": "string", "level": 10, @@ -28,7 +28,7 @@ "accessTypes": [ { - "id": 1, + "itemId": 1, "name": "submitTopology", "label": "Submit Topology", "impliedGrants": @@ -39,79 +39,79 @@ }, { - "id": 2, + "itemId": 2, "name": "fileUpload", "label": "File Upload" }, { - "id": 3, + "itemId": 3, "name": "getNimbusConf", "label": "Get Nimbus Conf" }, { - "id": 4, + "itemId": 4, "name": "getClusterInfo", "label": "Get Cluster Info" }, { - "id": 5, + "itemId": 5, "name": "fileDownload", "label": "File Download" }, { - "id": 6, + "itemId": 6, "name": "killTopology", "label": "Kill Topology" }, { - "id": 7, + "itemId": 7, "name": "rebalance", "label": "Rebalance" }, { - "id": 8, + "itemId": 8, "name": "activate", "label": "Activate" }, { - "id": 9, + "itemId": 9, "name": "deactivate", "label": "Deactivate" }, { - "id": 10, + "itemId": 10, "name": "getTopologyConf", "label": "Get Topology Conf" }, { - "id": 11, + "itemId": 11, "name": "getTopology", "label": "Get Topology" }, { - "id": 12, + "itemId": 12, "name": "getUserTopology", "label": "Get User Topology" }, { - "id": 13, + "itemId": 13, "name": "getTopologyInfo", "label": "Get Topology Info" }, { - "id": 14, + "itemId": 14, "name": "uploadNewCredentials", "label": "Upload New Credential" } @@ -120,7 +120,7 @@ "configs": [ { - "id": 1, + "itemId": 1, "name": "username", "type": "string", "mandatory": true, @@ -131,7 +131,7 @@ }, { - "id": 2, + "itemId": 2, "name": "password", "type": "password", "mandatory": true, @@ -142,7 +142,7 @@ }, { - "id": 3, + "itemId": 3, "name": "nimbus.url", "type": "string", "mandatory": true, @@ -154,7 +154,7 @@ }, { - "id": 4, + "itemId": 4, "name": "commonNameForCertificate", "type": "string", "mandatory": false, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/main/resources/service-defs/ranger-servicedef-yarn.json ---------------------------------------------------------------------- diff --git a/agents-common/src/main/resources/service-defs/ranger-servicedef-yarn.json b/agents-common/src/main/resources/service-defs/ranger-servicedef-yarn.json index c178e7e..fc3ce79 100644 --- a/agents-common/src/main/resources/service-defs/ranger-servicedef-yarn.json +++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-yarn.json @@ -7,7 +7,7 @@ "resources": [ { - "id": 1, + "itemId": 1, "name": "queue", "type": "string", "level": 10, @@ -27,13 +27,13 @@ "accessTypes": [ { - "id": 1, + "itemId": 1, "name": "submit-app", "label": "submit-app" }, { - "id": 2, + "itemId": 2, "name": "admin-queue", "label": "admin-queue", "impliedGrants": @@ -46,7 +46,7 @@ "configs": [ { - "id": 1, + "itemId": 1, "name": "username", "type": "string", "mandatory": true, @@ -57,7 +57,7 @@ }, { - "id": 2, + "itemId": 2, "name": "password", "type": "password", "mandatory": true, @@ -68,7 +68,7 @@ }, { - "id": 3, + "itemId": 3, "name": "yarn.url", "type": "string", "mandatory": true, @@ -80,7 +80,7 @@ }, { - "id": 4, + "itemId": 4, "name": "commonNameForCertificate", "type": "string", "mandatory": false, @@ -104,7 +104,7 @@ "policyConditions": [ { - "id": 1, + "itemId": 1, "name": "ip-range", "evaluator": "org.apache.ranger.plugin.conditionevaluator.RangerIpMatcher", "evaluatorOptions": { }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java index 54bbdf1..2ce8c03 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java @@ -246,7 +246,7 @@ public class TestRangerServiceDefValidator { accessTypeDefs = _utils.createAccessTypeDefs(accessTypes_bad_unknownType); _failures.clear(); assertFalse(_validator.isValidAccessTypes(accessTypeDefs, _failures)); _utils.checkFailureForSemanticError(_failures, "implied grants", "execute"); - _utils.checkFailureForSemanticError(_failures, "access type id", "1"); // id 1 is duplicated + _utils.checkFailureForSemanticError(_failures, "access type itemId", "1"); // id 1 is duplicated // access type with implied grant referring to itself accessTypeDefs = _utils.createAccessTypeDefs(accessTypes_bad_selfReference); @@ -305,7 +305,7 @@ public class TestRangerServiceDefValidator { input = _utils.createEnumDefs(enums_bad_enumName_blank); _failures.clear(); assertFalse(_validator.isValidEnums(input, _failures)); _utils.checkFailureForMissingValue(_failures, "enum def name"); - _utils.checkFailureForSemanticError(_failures, "enum def id", "1"); + _utils.checkFailureForSemanticError(_failures, "enum def itemId", "1"); // enum elements collection should not be null or empty input = _utils.createEnumDefs(enums_good); @@ -319,7 +319,7 @@ public class TestRangerServiceDefValidator { input = _utils.createEnumDefs(enums_bad_Elements_empty); _failures.clear(); assertFalse(_validator.isValidEnums(input, _failures)); _utils.checkFailureForMissingValue(_failures, "enum values", "anEnum"); - _utils.checkFailureForMissingValue(_failures, "enum def id"); + _utils.checkFailureForMissingValue(_failures, "enum def itemId"); // enum names should be distinct -- exact match input = _utils.createEnumDefs(enums_good); @@ -407,8 +407,8 @@ public class TestRangerServiceDefValidator { resources.addAll(_utils.createResourceDefsWithIds(invalidResources)); _failures.clear(); assertFalse(_validator.isValidResources(_serviceDef, _failures)); _utils.checkFailureForMissingValue(_failures, "resource name"); - _utils.checkFailureForMissingValue(_failures, "resource id"); - _utils.checkFailureForSemanticError(_failures, "resource id", "1"); // id 1 is duplicate + _utils.checkFailureForMissingValue(_failures, "resource itemId"); + _utils.checkFailureForSemanticError(_failures, "resource itemId", "1"); // id 1 is duplicate _utils.checkFailureForSemanticError(_failures, "resource name", "DataBase"); } @@ -479,10 +479,10 @@ public class TestRangerServiceDefValidator { List<RangerEnumDef> enumDefs = _utils.createEnumDefs(enums_good); assertFalse(_validator.isValidConfigs(configs, enumDefs, _failures)); _utils.checkFailureForMissingValue(_failures, "config def name"); - _utils.checkFailureForMissingValue(_failures, "config def id"); + _utils.checkFailureForMissingValue(_failures, "config def itemId"); _utils.checkFailureForMissingValue(_failures, "config def type"); _utils.checkFailureForSemanticError(_failures, "config def name", "security"); // there were two configs with same name as security - _utils.checkFailureForSemanticError(_failures, "config def id", "1"); // a config with duplicate had id of 1 + _utils.checkFailureForSemanticError(_failures, "config def itemId", "1"); // a config with duplicate had id of 1 _utils.checkFailureForSemanticError(_failures, "config def type", "security"); // type for config security was invalid _utils.checkFailureForSemanticError(_failures, "config def subtype", "timeout"); // type for config security was invalid _utils.checkFailureForSemanticError(_failures, "config def default value", "auth"); // type for config security was invalid @@ -507,10 +507,10 @@ public class TestRangerServiceDefValidator { conditionDefs.addAll(_utils.createPolicyConditionDefs(policyCondition_data)); _failures.clear(); assertFalse(_validator.isValidPolicyConditions(conditionDefs, _failures)); - _utils.checkFailureForMissingValue(_failures, "policy condition def id"); + _utils.checkFailureForMissingValue(_failures, "policy condition def itemId"); _utils.checkFailureForMissingValue(_failures, "policy condition def name"); _utils.checkFailureForMissingValue(_failures, "policy condition def evaluator"); - _utils.checkFailureForSemanticError(_failures, "policy condition def id", "1"); + _utils.checkFailureForSemanticError(_failures, "policy condition def itemId", "1"); _utils.checkFailureForSemanticError(_failures, "policy condition def name", "condition-1"); _utils.checkFailureForMissingValue(_failures, "policy condition def evaluator", "condition-2"); _utils.checkFailureForMissingValue(_failures, "policy condition def evaluator", "condition-1"); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java index 549a94a..5c84feb 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java @@ -153,7 +153,7 @@ public class ValidationTestUtils { return result; } for (Object[] entry : data) { - Long id = (Long)entry[0]; + Long itemId = (Long)entry[0]; String accessType = (String)entry[1]; String[] impliedAccessArray = (String[])entry[2]; List<String> impliedAccesses = null; @@ -163,7 +163,7 @@ public class ValidationTestUtils { RangerAccessTypeDef aTypeDef = mock(RangerAccessTypeDef.class); when(aTypeDef.getName()).thenReturn(accessType); when(aTypeDef.getImpliedGrants()).thenReturn(impliedAccesses); - when(aTypeDef.getId()).thenReturn(id); + when(aTypeDef.getItemId()).thenReturn(itemId); result.add(aTypeDef); } return result; @@ -313,12 +313,12 @@ public class ValidationTestUtils { for (Object[] row : data) { RangerResourceDef aDef = null; if (row != null) { - Long id = (Long)row[0]; + Long itemId = (Long)row[0]; Integer level = (Integer)row[1]; String name = (String)row[2]; aDef = mock(RangerResourceDef.class); when(aDef.getName()).thenReturn(name); - when(aDef.getId()).thenReturn(id); + when(aDef.getItemId()).thenReturn(itemId); when(aDef.getLevel()).thenReturn(level); } defs.add(aDef); @@ -348,7 +348,7 @@ public class ValidationTestUtils { case 2: when(aDef.getName()).thenReturn((String)row[1]); case 1: - when(aDef.getId()).thenReturn((Long) row[0]); + when(aDef.getItemId()).thenReturn((Long) row[0]); } output.add(aDef); } @@ -372,7 +372,7 @@ public class ValidationTestUtils { String enumName = (String) row[1]; when(enumDef.getName()).thenReturn(enumName); case 1: - when(enumDef.getId()).thenReturn((Long)row[0]); + when(enumDef.getItemId()).thenReturn((Long)row[0]); } defs.add(enumDef); } @@ -421,8 +421,8 @@ public class ValidationTestUtils { String name = (String)row[1]; when(configDef.getName()).thenReturn(name); case 1: // id - Long id = (Long)row[0]; - when(configDef.getId()).thenReturn(id); + Long itemId = (Long)row[0]; + when(configDef.getItemId()).thenReturn(itemId); } result.add(configDef); } @@ -434,7 +434,7 @@ public class ValidationTestUtils { if (input != null) { for (Object[] row : input) { RangerPolicyConditionDef conditionDef = mock(RangerPolicyConditionDef.class); - when(conditionDef.getId()).thenReturn((Long)row[0]); + when(conditionDef.getItemId()).thenReturn((Long)row[0]); when(conditionDef.getName()).thenReturn((String)row[1]); when(conditionDef.getEvaluator()).thenReturn((String)row[2]); result.add(conditionDef); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/db/mysql/patches/009-updated_schema.sql ---------------------------------------------------------------------- diff --git a/security-admin/db/mysql/patches/009-updated_schema.sql b/security-admin/db/mysql/patches/009-updated_schema.sql index 40e71ca..14d7367 100644 --- a/security-admin/db/mysql/patches/009-updated_schema.sql +++ b/security-admin/db/mysql/patches/009-updated_schema.sql @@ -106,6 +106,7 @@ CREATE TABLE `x_service_config_def` ( `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `def_id` bigint(20) NOT NULL, +`item_id` bigint(20) NOT NULL, `name` varchar(1024) DEFAULT NULL, `type` varchar(1024) DEFAULT NULL, `sub_type` varchar(1024) DEFAULT NULL, @@ -136,6 +137,7 @@ CREATE TABLE `x_resource_def` ( `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `def_id` bigint(20) NOT NULL, +`item_id` bigint(20) NOT NULL, `name` varchar(1024) DEFAULT NULL, `type` varchar(1024) DEFAULT NULL, `res_level` bigint(20) DEFAULT NULL, @@ -172,6 +174,7 @@ CREATE TABLE `x_access_type_def` ( `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `def_id` bigint(20) NOT NULL, +`item_id` bigint(20) NOT NULL, `name` varchar(1024) DEFAULT NULL, `label` varchar(1024) DEFAULT NULL, `rb_key_label` varchar(1024) DEFAULT NULL, @@ -207,6 +210,7 @@ CREATE TABLE `x_policy_condition_def` ( `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `def_id` bigint(20) NOT NULL, +`item_id` bigint(20) NOT NULL, `name` varchar(1024) DEFAULT NULL, `evaluator` varchar(1024) DEFAULT NULL, `evaluator_options` varchar(1024) DEFAULT NULL, @@ -234,6 +238,7 @@ CREATE TABLE `x_context_enricher_def` ( `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `def_id` bigint(20) NOT NULL, +`item_id` bigint(20) NOT NULL, `name` varchar(1024) DEFAULT NULL, `enricher` varchar(1024) DEFAULT NULL, `enricher_options` varchar(1024) DEFAULT NULL, @@ -253,6 +258,7 @@ CREATE TABLE `x_enum_def` ( `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `def_id` bigint(20) NOT NULL, +`item_id` bigint(20) NOT NULL, `name` varchar(1024) DEFAULT NULL, `default_index` bigint(20) DEFAULT NULL, primary key (`id`), @@ -271,6 +277,7 @@ CREATE TABLE `x_enum_element_def` ( `added_by_id` bigint(20) DEFAULT NULL, `upd_by_id` bigint(20) DEFAULT NULL, `enum_def_id` bigint(20) NOT NULL, +`item_id` bigint(20) NOT NULL, `name` varchar(1024) DEFAULT NULL, `label` varchar(1024) DEFAULT NULL, `rb_key_label` varchar(1024) DEFAULT NULL, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/db/oracle/patches/009-updated_schema.sql ---------------------------------------------------------------------- diff --git a/security-admin/db/oracle/patches/009-updated_schema.sql b/security-admin/db/oracle/patches/009-updated_schema.sql index cdbdeb8..7bcd8ed 100644 --- a/security-admin/db/oracle/patches/009-updated_schema.sql +++ b/security-admin/db/oracle/patches/009-updated_schema.sql @@ -104,6 +104,7 @@ update_time DATE DEFAULT NULL NULL, added_by_id NUMBER(20) DEFAULT NULL NULL, upd_by_id NUMBER(20) DEFAULT NULL NULL, def_id NUMBER(20) NOT NULL, +item_id NUMBER(20) NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, type VARCHAR(1024) DEFAULT NULL NULL, sub_type VARCHAR(1024) DEFAULT NULL NULL, @@ -132,6 +133,7 @@ update_time DATE DEFAULT NULL NULL, added_by_id NUMBER(20) DEFAULT NULL NULL, upd_by_id NUMBER(20) DEFAULT NULL NULL, def_id NUMBER(20) NOT NULL, +item_id NUMBER(20) NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, type VARCHAR(1024) DEFAULT NULL NULL, res_level NUMBER(20) DEFAULT NULL NULL, @@ -166,6 +168,7 @@ update_time DATE DEFAULT NULL NULL, added_by_id NUMBER(20) DEFAULT NULL NULL, upd_by_id NUMBER(20) DEFAULT NULL NULL, def_id NUMBER(20) NOT NULL, +item_id NUMBER(20) NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, label VARCHAR(1024) DEFAULT NULL NULL, rb_key_label VARCHAR(1024) DEFAULT NULL NULL, @@ -199,6 +202,7 @@ update_time DATE DEFAULT NULL NULL, added_by_id NUMBER(20) DEFAULT NULL NULL, upd_by_id NUMBER(20) DEFAULT NULL NULL, def_id NUMBER(20) NOT NULL, +item_id NUMBER(20) NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, evaluator VARCHAR(1024) DEFAULT NULL NULL, evaluator_options VARCHAR(1024) DEFAULT NULL NULL, @@ -225,6 +229,7 @@ update_time DATE DEFAULT NULL NULL, added_by_id NUMBER(20) DEFAULT NULL, upd_by_id NUMBER(20) DEFAULT NULL, def_id NUMBER(20) NOT NULL, +item_id NUMBER(20) NOT NULL, name varchar(1024) DEFAULT NULL NULL, enricher varchar(1024) DEFAULT NULL NULL, enricher_options varchar(1024) DEFAULT NULL NULL, @@ -243,6 +248,7 @@ update_time DATE DEFAULT NULL NULL, added_by_id NUMBER(20) DEFAULT NULL NULL, upd_by_id NUMBER(20) DEFAULT NULL NULL, def_id NUMBER(20) NOT NULL, +item_id NUMBER(20) NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, default_index NUMBER(20) DEFAULT NULL NULL, primary key (id), @@ -259,6 +265,7 @@ update_time DATE DEFAULT NULL NULL, added_by_id NUMBER(20) DEFAULT NULL NULL, upd_by_id NUMBER(20) DEFAULT NULL NULL, enum_def_id NUMBER(20) NOT NULL, +item_id NUMBER(20) NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, label VARCHAR(1024) DEFAULT NULL NULL, rb_key_label VARCHAR(1024) DEFAULT NULL NULL, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/db/postgres/xa_core_db_postgres.sql ---------------------------------------------------------------------- diff --git a/security-admin/db/postgres/xa_core_db_postgres.sql b/security-admin/db/postgres/xa_core_db_postgres.sql index 10f614b..90cd0ac 100644 --- a/security-admin/db/postgres/xa_core_db_postgres.sql +++ b/security-admin/db/postgres/xa_core_db_postgres.sql @@ -537,6 +537,7 @@ update_time TIMESTAMP DEFAULT NULL NULL, added_by_id BIGINT DEFAULT NULL NULL, upd_by_id BIGINT DEFAULT NULL NULL, def_id BIGINT NOT NULL, +item_id BIGINT NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, type VARCHAR(1024) DEFAULT NULL NULL, sub_type VARCHAR(1024) DEFAULT NULL NULL, @@ -567,6 +568,7 @@ update_time TIMESTAMP DEFAULT NULL NULL, added_by_id BIGINT DEFAULT NULL NULL, upd_by_id BIGINT DEFAULT NULL NULL, def_id BIGINT NOT NULL, +item_id BIGINT NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, type VARCHAR(1024) DEFAULT NULL NULL, res_level BIGINT DEFAULT NULL NULL, @@ -603,6 +605,7 @@ update_time TIMESTAMP DEFAULT NULL NULL, added_by_id BIGINT DEFAULT NULL NULL, upd_by_id BIGINT DEFAULT NULL NULL, def_id BIGINT NOT NULL, +item_id BIGINT NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, label VARCHAR(1024) DEFAULT NULL NULL, rb_key_label VARCHAR(1024) DEFAULT NULL NULL, @@ -640,6 +643,7 @@ update_time TIMESTAMP DEFAULT NULL NULL, added_by_id BIGINT DEFAULT NULL NULL, upd_by_id BIGINT DEFAULT NULL NULL, def_id BIGINT NOT NULL, +item_id BIGINT NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, evaluator VARCHAR(1024) DEFAULT NULL NULL, evaluator_options VARCHAR(1024) DEFAULT NULL NULL, @@ -668,6 +672,7 @@ update_time TIMESTAMP DEFAULT NULL NULL, added_by_id BIGINT DEFAULT NULL NULL, upd_by_id BIGINT DEFAULT NULL NULL, def_id BIGINT NOT NULL, +item_id BIGINT NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, enricher VARCHAR(1024) DEFAULT NULL NULL, enricher_options VARCHAR(1024) DEFAULT NULL NULL, @@ -688,6 +693,7 @@ update_time TIMESTAMP DEFAULT NULL NULL, added_by_id BIGINT DEFAULT NULL NULL, upd_by_id BIGINT DEFAULT NULL NULL, def_id BIGINT NOT NULL, +item_id BIGINT NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, default_index BIGINT DEFAULT NULL NULL, primary key(id), @@ -706,6 +712,7 @@ update_time TIMESTAMP DEFAULT NULL NULL, added_by_id BIGINT DEFAULT NULL NULL, upd_by_id BIGINT DEFAULT NULL NULL, enum_def_id BIGINT NOT NULL, +item_id BIGINT NOT NULL, name VARCHAR(1024) DEFAULT NULL NULL, label VARCHAR(1024) DEFAULT NULL NULL, rb_key_label VARCHAR(1024) DEFAULT NULL NULL, @@ -975,4 +982,4 @@ COMMIT; INSERT INTO x_portal_user(CREATE_TIME,UPDATE_TIME,FIRST_NAME,LAST_NAME,PUB_SCR_NAME,LOGIN_ID,PASSWORD,EMAIL,STATUS)VALUES(current_timestamp,current_timestamp,'keyadmin','','keyadmin','keyadmin','a05f34d2dce2b4688fa82e82a89ba958','keyadmin',1); INSERT INTO x_portal_user_role(CREATE_TIME,UPDATE_TIME,USER_ID,USER_ROLE,STATUS)VALUES(current_timestamp,current_timestamp,3,'ROLE_KEY_ADMIN',1); INSERT INTO x_user(CREATE_TIME,UPDATE_TIME,user_name,status,descr)VALUES(current_timestamp,current_timestamp,'keyadmin',0,'keyadmin'); -COMMIT; \ No newline at end of file +COMMIT; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/db/sqlserver/xa_core_db_sqlserver.sql ---------------------------------------------------------------------- diff --git a/security-admin/db/sqlserver/xa_core_db_sqlserver.sql b/security-admin/db/sqlserver/xa_core_db_sqlserver.sql index 11c315d..74996f2 100644 --- a/security-admin/db/sqlserver/xa_core_db_sqlserver.sql +++ b/security-admin/db/sqlserver/xa_core_db_sqlserver.sql @@ -1834,6 +1834,7 @@ CREATE TABLE [dbo].[x_service_config_def] ( [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [def_id] [bigint] NOT NULL, + [item_id] [bigint] NOT NULL, [name] [varchar](1024) DEFAULT NULL NULL, [type] [varchar](1024) DEFAULT NULL NULL, [sub_type] [varchar](1024) DEFAULT NULL NULL, @@ -1868,6 +1869,7 @@ CREATE TABLE [dbo].[x_resource_def] ( [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [def_id] [bigint] NOT NULL, + [item_id] [bigint] NOT NULL, [name] [varchar](1024) DEFAULT NULL NULL, [type] [varchar](1024) DEFAULT NULL NULL, [res_level] [bigint] DEFAULT NULL NULL, @@ -1907,6 +1909,7 @@ CREATE TABLE [dbo].[x_access_type_def] ( [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [def_id] [bigint] NOT NULL, + [item_id] [bigint] NOT NULL, [name] [varchar](1024) DEFAULT NULL NULL, [label] [varchar](1024) DEFAULT NULL NULL, [rb_key_label] [varchar](1024) DEFAULT NULL NULL, @@ -1952,6 +1955,7 @@ CREATE TABLE [dbo].[x_policy_condition_def] ( [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [def_id] [bigint] NOT NULL, + [item_id] [bigint] NOT NULL, [name] [varchar](1024) DEFAULT NULL NULL, [evaluator] [varchar](1024) DEFAULT NULL NULL, [evaluator_options] [varchar](1024) DEFAULT NULL NULL, @@ -1978,6 +1982,7 @@ CREATE TABLE [dbo].[x_context_enricher_def]( [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [def_id] [bigint]NOT NULL, + [item_id] [bigint]NOT NULL, [name] [varchar](1024) DEFAULT NULL NULL, [enricher] [varchar](1024) DEFAULT NULL NULL, [enricher_options] [varchar](1024) DEFAULT NULL NULL, @@ -2002,6 +2007,7 @@ CREATE TABLE [dbo].[x_enum_def] ( [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [def_id] [bigint] NOT NULL, + [item_id] [bigint] NOT NULL, [name] [varchar](1024) DEFAULT NULL NULL, [default_index] [bigint] DEFAULT NULL NULL, PRIMARY KEY CLUSTERED @@ -2024,6 +2030,7 @@ CREATE TABLE [dbo].[x_enum_element_def] ( [added_by_id] [bigint] DEFAULT NULL NULL, [upd_by_id] [bigint] DEFAULT NULL NULL, [enum_def_id] [bigint] NOT NULL, + [item_id] [bigint] NOT NULL, [name] [varchar](1024) DEFAULT NULL NULL, [label] [varchar](1024) DEFAULT NULL NULL, [rb_key_label] [varchar](1024) DEFAULT NULL NULL, @@ -2760,4 +2767,4 @@ GO insert into x_portal_user_role (CREATE_TIME,UPDATE_TIME,USER_ID,USER_ROLE,STATUS) values (CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,3,'ROLE_KEY_ADMIN',1); GO insert into x_user (CREATE_TIME,UPDATE_TIME,user_name,status,descr) values (CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'keyadmin',0,'keyadmin'); -exit \ No newline at end of file +exit http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java b/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java index 7f83562..f9b935c 100644 --- a/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java +++ b/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java @@ -433,7 +433,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (RangerServiceConfigDef config : configs) { boolean found = false; for (XXServiceConfigDef xConfig : xxConfigs) { - if (config.getId() != null && config.getId().equals(xConfig.getId())) { + if (config.getItemId() != null && config.getItemId().equals(xConfig.getItemId())) { found = true; xConfig = serviceDefService.populateRangerServiceConfigDefToXX(config, xConfig, createdSvcDef, RangerServiceDefService.OPERATION_UPDATE_CONTEXT); @@ -453,7 +453,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (XXServiceConfigDef xConfig : xxConfigs) { boolean found = false; for (RangerServiceConfigDef config : configs) { - if (xConfig.getId() != null && xConfig.getId().equals(config.getId())) { + if (xConfig.getItemId() != null && xConfig.getItemId().equals(config.getItemId())) { found = true; break; } @@ -467,7 +467,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (RangerResourceDef resource : resources) { boolean found = false; for (XXResourceDef xRes : xxResources) { - if (resource.getId() != null && resource.getId().equals(xRes.getId())) { + if (resource.getItemId() != null && resource.getItemId().equals(xRes.getItemId())) { found = true; xRes = serviceDefService.populateRangerResourceDefToXX(resource, xRes, createdSvcDef, RangerServiceDefService.OPERATION_UPDATE_CONTEXT); @@ -490,7 +490,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (XXResourceDef xRes : xxResources) { boolean found = false; for (RangerResourceDef resource : resources) { - if (xRes.getId() != null && xRes.getId().equals(resource.getId())) { + if (xRes.getItemId() != null && xRes.getItemId().equals(resource.getItemId())) { found = true; break; } @@ -510,7 +510,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (RangerAccessTypeDef access : accessTypes) { boolean found = false; for (XXAccessTypeDef xAccess : xxAccessTypes) { - if (access.getId() != null && access.getId().equals(xAccess.getId())) { + if (access.getItemId() != null && access.getItemId().equals(xAccess.getItemId())) { found = true; xAccess = serviceDefService.populateRangerAccessTypeDefToXX(access, xAccess, createdSvcDef, RangerServiceDefService.OPERATION_UPDATE_CONTEXT); @@ -574,7 +574,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (XXAccessTypeDef xAccess : xxAccessTypes) { boolean found = false; for (RangerAccessTypeDef access : accessTypes) { - if (xAccess.getId() != null && xAccess.getId().equals(access.getId())) { + if (xAccess.getItemId() != null && xAccess.getItemId().equals(access.getItemId())) { found = true; break; } @@ -594,7 +594,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (RangerPolicyConditionDef condition : policyConditions) { boolean found = false; for (XXPolicyConditionDef xCondition : xxPolicyConditions) { - if (condition.getId() != null && condition.getId().equals(xCondition.getId())) { + if (condition.getItemId() != null && condition.getItemId().equals(xCondition.getItemId())) { found = true; xCondition = serviceDefService.populateRangerPolicyConditionDefToXX(condition, xCondition, createdSvcDef, RangerServiceDefService.OPERATION_UPDATE_CONTEXT); @@ -614,7 +614,7 @@ public class ServiceDBStore extends AbstractServiceStore { for(XXPolicyConditionDef xCondition : xxPolicyConditions) { boolean found = false; for(RangerPolicyConditionDef condition : policyConditions) { - if(xCondition.getId() != null && xCondition.getId().equals(condition.getId())) { + if(xCondition.getItemId() != null && xCondition.getItemId().equals(condition.getItemId())) { found = true; break; } @@ -638,7 +638,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (RangerContextEnricherDef context : contextEnrichers) { boolean found = false; for (XXContextEnricherDef xContext : xxContextEnrichers) { - if (context.getId() != null && context.getId().equals(xContext.getId())) { + if (context.getItemId() != null && context.getItemId().equals(xContext.getItemId())) { found = true; xContext = serviceDefService.populateRangerContextEnricherDefToXX(context, xContext, createdSvcDef, RangerServiceDefService.OPERATION_UPDATE_CONTEXT); @@ -657,7 +657,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (XXContextEnricherDef xContext : xxContextEnrichers) { boolean found = false; for (RangerContextEnricherDef context : contextEnrichers) { - if (xContext.getId() != null && xContext.getId().equals(context.getId())) { + if (xContext.getItemId() != null && xContext.getItemId().equals(context.getItemId())) { found = true; break; } @@ -671,7 +671,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (RangerEnumDef enumDef : enums) { boolean found = false; for (XXEnumDef xEnumDef : xxEnums) { - if (enumDef.getId() != null && enumDef.getId().equals(xEnumDef.getId())) { + if (enumDef.getItemId() != null && enumDef.getItemId().equals(xEnumDef.getItemId())) { found = true; xEnumDef = serviceDefService.populateRangerEnumDefToXX(enumDef, xEnumDef, createdSvcDef, RangerServiceDefService.OPERATION_UPDATE_CONTEXT); @@ -684,7 +684,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (RangerEnumElementDef eleDef : enumEleDefs) { boolean foundEle = false; for (XXEnumElementDef xEleDef : xxEnumEleDefs) { - if (eleDef.getId() != null && eleDef.getId().equals(xEleDef.getId())) { + if (eleDef.getItemId() != null && eleDef.getItemId().equals(xEleDef.getItemId())) { foundEle = true; xEleDef = serviceDefService.populateRangerEnumElementDefToXX(eleDef, xEleDef, xEnumDef, RangerServiceDefService.OPERATION_UPDATE_CONTEXT); @@ -702,7 +702,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (XXEnumElementDef xxEleDef : xxEnumEleDefs) { boolean foundEle = false; for (RangerEnumElementDef enumEle : enumEleDefs) { - if (xxEleDef.getId() != null && xxEleDef.getId().equals(enumEle.getId())) { + if (xxEleDef.getId() != null && xxEleDef.getId().equals(enumEle.getItemId())) { foundEle = true; break; } @@ -735,7 +735,7 @@ public class ServiceDBStore extends AbstractServiceStore { for (XXEnumDef xEnumDef : xxEnums) { boolean found = false; for (RangerEnumDef enumDef : enums) { - if (xEnumDef.getId() != null && xEnumDef.getId().equals(enumDef.getId())) { + if (xEnumDef.getItemId() != null && xEnumDef.getItemId().equals(enumDef.getItemId())) { found = true; break; } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/src/main/java/org/apache/ranger/entity/XXAccessTypeDef.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXAccessTypeDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXAccessTypeDef.java index ba2f2d2..72eeb1d 100644 --- a/security-admin/src/main/java/org/apache/ranger/entity/XXAccessTypeDef.java +++ b/security-admin/src/main/java/org/apache/ranger/entity/XXAccessTypeDef.java @@ -49,6 +49,15 @@ public class XXAccessTypeDef extends XXDBBase implements java.io.Serializable { protected Long defId; /** + * itemId of the XXAccessTypeDef + * <ul> + * </ul> + * + */ + @Column(name = "item_id") + protected Long itemId; + + /** * name of the XXAccessTypeDef * <ul> * </ul> @@ -125,6 +134,26 @@ public class XXAccessTypeDef extends XXDBBase implements java.io.Serializable { } /** + * This method sets the value to the member attribute <b> itemId</b> . You + * cannot set null to the attribute. + * + * @param itemId + * Value to set member attribute <b> itemId</b> + */ + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + /** + * Returns the value for the member attribute <b>itemId</b> + * + * @return Long - value of member attribute <b>itemId</b> . + */ + public Long getItemId() { + return this.itemId; + } + + /** * This method sets the value to the member attribute <b> name</b> . You * cannot set null to the attribute. * @@ -231,6 +260,13 @@ public class XXAccessTypeDef extends XXDBBase implements java.io.Serializable { } else if (!defId.equals(other.defId)) { return false; } + if (itemId == null) { + if (other.itemId != null) { + return false; + } + } else if (!itemId.equals(other.itemId)) { + return false; + } if (id == null) { if (other.id != null) { return false; @@ -277,7 +313,7 @@ public class XXAccessTypeDef extends XXDBBase implements java.io.Serializable { @Override public String toString() { return "XXAccessTypeDef [" + super.toString() + " id=" + id - + ", defId=" + defId + ", name=" + name + ", label=" + label + + ", defId=" + defId + ", itemId=" + itemId + ", name=" + name + ", label=" + label + ", rbKeyLabel=" + rbKeyLabel + ", order=" + order + "]"; } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java index 27992e4..e035e58 100644 --- a/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java +++ b/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java @@ -50,6 +50,15 @@ public class XXContextEnricherDef extends XXDBBase implements protected Long defId; /** + * itemId of the XXContextEnricherDef + * <ul> + * </ul> + * + */ + @Column(name = "item_id") + protected Long itemId; + + /** * name of the XXContextEnricherDef * <ul> * </ul> @@ -117,6 +126,26 @@ public class XXContextEnricherDef extends XXDBBase implements } /** + * Returns the value for the member attribute <b>itemId</b> + * + * @return Long - value of member attribute <b>itemId</b> . + */ + public Long getItemId() { + return this.itemId; + } + + /** + * This method sets the value to the member attribute <b> defId</b> . You + * cannot set null to the attribute. + * + * @param defId + * Value to set member attribute <b> defId</b> + */ + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + /** * Returns the value for the member attribute <b>defId</b> * * @return Date - value of member attribute <b>defId</b> . @@ -232,6 +261,13 @@ public class XXContextEnricherDef extends XXDBBase implements } else if (!defId.equals(other.defId)) { return false; } + if (itemId == null) { + if (other.itemId != null) { + return false; + } + } else if (!itemId.equals(other.itemId)) { + return false; + } if (enricher == null) { if (other.enricher != null) { return false; @@ -277,7 +313,7 @@ public class XXContextEnricherDef extends XXDBBase implements */ @Override public String toString() { - return "XXContextEnricherDef [id=" + id + ", defId=" + defId + return "XXContextEnricherDef [id=" + id + ", defId=" + defId + ", itemId=" + itemId + ", name=" + name + ", enricher=" + enricherOptions + ", enricherOptions=" + enricherOptions + ", order=" + order + "]"; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/src/main/java/org/apache/ranger/entity/XXEnumDef.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXEnumDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXEnumDef.java index aea4f3e..7deccd3 100644 --- a/security-admin/src/main/java/org/apache/ranger/entity/XXEnumDef.java +++ b/security-admin/src/main/java/org/apache/ranger/entity/XXEnumDef.java @@ -49,6 +49,15 @@ public class XXEnumDef extends XXDBBase implements java.io.Serializable { protected Long defId; /** + * itemId of the XXEnumDef + * <ul> + * </ul> + * + */ + @Column(name = "item_id") + protected Long itemId; + + /** * name of the XXEnumDef * <ul> * </ul> @@ -107,6 +116,26 @@ public class XXEnumDef extends XXDBBase implements java.io.Serializable { } /** + * This method sets the value to the member attribute <b> itemId</b> . You + * cannot set null to the attribute. + * + * @param defId + * Value to set member attribute <b> itemId</b> + */ + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + /** + * Returns the value for the member attribute <b>itemId</b> + * + * @return Long - value of member attribute <b>itemId</b> . + */ + public Long getItemId() { + return this.itemId; + } + + /** * This method sets the value to the member attribute <b> name</b> . You * cannot set null to the attribute. * @@ -173,6 +202,13 @@ public class XXEnumDef extends XXDBBase implements java.io.Serializable { } else if (!defId.equals(other.defId)) { return false; } + if (itemId == null) { + if (other.itemId != null) { + return false; + } + } else if (!itemId.equals(other.itemId)) { + return false; + } if (defaultIndex == null) { if (other.defaultIndex != null) { return false; @@ -205,7 +241,7 @@ public class XXEnumDef extends XXDBBase implements java.io.Serializable { @Override public String toString() { return "XXEnumDef [" + super.toString() + " id=" + id + ", defId=" - + defId + ", name=" + name + ", defaultIndex=" + defaultIndex + + defId + ", itemId=" + itemId + ", name=" + name + ", defaultIndex=" + defaultIndex + "]"; } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java index a4532f5..99dd689 100644 --- a/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java +++ b/security-admin/src/main/java/org/apache/ranger/entity/XXEnumElementDef.java @@ -49,6 +49,15 @@ public class XXEnumElementDef extends XXDBBase implements java.io.Serializable { protected Long enumDefId; /** + * itemId of the XXEnumDefElement + * <ul> + * </ul> + * + */ + @Column(name = "item_id") + protected Long itemId; + + /** * name of the XXEnumDefElement * <ul> * </ul> @@ -125,6 +134,26 @@ public class XXEnumElementDef extends XXDBBase implements java.io.Serializable { } /** + * This method sets the value to the member attribute <b> itemId</b> . + * You cannot set null to the attribute. + * + * @param itemId + * Value to set member attribute <b> itemId</b> + */ + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + /** + * Returns the value for the member attribute <b>itemId</b> + * + * @return Long - value of member attribute <b>itemId</b> . + */ + public Long getItemId() { + return this.itemId; + } + + /** * This method sets the value to the member attribute <b> name</b> . You * cannot set null to the attribute. * @@ -277,7 +306,7 @@ public class XXEnumElementDef extends XXDBBase implements java.io.Serializable { @Override public String toString() { return "XXEnumElementDef [" + super.toString() + " id=" + id - + ", enumDefId=" + enumDefId + ", name=" + name + ", label=" + + ", enumDefId=" + enumDefId + "itemId=" + itemId + ", name=" + name + ", label=" + label + ", rbKeyLabel=" + rbKeyLabel + ", order=" + order + "]"; } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8cedfa55/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyConditionDef.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyConditionDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyConditionDef.java index b9e73c4..d738841 100644 --- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyConditionDef.java +++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyConditionDef.java @@ -51,6 +51,15 @@ public class XXPolicyConditionDef extends XXDBBase implements protected Long defId; /** + * itemId of the XXPolicyConditionDef + * <ul> + * </ul> + * + */ + @Column(name = "item_id") + protected Long itemId; + + /** * name of the XXPolicyConditionDef * <ul> * </ul> @@ -190,6 +199,26 @@ public class XXPolicyConditionDef extends XXDBBase implements } /** + * Returns the value for the member attribute <b>itemId</b> + * + * @return Long - value of member attribute <b>itemId</b> . + */ + public Long getItemId() { + return this.itemId; + } + + /** + * This method sets the value to the member attribute <b> itemId</b> . You + * cannot set null to the attribute. + * + * @param itemId + * Value to set member attribute <b> itemId</b> + */ + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + /** * Returns the value for the member attribute <b>defId</b> * * @return Date - value of member attribute <b>defId</b> . @@ -441,6 +470,13 @@ public class XXPolicyConditionDef extends XXDBBase implements } else if (!defId.equals(other.defId)) { return false; } + if (itemId == null) { + if (other.itemId != null) { + return false; + } + } else if (!itemId.equals(other.itemId)) { + return false; + } if (description == null) { if (other.description != null) { return false; @@ -522,7 +558,7 @@ public class XXPolicyConditionDef extends XXDBBase implements */ @Override public String toString() { - return "XXPolicyConditionDef [id=" + id + ", defId=" + defId + return "XXPolicyConditionDef [id=" + id + ", defId=" + defId + ", itemId=" + itemId + ", name=" + name + ", evaluator=" + evaluator + ", evaluatorOptions=" + evaluatorOptions + ", label=" + label + ", validationRegEx=" + validationRegEx
