This is an automated email from the ASF dual-hosted git repository.
mehul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push:
new 72bccb3 RANGER-2590 : add displayName attribute to service-def and
service
72bccb3 is described below
commit 72bccb365ef3b473444c10c1c6f802100ed5c242
Author: Kishor Gollapalliwar <[email protected]>
AuthorDate: Thu Nov 7 11:40:22 2019 +0530
RANGER-2590 : add displayName attribute to service-def and service
Signed-off-by: Mehul Parikh <[email protected]>
---
.../ranger/plugin/errors/ValidationErrorCode.java | 4 ++
.../apache/ranger/plugin/model/RangerService.java | 11 ++++
.../ranger/plugin/model/RangerServiceDef.java | 20 +++++++
.../model/validation/RangerServiceDefHelper.java | 2 +-
.../validation/RangerServiceDefValidator.java | 55 ++++++++++++++++++-
.../model/validation/RangerServiceValidator.java | 35 ++++++++++++-
.../plugin/model/validation/RangerValidator.java | 45 ++++++++++++++--
.../apache/ranger/plugin/store/ServiceStore.java | 4 ++
.../apache/ranger/plugin/util/SearchFilter.java | 4 ++
.../service-defs/ranger-servicedef-abfs.json | 1 +
.../service-defs/ranger-servicedef-atlas.json | 1 +
.../ranger-servicedef-elasticsearch.json | 1 +
.../service-defs/ranger-servicedef-hbase.json | 1 +
.../service-defs/ranger-servicedef-hdfs.json | 1 +
.../service-defs/ranger-servicedef-hive.json | 1 +
.../service-defs/ranger-servicedef-kafka.json | 1 +
.../service-defs/ranger-servicedef-kms.json | 1 +
.../service-defs/ranger-servicedef-knox.json | 1 +
.../service-defs/ranger-servicedef-kylin.json | 1 +
.../ranger-servicedef-nifi-registry.json | 1 +
.../service-defs/ranger-servicedef-nifi.json | 1 +
.../service-defs/ranger-servicedef-ozone.json | 1 +
.../service-defs/ranger-servicedef-presto.json | 1 +
.../service-defs/ranger-servicedef-solr.json | 1 +
.../service-defs/ranger-servicedef-sqoop.json | 1 +
.../service-defs/ranger-servicedef-storm.json | 1 +
.../service-defs/ranger-servicedef-tag.json | 1 +
.../service-defs/ranger-servicedef-wasb.json | 1 +
.../service-defs/ranger-servicedef-yarn.json | 1 +
.../validation/TestRangerServiceValidator.java | 9 ++--
.../optimized/current/ranger_core_db_mysql.sql | 7 +++
...playName-col-in-x_service_def_and_x_service.sql | 37 +++++++++++++
...ributes-col-in-x_user-x_portal_user-x_group.sql | 38 ++++++++++++++
.../optimized/current/ranger_core_db_oracle.sql | 7 +++
...playName-col-in-x_service_def_and_x_service.sql | 33 ++++++++++++
...ributes-col-in-x_user-x_portal_user-x_group.sql | 36 +++++++++++++
.../optimized/current/ranger_core_db_postgres.sql | 7 +++
...playName-col-in-x_service_def_and_x_service.sql | 40 ++++++++++++++
...ributes-col-in-x_user-x_portal_user-x_group.sql | 42 +++++++++++++++
.../current/ranger_core_db_sqlanywhere.sql | 9 ++++
...playName-col-in-x_service_def_and_x_service.sql | 27 ++++++++++
...ributes-col-in-x_user-x_portal_user-x_group.sql | 28 ++++++++++
.../optimized/current/ranger_core_db_sqlserver.sql | 9 +++-
...playName-col-in-x_service_def_and_x_service.sql | 30 +++++++++++
...ributes-col-in-x_user-x_portal_user-x_group.sql | 32 ++++++++++++
.../java/org/apache/ranger/biz/ServiceDBStore.java | 44 ++++++++++++++++
.../org/apache/ranger/common/RangerSearchUtil.java | 3 ++
.../java/org/apache/ranger/db/XXServiceDao.java | 13 +++++
.../java/org/apache/ranger/db/XXServiceDefDao.java | 17 ++++++
.../java/org/apache/ranger/entity/XXGroup.java | 26 ++++++++-
.../org/apache/ranger/entity/XXPortalUser.java | 27 ++++++++++
.../org/apache/ranger/entity/XXServiceBase.java | 18 ++++++-
.../org/apache/ranger/entity/XXServiceDefBase.java | 30 ++++++++++-
.../main/java/org/apache/ranger/entity/XXUser.java | 26 +++++++++
.../java/org/apache/ranger/rest/ServiceREST.java | 61 ++++++++++++++++++++--
.../service/RangerServiceDefServiceBase.java | 18 ++++---
.../ranger/service/RangerServiceService.java | 1 +
.../ranger/service/RangerServiceServiceBase.java | 12 +++--
.../apache/ranger/service/XGroupServiceBase.java | 2 +
.../ranger/service/XPortalUserServiceBase.java | 2 +
.../apache/ranger/service/XUserServiceBase.java | 2 +
.../main/java/org/apache/ranger/view/VXGroup.java | 24 ++++++++-
.../java/org/apache/ranger/view/VXPortalUser.java | 24 +++++++++
.../main/java/org/apache/ranger/view/VXUser.java | 22 ++++++++
.../main/resources/META-INF/jpa_named_queries.xml | 10 +++-
.../main/webapp/scripts/models/RangerServiceDef.js | 5 ++
.../views/service/RangerServiceViewDetail.js | 1 +
.../webapp/scripts/views/service/ServiceForm.js | 4 +-
.../common/ServiceManagerLayout_tmpl.html | 2 +-
.../src/main/webapp/templates/helpers/XAHelpers.js | 10 +++-
.../service/RangerServiceViewDetail_tmpl.html | 8 +++
.../org/apache/ranger/rest/TestServiceREST.java | 1 +
72 files changed, 969 insertions(+), 35 deletions(-)
diff --git
a/agents-common/src/main/java/org/apache/ranger/plugin/errors/ValidationErrorCode.java
b/agents-common/src/main/java/org/apache/ranger/plugin/errors/ValidationErrorCode.java
index 2927362..1498505 100644
---
a/agents-common/src/main/java/org/apache/ranger/plugin/errors/ValidationErrorCode.java
+++
b/agents-common/src/main/java/org/apache/ranger/plugin/errors/ValidationErrorCode.java
@@ -34,7 +34,9 @@ public enum ValidationErrorCode {
SERVICE_VALIDATION_ERR_INVALID_SERVICE_ID(1005, "No service found for id
[{0}]"),
SERVICE_VALIDATION_ERR_INVALID_SERVICE_NAME(1006, "Missing service name"),
SERVICE_VALIDATION_ERR_SERVICE_NAME_CONFICT(1007, "Duplicate service name:
name=[{0}]"),
+ SERVICE_VALIDATION_ERR_SERVICE_DISPLAY_NAME_CONFICT(3051,"Display name
[{0}] is already used by service [{1}]"),
SERVICE_VALIDATION_ERR_SPECIAL_CHARACTERS_SERVICE_NAME(3031, "Name should
not start with space, it should be less than 256 characters and special
characters are not allowed(except _ - and space). : name=[{0}]"),
+ SERVICE_VALIDATION_ERR_SPECIAL_CHARACTERS_SERVICE_DISPLAY_NAME(3050,
"Invalid display name [{0}]. It should be not be longer than 256 characters,
should not start with space, and should not include special characters (except
underscore, hyphen and space)"),
SERVICE_VALIDATION_ERR_ID_NAME_CONFLICT(1008, "Duplicate service name:
name=[{0}], id=[{1}]"),
SERVICE_VALIDATION_ERR_MISSING_SERVICE_DEF(1009, "Missing service def"),
SERVICE_VALIDATION_ERR_INVALID_SERVICE_DEF(1010, "Service def not found:
service-def-name=[{0}]"),
@@ -47,7 +49,9 @@ public enum ValidationErrorCode {
SERVICE_DEF_VALIDATION_ERR_EMPTY_SERVICE_DEF_ID(2004, "Internal error:
service def id was null/empty/blank"),
SERVICE_DEF_VALIDATION_ERR_INVALID_SERVICE_DEF_ID(2005, "No service def
found for id [{0}]"),
SERVICE_DEF_VALIDATION_ERR_INVALID_SERVICE_DEF_NAME(2006, "Service def
name[{0}] was null/empty/blank"),
+ SERVICE_DEF_VALIDATION_ERR_INVALID_SERVICE_DEF_DISPLAY_NAME(2024, "Service
def display name[{0}] was null/empty/blank"),
SERVICE_DEF_VALIDATION_ERR_SERVICE_DEF_NAME_CONFICT(2007, "service def
with the name[{0}] already exists"),
+ SERVICE_DEF_VALIDATION_ERR_SERVICE_DEF__DISPLAY_NAME_CONFICT(2025,
"Display name [{0}] is already used by service def [{1}]"),
SERVICE_DEF_VALIDATION_ERR_ID_NAME_CONFLICT(2008, "id/name conflict:
another service def already exists with name[{0}], its id is [{1}]"),
SERVICE_DEF_VALIDATION_ERR_IMPLIED_GRANT_UNKNOWN_ACCESS_TYPE(2009,
"implied grant[{0}] contains an unknown access types[{1}]"),
SERVICE_DEF_VALIDATION_ERR_IMPLIED_GRANT_IMPLIES_ITSELF(2010, "implied
grants list [{0}] for access type[{1}] contains itself"),
diff --git
a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerService.java
b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerService.java
index ed8d384..8bd4586 100644
---
a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerService.java
+++
b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerService.java
@@ -43,6 +43,7 @@ public class RangerService extends RangerBaseModelObject
implements java.io.Seri
private String type;
private String name;
+ private String displayName;
private String description;
private String tagService;
private Map<String, String> configs;
@@ -84,6 +85,7 @@ public class RangerService extends RangerBaseModelObject
implements java.io.Seri
setType(other.getType());
setName(other.getName());
+ setDisplayName(other.getDisplayName());
setDescription(other.getDescription());
setConfigs(other.getConfigs());
setTagService(other.tagService);
@@ -117,6 +119,14 @@ public class RangerService extends RangerBaseModelObject
implements java.io.Seri
this.name = name;
}
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
/**
* @return the description
*/
@@ -244,6 +254,7 @@ public class RangerService extends RangerBaseModelObject
implements java.io.Seri
super.toString(sb);
sb.append("name={").append(name).append("} ");
+ sb.append("displayName={").append(displayName).append("} ");
sb.append("type={").append(type).append("} ");
sb.append("description={").append(description).append("} ");
sb.append("tagService={").append(tagService).append("} ");
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 50d84a4..1ac45f1 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
@@ -48,6 +48,7 @@ public class RangerServiceDef extends RangerBaseModelObject
implements java.io.S
public static final String
OPTION_ENABLE_DENY_AND_EXCEPTIONS_IN_POLICIES =
"enableDenyAndExceptionsInPolicies";
private String name;
+ private String displayName;
private String implClass;
private String label;
private String description;
@@ -103,6 +104,15 @@ public class RangerServiceDef extends
RangerBaseModelObject implements java.io.S
setRowFilterDef(rowFilterDef);
}
+ public RangerServiceDef(String name, String displayName, String
implClass, String label, String description,
+ Map<String, String> options,
List<RangerServiceConfigDef> configs,
+ List<RangerResourceDef> modifiedResourceDefs,
List<RangerAccessTypeDef> accessTypes,
+ List<RangerPolicyConditionDef> policyConditions,
List<RangerContextEnricherDef> contextEnrichers,
+ List<RangerEnumDef> enums) {
+ this(name, implClass, label, description, options, configs,
modifiedResourceDefs, accessTypes, policyConditions, contextEnrichers, enums);
+ this.setDisplayName(displayName);
+ }
+
/**
* @param other
*/
@@ -110,6 +120,7 @@ public class RangerServiceDef extends RangerBaseModelObject
implements java.io.S
super.updateFrom(other);
setName(other.getName());
+ setDisplayName(other.getDisplayName());
setImplClass(other.getImplClass());
setLabel(other.getLabel());
setDescription(other.getDescription());
@@ -405,6 +416,14 @@ public class RangerServiceDef extends
RangerBaseModelObject implements java.io.S
this.rowFilterDef = rowFilterDef == null ? new
RangerRowFilterDef() : rowFilterDef;
}
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
@Override
public String toString( ) {
StringBuilder sb = new StringBuilder();
@@ -420,6 +439,7 @@ public class RangerServiceDef extends RangerBaseModelObject
implements java.io.S
super.toString(sb);
sb.append("name={").append(name).append("} ");
+ sb.append("displayName={").append(displayName).append("} ");
sb.append("implClass={").append(implClass).append("} ");
sb.append("label={").append(label).append("} ");
sb.append("description={").append(description).append("} ");
diff --git
a/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefHelper.java
b/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefHelper.java
index 0954beb..943b361 100644
---
a/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefHelper.java
+++
b/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefHelper.java
@@ -77,7 +77,7 @@ public class RangerServiceDefHelper {
modifiedResourceDefs.add(modifiedResourceDef);
}
- return new RangerServiceDef(serviceDef.getName(),
serviceDef.getImplClass(), serviceDef.getLabel(),
+ return new RangerServiceDef(serviceDef.getName(),
serviceDef.getDisplayName(), serviceDef.getImplClass(), serviceDef.getLabel(),
serviceDef.getDescription(),
serviceDef.getOptions(), serviceDef.getConfigs(), modifiedResourceDefs,
serviceDef.getAccessTypes(),
serviceDef.getPolicyConditions(),
serviceDef.getContextEnrichers(), serviceDef.getEnums());
}
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 f96fcfc..8a21f4d 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
@@ -139,6 +139,7 @@ public class RangerServiceDefValidator extends
RangerValidator {
Long id = serviceDef.getId();
valid = isValidServiceDefId(id, action, failures) &&
valid;
valid = isValidServiceDefName(serviceDef.getName(), id,
action, failures) && valid;
+ valid =
isValidServiceDefDisplayName(serviceDef.getDisplayName(), id, action, failures)
&& valid;
valid = isValidAccessTypes(serviceDef.getId(),
serviceDef.getAccessTypes(), failures, action) && valid;
if (isValidResources(serviceDef, failures, action)) {
// Semantic check of resource graph can only be
done if resources are "syntactically" valid
@@ -240,7 +241,59 @@ public class RangerServiceDefValidator extends
RangerValidator {
}
return valid;
}
-
+
+ /**
+ * Performs all validations related to ServiceDef displayName.
+ * @param displayName
+ * @param id
+ * @param action
+ * @param failures
+ * @return
+ */
+ boolean isValidServiceDefDisplayName(final String displayName, Long id,
final Action action, final List<ValidationFailureDetails> failures) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug(String.format("==>
RangerServiceDefValidator.isValidServiceDefDisplayName(%s, %s, %s, %s)",
displayName, id, action, failures));
+ }
+ boolean valid = true;
+
+ if (StringUtils.isBlank(displayName)) {
+ ValidationErrorCode error =
ValidationErrorCode.SERVICE_DEF_VALIDATION_ERR_INVALID_SERVICE_DEF_DISPLAY_NAME;
+ failures.add(new ValidationFailureDetailsBuilder()
+ .field("displayName")
+ .isMissing()
+ .errorCode(error.getErrorCode())
+
.becauseOf(error.getMessage(displayName))
+ .build());
+ valid = false;
+ } else {
+ RangerServiceDef otherServiceDef =
getServiceDefByDisplayName(displayName);
+ if (otherServiceDef != null && action == Action.CREATE)
{
+ ValidationErrorCode error =
ValidationErrorCode.SERVICE_DEF_VALIDATION_ERR_SERVICE_DEF__DISPLAY_NAME_CONFICT;
+ failures.add(new
ValidationFailureDetailsBuilder()
+ .field("displayName")
+ .isSemanticallyIncorrect()
+ .errorCode(error.getErrorCode())
+
.becauseOf(error.getMessage(displayName, otherServiceDef.getName()))
+ .build());
+ valid = false;
+ } else if (otherServiceDef != null &&
!Objects.equals(id, otherServiceDef.getId())) {
+ ValidationErrorCode error =
ValidationErrorCode.SERVICE_DEF_VALIDATION_ERR_SERVICE_DEF__DISPLAY_NAME_CONFICT;
+ failures.add(new
ValidationFailureDetailsBuilder()
+ .field("id/displayName")
+ .isSemanticallyIncorrect()
+ .errorCode(error.getErrorCode())
+
.becauseOf(error.getMessage(displayName, otherServiceDef.getName()))
+ .build());
+ valid = false;
+ }
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug(String.format("<==
RangerServiceDefValidator.isValidServiceDefName(%s, %s, %s, %s): %s",
displayName, id, action, failures, valid));
+ }
+ return valid;
+ }
+
boolean isValidAccessTypes(final Long serviceDefId, final
List<RangerAccessTypeDef> accessTypeDefs,
final
List<ValidationFailureDetails> failures, final Action action) {
if(LOG.isDebugEnabled()) {
diff --git
a/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceValidator.java
b/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceValidator.java
index 9b5d8d5..aa8cf7e 100644
---
a/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceValidator.java
+++
b/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceValidator.java
@@ -47,7 +47,6 @@ public class RangerServiceValidator extends RangerValidator {
if(LOG.isDebugEnabled()) {
LOG.debug(String.format("==>
RangerServiceValidator.validate(%s, %s)", service, action));
}
-
List<ValidationFailureDetails> failures = new ArrayList<>();
boolean valid = isValid(service, action, failures);
String message = "";
@@ -184,6 +183,40 @@ public class RangerServiceValidator extends
RangerValidator {
}
}
}
+ // Display name
+ String displayName = service.getDisplayName();
+ if(!validateString(VALIDATION_SERVICE_NAME,
displayName)){
+ ValidationErrorCode error =
ValidationErrorCode.SERVICE_VALIDATION_ERR_SPECIAL_CHARACTERS_SERVICE_DISPLAY_NAME;
+ failures.add(new
ValidationFailureDetailsBuilder()
+ .field("displayName")
+ .isSemanticallyIncorrect()
+ .errorCode(error.getErrorCode())
+
.becauseOf(error.getMessage(displayName))
+ .build());
+ valid = false;
+ }else{
+ RangerService otherService =
getServiceByDisplayName(displayName);
+ if (otherService != null && action ==
Action.CREATE) {
+ ValidationErrorCode error =
ValidationErrorCode.SERVICE_VALIDATION_ERR_SERVICE_DISPLAY_NAME_CONFICT;
+ failures.add(new
ValidationFailureDetailsBuilder()
+ .field("displayName")
+
.isSemanticallyIncorrect()
+
.errorCode(error.getErrorCode())
+
.becauseOf(error.getMessage(displayName, otherService.getName()))
+ .build());
+ valid = false;
+ } else if (otherService != null &&
otherService.getId() !=null && !otherService.getId().equals(id)) {
+ ValidationErrorCode error =
ValidationErrorCode.SERVICE_VALIDATION_ERR_SERVICE_DISPLAY_NAME_CONFICT;
+ failures.add(new
ValidationFailureDetailsBuilder()
+ .field("id/displayName")
+
.isSemanticallyIncorrect()
+
.errorCode(error.getErrorCode())
+
.becauseOf(error.getMessage(displayName, otherService.getName()))
+ .build());
+ valid = false;
+ }
+ }
+
String type = service.getType();
boolean typeSpecified = StringUtils.isNotBlank(type);
if (!typeSpecified) {
diff --git
a/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerValidator.java
b/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerValidator.java
index c4ec63b..b02090b 100644
---
a/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerValidator.java
+++
b/agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerValidator.java
@@ -210,7 +210,7 @@ public abstract class RangerValidator {
}
RangerServiceDef getServiceDef(String type) {
-
+
if(LOG.isDebugEnabled()) {
LOG.debug("==> RangerValidator.getServiceDef(" + type +
")");
}
@@ -227,8 +227,30 @@ public abstract class RangerValidator {
return result;
}
+ /**
+ * @param displayName
+ * @return {@link RangerServiceDef} - service using display name if
present, <code>null</code> otherwise.
+ */
+ RangerServiceDef getServiceDefByDisplayName(final String displayName) {
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==>
RangerValidator.getServiceDefByDisplayName(" + displayName + ")");
+ }
+ RangerServiceDef result = null;
+ try {
+ result = _store.getServiceDefByDisplayName(displayName);
+ } catch (Exception e) {
+ LOG.debug("Encountered exception while retrieving
service definition from service store!", e);
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<==
RangerValidator.getServiceDefByDisplayName(" + displayName + "): " + result);
+ }
+ return result;
+ }
+
RangerService getService(Long id) {
-
+
if(LOG.isDebugEnabled()) {
LOG.debug("==> RangerValidator.getService(" + id + ")");
}
@@ -263,6 +285,23 @@ public abstract class RangerValidator {
return result;
}
+ RangerService getServiceByDisplayName(final String displayName) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> RangerValidator.getService(" +
displayName + ")");
+ }
+ RangerService result = null;
+ try {
+ result = _store.getServiceByDisplayName(displayName);
+ } catch (Exception e) {
+ LOG.debug("Encountred exception while retrieving
service from service store!", e);
+ }
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("<== RangerValidator.getService(" +
displayName + "): " + result);
+ }
+ return result;
+ }
+
boolean policyExists(Long id) {
try {
return _store.policyExists(id);
@@ -273,7 +312,7 @@ public abstract class RangerValidator {
}
RangerPolicy getPolicy(Long id) {
-
+
if(LOG.isDebugEnabled()) {
LOG.debug("==> RangerValidator.getPolicy(" + id + ")");
}
diff --git
a/agents-common/src/main/java/org/apache/ranger/plugin/store/ServiceStore.java
b/agents-common/src/main/java/org/apache/ranger/plugin/store/ServiceStore.java
index 4af457e..67778ef 100644
---
a/agents-common/src/main/java/org/apache/ranger/plugin/store/ServiceStore.java
+++
b/agents-common/src/main/java/org/apache/ranger/plugin/store/ServiceStore.java
@@ -47,6 +47,8 @@ public interface ServiceStore {
RangerServiceDef getServiceDefByName(String name) throws Exception;
+ RangerServiceDef getServiceDefByDisplayName(String name) throws
Exception;
+
List<RangerServiceDef> getServiceDefs(SearchFilter filter) throws
Exception;
PList<RangerServiceDef> getPaginatedServiceDefs(SearchFilter filter)
throws Exception;
@@ -61,6 +63,8 @@ public interface ServiceStore {
RangerService getServiceByName(String name) throws Exception;
+ RangerService getServiceByDisplayName(String displayName) throws
Exception;
+
List<RangerService> getServices(SearchFilter filter) throws Exception;
PList<RangerService> getPaginatedServices(SearchFilter filter) throws
Exception;
diff --git
a/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java
b/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java
index 93b28a8..c17c63b 100644
---
a/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java
+++
b/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java
@@ -89,6 +89,10 @@ public class SearchFilter {
public static final String FETCH_ZONE_UNZONE_POLICIES =
"fetchZoneAndUnzonePolicies";
public static final String FETCH_TAG_POLICIES =
"fetchTagPolicies";
+ public static final String SERVICE_DISPLAY_NAME =
"serviceDisplayName"; // search, sort
+ public static final String SERVICE_DISPLAY_NAME_PARTIAL =
"serviceDisplayNamePartial"; // search
+ public static final String SERVICE_TYPE_DISPLAY_NAME =
"serviceTypeDisplayName"; // search, sort
+
private Map<String, String> params;
private int startIndex;
private int maxRows = Integer.MAX_VALUE;
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-abfs.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-abfs.json
index 18454de..7dcf388 100644
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-abfs.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-abfs.json
@@ -1,6 +1,7 @@
{
"id":103,
"name": "abfs",
+ "displayName": "abfs",
"implClass": "",
"label": "Azure Blob File System",
"description": "Ranger plugin for ABFS",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-atlas.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-atlas.json
index 07a9800..7a6f0b9 100644
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-atlas.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-atlas.json
@@ -1,6 +1,7 @@
{
"id": 15,
"name": "atlas",
+ "displayName": "atlas",
"implClass": "org.apache.ranger.services.atlas.RangerServiceAtlas",
"label": "Atlas Metadata Server",
"description": "Atlas Metadata Server",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-elasticsearch.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-elasticsearch.json
index b055bf8..da621c7 100644
---
a/agents-common/src/main/resources/service-defs/ranger-servicedef-elasticsearch.json
+++
b/agents-common/src/main/resources/service-defs/ranger-servicedef-elasticsearch.json
@@ -1,6 +1,7 @@
{
"id":16,
"name": "elasticsearch",
+ "displayName": "elasticsearch",
"implClass":
"org.apache.ranger.services.elasticsearch.RangerServiceElasticsearch",
"label": "ELASTICSEARCH",
"description": "ELASTICSEARCH",
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 71fae66..f98c919 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
@@ -1,6 +1,7 @@
{
"id":2,
"name": "hbase",
+ "displayName": "hbase",
"implClass": "org.apache.ranger.services.hbase.RangerServiceHBase",
"label": "HBase",
"description": "HBase",
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 2e5d07c..fbb16d7 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
@@ -1,6 +1,7 @@
{
"id":1,
"name": "hdfs",
+ "displayName": "hdfs",
"implClass": "org.apache.ranger.services.hdfs.RangerServiceHdfs",
"label": "HDFS Repository",
"description": "HDFS Repository",
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 5722e09..42df0a8 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
@@ -1,6 +1,7 @@
{
"id":3,
"name": "hive",
+ "displayName": "Hadoop SQL",
"implClass": "org.apache.ranger.services.hive.RangerServiceHive",
"label": "Hive Server2",
"description": "Hive Server2",
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 800b123..38bc31c 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
@@ -1,6 +1,7 @@
{
"id":9,
"name":"kafka",
+ "displayName": "kafka",
"implClass":"org.apache.ranger.services.kafka.RangerServiceKafka",
"label":"Kafka",
"description":"Apache Kafka",
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 f96cb9c..5a2915c 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
@@ -1,6 +1,7 @@
{
"id":7,
"name": "kms",
+ "displayName": "kms",
"implClass": "org.apache.ranger.services.kms.RangerServiceKMS",
"label": "KMS",
"description": "KMS",
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 495a699..aa0f672 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
@@ -1,6 +1,7 @@
{
"id":5,
"name": "knox",
+ "displayName": "knox",
"implClass": "org.apache.ranger.services.knox.RangerServiceKnox",
"label": "Knox Gateway",
"description": "Knox Gateway",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-kylin.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-kylin.json
index a6e76a0..70566df 100644
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-kylin.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-kylin.json
@@ -1,6 +1,7 @@
{
"id":12,
"name": "kylin",
+ "displayName": "kylin",
"implClass": "org.apache.ranger.services.kylin.RangerServiceKylin",
"label": "KYLIN",
"description": "KYLIN",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi-registry.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi-registry.json
index ef5f7cf..bf2768a 100644
---
a/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi-registry.json
+++
b/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi-registry.json
@@ -1,6 +1,7 @@
{
"id":13,
"name":"nifi-registry",
+ "displayName": "nifi-registry",
"implClass":"org.apache.ranger.services.nifi.registry.RangerServiceNiFiRegistry",
"label":"NIFI Registry",
"description":"NiFi Registry",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json
index 400e516..c34533e 100644
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-nifi.json
@@ -1,6 +1,7 @@
{
"id":10,
"name":"nifi",
+ "displayName": "nifi",
"implClass":"org.apache.ranger.services.nifi.RangerServiceNiFi",
"label":"NIFI",
"description":"NiFi",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-ozone.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-ozone.json
index 5787d93..4f2a432 100755
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-ozone.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-ozone.json
@@ -1,6 +1,7 @@
{
"id":201,
"name": "ozone",
+ "displayName": "ozone",
"implClass": "org.apache.ranger.services.ozone.RangerServiceOzone",
"label": "OZONE",
"description": "Ozone Repository",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-presto.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-presto.json
index 151c7d2..56a8f5a 100644
---
a/agents-common/src/main/resources/service-defs/ranger-servicedef-presto.json
+++
b/agents-common/src/main/resources/service-defs/ranger-servicedef-presto.json
@@ -1,6 +1,7 @@
{
"id": 17,
"name": "presto",
+ "displayName": "presto",
"implClass": "org.apache.ranger.services.presto.RangerServicePresto",
"label": "Presto",
"description": "Presto",
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 2f12721..ec2ebcf 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
@@ -1,6 +1,7 @@
{
"id":8,
"name":"solr",
+ "displayName": "solr",
"implClass":"org.apache.ranger.services.solr.RangerServiceSolr",
"label":"SOLR",
"description":"Solr",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-sqoop.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-sqoop.json
index 8cff9ab..544276e 100644
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-sqoop.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-sqoop.json
@@ -1,6 +1,7 @@
{
"id":14,
"name": "sqoop",
+ "displayName": "sqoop",
"implClass": "org.apache.ranger.services.sqoop.RangerServiceSqoop",
"label": "SQOOP",
"description": "SQOOP",
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 03c1574..4db4a74 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
@@ -1,6 +1,7 @@
{
"id":6,
"name": "storm",
+ "displayName": "storm",
"implClass": "org.apache.ranger.services.storm.RangerServiceStorm",
"label": "Storm",
"description": "Storm",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-tag.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-tag.json
index c17b750..7b72f45 100644
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-tag.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-tag.json
@@ -1,6 +1,7 @@
{
"id":100,
"name": "tag",
+ "displayName": "tag",
"implClass": "org.apache.ranger.services.tag.RangerServiceTag",
"label": "TAG",
"description": "TAG Service Definition",
diff --git
a/agents-common/src/main/resources/service-defs/ranger-servicedef-wasb.json
b/agents-common/src/main/resources/service-defs/ranger-servicedef-wasb.json
index 946b662..fd30c51 100644
--- a/agents-common/src/main/resources/service-defs/ranger-servicedef-wasb.json
+++ b/agents-common/src/main/resources/service-defs/ranger-servicedef-wasb.json
@@ -1,6 +1,7 @@
{
"id":101,
"name": "wasb",
+ "displayName": "wasb",
"implClass": "",
"label": "WASB File System",
"description": "Ranger plugin for WASB File System",
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 a32c08d..968f49e 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
@@ -1,6 +1,7 @@
{
"id":4,
"name": "yarn",
+ "displayName": "yarn",
"implClass": "org.apache.ranger.services.yarn.RangerServiceYarn",
"label": "YARN",
"description": "YARN",
diff --git
a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.java
b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.java
index c271dd9..02216b6 100644
---
a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.java
+++
b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.java
@@ -72,14 +72,15 @@ public class TestRangerServiceValidator {
break;
}
}
-
+
@Test
public void testIsValidServiceNameCreationWithOutSpecialCharacters()
throws Exception{
RangerService rangerService = new RangerService();
rangerService.setName("c1_yarn");
+ rangerService.setDisplayName("c1_yarn");
rangerService.setType("yarn");
rangerService.setTagService("");
-
+
RangerServiceConfigDef configDef = new RangerServiceConfigDef();
configDef.setMandatory(true);
@@ -110,9 +111,10 @@ public class TestRangerServiceValidator {
RangerService rangerService = new RangerService();
rangerService.setId(1L);
rangerService.setName("c1_yarn");
+ rangerService.setDisplayName("c1_yarn");
rangerService.setType("yarn");
rangerService.setTagService("");
-
+
RangerServiceConfigDef configDef = new RangerServiceConfigDef();
configDef.setMandatory(true);
@@ -387,6 +389,7 @@ public class TestRangerServiceValidator {
// create a service with some parameters on it
RangerService service = mock(RangerService.class);
when(service.getName()).thenReturn("aName");
+ when(service.getDisplayName()).thenReturn("aDisplayName");
when(service.getType()).thenReturn("aType");
// contains an extra parameter (param6) and one optional is
missing(param4)
String[] configs = new String[] { "param1", "param2", "param3",
"param5", "param6" };
diff --git a/security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
b/security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
index 1857a77..2bbce2d 100644
--- a/security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
+++ b/security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
@@ -116,6 +116,7 @@ CREATE TABLE `x_portal_user` (
`status` int(11) NOT NULL DEFAULT '0',
`user_src` int(11) NOT NULL DEFAULT '0',
`notes` varchar(4000) DEFAULT NULL,
+ `other_attributes` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_portal_user_UK_login_id` (`login_id`),
UNIQUE KEY `x_portal_user_UK_email` (`email`),
@@ -274,6 +275,7 @@ CREATE TABLE `x_group` (
`cred_store_id` bigint(20) DEFAULT NULL,
`group_src` INT NOT NULL DEFAULT 0,
`is_visible` INT(11) NOT NULL DEFAULT '1',
+ `other_attributes` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `x_group_UK_group_name` (`group_name`),
KEY `x_group_FK_added_by_id` (`added_by_id`),
@@ -319,6 +321,7 @@ CREATE TABLE `x_user` (
`status` int(11) NOT NULL DEFAULT '0',
`cred_store_id` bigint(20) DEFAULT NULL,
`is_visible` INT(11) NOT NULL DEFAULT '1',
+ `other_attributes` varchar(4000) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `x_user_FK_added_by_id` (`added_by_id`),
KEY `x_user_FK_upd_by_id` (`upd_by_id`),
@@ -513,6 +516,7 @@ CREATE TABLE `x_service_def` (
`upd_by_id` bigint(20) DEFAULT NULL,
`version` bigint(20) DEFAULT NULL,
`name` varchar(1024) DEFAULT NULL,
+`display_name` varchar(1024) DEFAULT NULL,
`impl_class_name` varchar(1024) DEFAULT NULL,
`label` varchar(1024) DEFAULT NULL,
`description` varchar(1024) DEFAULT NULL,
@@ -539,6 +543,7 @@ CREATE TABLE `x_service` (
`version` bigint(20) DEFAULT NULL,
`type` bigint(20) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
+`display_name` varchar(255) DEFAULT NULL,
`policy_version` bigint(20) DEFAULT NULL,
`policy_update_time`datetime DEFAULT NULL,
`description` varchar(1024) DEFAULT NULL,
@@ -1667,6 +1672,8 @@ INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('041',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('042',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('043',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
+INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('044',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
+INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('045',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('DB_PATCHES',UTC_TIMESTAMP(),'Ranger 1.0.0',UTC_TIMESTAMP(),'localhost','Y');
INSERT INTO x_user_module_perm
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed)
diff --git
a/security-admin/db/mysql/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
b/security-admin/db/mysql/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
new file mode 100644
index 0000000..b552c42
--- /dev/null
+++
b/security-admin/db/mysql/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -0,0 +1,37 @@
+-- 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.
+
+drop procedure if exists add_column_in_x_service_def_and_x_service;
+
+delimiter ;;
+create procedure add_column_in_x_service_def_and_x_service() begin
+
+if not exists (select * from information_schema.columns where
table_schema=database() and table_name = 'x_service_def' and
column_name='display_name') then
+ ALTER TABLE x_service_def ADD display_name varchar(1024) DEFAULT NULL;
+ UPDATE x_service_def SET display_name=name;
+ UPDATE x_service_def SET display_name='Hadoop SQL' where name='hive';
+end if;
+
+if not exists (select * from information_schema.columns where
table_schema=database() and table_name = 'x_service' and
column_name='display_name') then
+ ALTER TABLE x_service ADD display_name varchar(255) DEFAULT NULL;
+ UPDATE x_service SET display_name = name;
+end if;
+
+end;;
+
+delimiter ;
+call add_column_in_x_service_def_and_x_service();
+
+drop procedure if exists add_column_in_x_service_def_and_x_service;
\ No newline at end of file
diff --git
a/security-admin/db/mysql/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
b/security-admin/db/mysql/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..fa9bd1a
--- /dev/null
+++
b/security-admin/db/mysql/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,38 @@
+-- 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.
+
+drop procedure if exists add_column_in_x_user_and_x_portal_user_and_x_group;
+
+delimiter ;;
+create procedure add_column_in_x_user_and_x_portal_user_and_x_group() begin
+
+if not exists (select * from information_schema.columns where
table_schema=database() and table_name = 'x_user' and
column_name='other_attributes') then
+ ALTER TABLE x_user ADD other_attributes varchar(4000) DEFAULT NULL;
+end if;
+
+if not exists (select * from information_schema.columns where
table_schema=database() and table_name = 'x_portal_user' and
column_name='other_attributes') then
+ ALTER TABLE x_portal_user ADD other_attributes varchar(4000) DEFAULT
NULL;
+end if;
+
+if not exists (select * from information_schema.columns where
table_schema=database() and table_name = 'x_group' and
column_name='other_attributes') then
+ ALTER TABLE x_group ADD other_attributes varchar(4000) DEFAULT NULL;
+end if;
+
+end;;
+
+delimiter ;
+call add_column_in_x_user_and_x_portal_user_and_x_group();
+
+drop procedure if exists add_column_in_x_user_and_x_portal_user_and_x_group;
\ No newline at end of file
diff --git
a/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
b/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
index 0293abe..8587a0b 100644
--- a/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
+++ b/security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql
@@ -310,6 +310,7 @@ CREATE TABLE x_portal_user (
status NUMBER(11) DEFAULT '0' NOT NULL ,
user_src NUMBER(11) DEFAULT '0' NOT NULL ,
notes VARCHAR(4000) DEFAULT NULL NULL ,
+ other_attributes VARCHAR(4000) DEFAULT NULL NULL,
PRIMARY KEY (id),
CONSTRAINT x_portal_user_UK_login_id UNIQUE (login_id) ,
CONSTRAINT x_portal_user_UK_email UNIQUE (email),
@@ -435,6 +436,7 @@ CREATE TABLE X_GROUP(
CRED_STORE_ID NUMBER(20,0) DEFAULT NULL,
group_src NUMBER(10) DEFAULT 0 NOT NULL,
is_visible NUMBER(11) DEFAULT 1 NOT NULL,
+ other_attributes VARCHAR(4000) DEFAULT NULL NULL,
PRIMARY KEY (ID),
CONSTRAINT x_group_UK_group_name UNIQUE (group_name),
CONSTRAINT X_GROUP_FK_ADDED_BY_ID FOREIGN KEY (ADDED_BY_ID) REFERENCES
X_PORTAL_USER (ID) ENABLE,
@@ -469,6 +471,7 @@ CREATE TABLE x_user (
status NUMBER(11) DEFAULT '0' NOT NULL,
cred_store_id NUMBER(20) DEFAULT NULL NULL ,
is_visible NUMBER(11) DEFAULT 1 NOT NULL ,
+ other_attributes VARCHAR(4000) DEFAULT NULL NULL ,
PRIMARY KEY (id),
CONSTRAINT x_user_UK_user_name UNIQUE (user_name),
CONSTRAINT x_user_FK_added_by_id FOREIGN KEY (added_by_id) REFERENCES
x_portal_user (id),
@@ -624,6 +627,7 @@ added_by_id NUMBER(20) DEFAULT NULL NULL,
upd_by_id NUMBER(20) DEFAULT NULL NULL,
version NUMBER(20) DEFAULT NULL NULL,
name VARCHAR(1024) DEFAULT NULL NULL,
+display_name VARCHAR(1024) DEFAULT NULL NULL,
impl_class_name VARCHAR(1024) DEFAULT NULL NULL,
label VARCHAR(1024) DEFAULT NULL NULL,
description VARCHAR(1024) DEFAULT NULL NULL,
@@ -646,6 +650,7 @@ upd_by_id NUMBER(20) DEFAULT NULL NULL,
version NUMBER(20) DEFAULT NULL NULL,
type NUMBER(20) DEFAULT NULL NULL,
name varchar(255) DEFAULT NULL NULL,
+display_name varchar(255) DEFAULT NULL NULL,
policy_version NUMBER(20) DEFAULT NULL NULL,
policy_update_time DATE DEFAULT NULL NULL,
description VARCHAR(1024) DEFAULT NULL NULL,
@@ -1863,6 +1868,8 @@ INSERT INTO x_db_version_h
(id,version,inst_at,inst_by,updated_at,updated_by,act
INSERT INTO x_db_version_h
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES
(X_DB_VERSION_H_SEQ.nextval, '041',sys_extract_utc(systimestamp),'Ranger
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
INSERT INTO x_db_version_h
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES
(X_DB_VERSION_H_SEQ.nextval, '042',sys_extract_utc(systimestamp),'Ranger
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
INSERT INTO x_db_version_h
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES
(X_DB_VERSION_H_SEQ.nextval, '043',sys_extract_utc(systimestamp),'Ranger
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
+INSERT INTO x_db_version_h
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES
(X_DB_VERSION_H_SEQ.nextval, '044',sys_extract_utc(systimestamp),'Ranger
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
+INSERT INTO x_db_version_h
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES
(X_DB_VERSION_H_SEQ.nextval, '045',sys_extract_utc(systimestamp),'Ranger
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
INSERT INTO x_db_version_h
(id,version,inst_at,inst_by,updated_at,updated_by,active) VALUES
(X_DB_VERSION_H_SEQ.nextval, 'DB_PATCHES',sys_extract_utc(systimestamp),'Ranger
1.0.0',sys_extract_utc(systimestamp),'localhost','Y');
INSERT INTO x_user_module_perm
(id,user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed)
VALUES
(X_USER_MODULE_PERM_SEQ.nextval,getXportalUIdByLoginId('admin'),getModulesIdByName('Reports'),sys_extract_utc(systimestamp),sys_extract_utc(systimestamp),getXportalUIdByLoginId('admin'),getXportalUIdByLoginId('admin'),1);
INSERT INTO x_user_module_perm
(id,user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed)
VALUES
(X_USER_MODULE_PERM_SEQ.nextval,getXportalUIdByLoginId('admin'),getModulesIdByName('Resource
Based
Policies'),sys_extract_utc(systimestamp),sys_extract_utc(systimestamp),getXportalUIdByLoginId('admin'),getXportalUIdByLoginId('admin'),1);
diff --git
a/security-admin/db/oracle/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
b/security-admin/db/oracle/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
new file mode 100644
index 0000000..0d634c6
--- /dev/null
+++
b/security-admin/db/oracle/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -0,0 +1,33 @@
+-- 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.
+
+DECLARE
+ v_count number:=0;
+BEGIN
+ select count(*) into v_count from user_tab_cols where
table_name='x_service_def' and column_name='display_name';
+ if (v_count = 0) then
+ execute immediate 'ALTER TABLE x_service_def ADD display_name
VARCHAR(1024) DEFAULT NULL NULL';
+ execute immediate 'UPDATE x_service_def SET display_name=name';
+ execute immediate 'UPDATE x_service_def SET display_name=:val
where name=:searchVal' using 'Hadoop SQL', 'hive';
+ end if;
+
+ v_count number:=0;
+ select count(*) into v_count from user_tab_cols where
table_name='x_service' and column_name='display_name';
+ if (v_count = 0) then
+ execute immediate 'ALTER TABLE x_service ADD display_name
VARCHAR(255) DEFAULT NULL NULL';
+ execute immediate 'UPDATE x_service SET display_name=name';
+ end if;
+ commit;
+END;/
\ No newline at end of file
diff --git
a/security-admin/db/oracle/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
b/security-admin/db/oracle/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..01ad187
--- /dev/null
+++
b/security-admin/db/oracle/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,36 @@
+-- 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.
+
+DECLARE
+ v_count number:=0;
+BEGIN
+ select count(*) into v_count from user_tab_cols where
table_name='x_portal_user' and column_name='other_attributes';
+ if (v_count = 0) then
+ execute immediate 'ALTER TABLE x_portal_user ADD
other_attributes VARCHAR(4000) DEFAULT NULL NULL';
+ end if;
+
+ v_count number:=0;
+ select count(*) into v_count from user_tab_cols where
table_name='x_user' and column_name='other_attributes';
+ if (v_count = 0) then
+ execute immediate 'ALTER TABLE x_user ADD other_attributes
VARCHAR(4000) DEFAULT NULL NULL';
+ end if;
+
+ v_count number:=0;
+ select count(*) into v_count from user_tab_cols where
table_name='X_GROUP' and column_name='other_attributes';
+ if (v_count = 0) then
+ execute immediate 'ALTER TABLE X_GROUP ADD other_attributes
VARCHAR(4000) DEFAULT NULL NULL';
+ end if;
+ commit;
+END;/
\ No newline at end of file
diff --git
a/security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql
b/security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql
index 1d1a31c..f2d1512 100644
--- a/security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql
+++ b/security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql
@@ -191,6 +191,7 @@ email VARCHAR(512) DEFAULT NULL NULL,
status INT DEFAULT '0' NOT NULL,
user_src INT DEFAULT '0' NOT NULL,
notes VARCHAR(4000) DEFAULT NULL NULL,
+other_attributes VARCHAR(4000) DEFAULT NULL NULL,
PRIMARY KEY(id),
CONSTRAINT x_portal_user_UK_login_id UNIQUE(login_id),
CONSTRAINT x_portal_user_UK_email UNIQUE(email),
@@ -323,6 +324,7 @@ GROUP_TYPE INT DEFAULT '0' NOT NULL,
CRED_STORE_ID BIGINT DEFAULT NULL,
GROUP_SRC INT DEFAULT 0 NOT NULL,
IS_VISIBLE INT DEFAULT '1' NOT NULL,
+other_attributes VARCHAR(4000) DEFAULT NULL NULL,
PRIMARY KEY(ID),
CONSTRAINT x_group_UK_group_name UNIQUE(group_name),
CONSTRAINT X_GROUP_FK_ADDED_BY_ID FOREIGN KEY(ADDED_BY_ID) REFERENCES
X_PORTAL_USER(ID),
@@ -359,6 +361,7 @@ descr VARCHAR(4000) DEFAULT NULL NULL,
status INT DEFAULT '0' NOT NULL,
cred_store_id BIGINT DEFAULT NULL NULL,
is_visible INT DEFAULT '1' NOT NULL,
+other_attributes VARCHAR(4000) DEFAULT NULL NULL,
PRIMARY KEY(id),
CONSTRAINT x_user_UK_user_name UNIQUE(user_name),
CONSTRAINT x_user_FK_added_by_id FOREIGN KEY(added_by_id) REFERENCES
x_portal_user(id),
@@ -521,6 +524,7 @@ added_by_id BIGINT DEFAULT NULL NULL,
upd_by_id BIGINT DEFAULT NULL NULL,
version BIGINT DEFAULT NULL NULL,
name VARCHAR(1024) DEFAULT NULL NULL,
+display_name VARCHAR(1024) DEFAULT NULL NULL,
impl_class_name VARCHAR(1024) DEFAULT NULL NULL,
label VARCHAR(1024) DEFAULT NULL NULL,
description VARCHAR(1024) DEFAULT NULL NULL,
@@ -544,6 +548,7 @@ upd_by_id BIGINT DEFAULT NULL NULL,
version BIGINT DEFAULT NULL NULL,
type BIGINT DEFAULT NULL NULL,
name VARCHAR(255) DEFAULT NULL NULL,
+display_name VARCHAR(255) DEFAULT NULL NULL,
policy_version BIGINT DEFAULT NULL NULL,
policy_update_time TIMESTAMP DEFAULT NULL NULL,
description VARCHAR(1024) DEFAULT NULL NULL,
@@ -1790,6 +1795,8 @@ INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('041',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('042',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('043',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
+INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('044',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
+INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('045',current_timestamp,'Ranger 1.0.0',current_timestamp,'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('DB_PATCHES',current_timestamp,'Ranger
1.0.0',current_timestamp,'localhost','Y');
INSERT INTO x_user_module_perm
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed)
VALUES
diff --git
a/security-admin/db/postgres/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
b/security-admin/db/postgres/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
new file mode 100644
index 0000000..2f31685
--- /dev/null
+++
b/security-admin/db/postgres/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -0,0 +1,40 @@
+-- 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.
+
+select 'delimiter start';
+CREATE OR REPLACE FUNCTION add_col_in_x_service_def_and_x_service()
+RETURNS void AS $$
+DECLARE
+ v_column_exists integer := 0;
+BEGIN
+ select count(*) into v_column_exists from pg_attribute where attrelid
in(select oid from pg_class where relname='x_service_def') and
attname='display_name';
+ IF v_column_exists = 0 THEN
+ ALTER TABLE x_service_def ADD COLUMN display_name VARCHAR(1024) DEFAULT NULL
NULL;
+ UPDATE x_service_def SET display_name=name;
+ UPDATE x_service_def SET display_name='Hadoop SQL' where name='hive';
+ END IF;
+
+ select count(*) into v_column_exists from pg_attribute where attrelid
in(select oid from pg_class where relname='x_service') and
attname='display_name';
+ IF v_column_exists = 0 THEN
+ ALTER TABLE x_service ADD COLUMN display_name VARCHAR(255) DEFAULT NULL NULL;
+ UPDATE x_service SET display_name=name;
+ END IF;
+
+END;
+$$ LANGUAGE plpgsql;
+select 'delimiter end';
+
+select add_col_in_x_service_def_and_x_service();
+select 'delimiter end';
\ No newline at end of file
diff --git
a/security-admin/db/postgres/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
b/security-admin/db/postgres/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..4962891
--- /dev/null
+++
b/security-admin/db/postgres/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,42 @@
+-- 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.
+
+select 'delimiter start';
+CREATE OR REPLACE FUNCTION add_column_in_x_user_and_x_portal_user_and_x_group()
+RETURNS void AS $$
+DECLARE
+ v_column_exists integer := 0;
+BEGIN
+ select count(*) into v_column_exists from pg_attribute where attrelid
in(select oid from pg_class where relname='x_portal_user') and
attname='other_attributes';
+ IF v_column_exists = 0 THEN
+ ALTER TABLE x_portal_user ADD COLUMN other_attributes VARCHAR(4000) DEFAULT
NULL NULL;
+ END IF;
+
+ select count(*) into v_column_exists from pg_attribute where attrelid
in(select oid from pg_class where relname='x_user') and
attname='other_attributes';
+ IF v_column_exists = 0 THEN
+ ALTER TABLE x_user ADD COLUMN other_attributes VARCHAR(4000) DEFAULT NULL
NULL;
+ END IF;
+
+ select count(*) into v_column_exists from pg_attribute where attrelid
in(select oid from pg_class where relname='x_group') and
attname='other_attributes';
+ IF v_column_exists = 0 THEN
+ ALTER TABLE x_group ADD COLUMN other_attributes VARCHAR(4000) DEFAULT NULL
NULL;
+ END IF;
+
+END;
+$$ LANGUAGE plpgsql;
+select 'delimiter end';
+
+select add_column_in_x_user_and_x_portal_user_and_x_group();
+select 'delimiter end';
\ No newline at end of file
diff --git
a/security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
b/security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
index 5381398..0c17eb9 100644
---
a/security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
+++
b/security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
@@ -217,6 +217,7 @@ create table dbo.x_portal_user(
status int DEFAULT 0 NOT NULL,
user_src int DEFAULT 0 NOT NULL,
notes varchar(4000) DEFAULT NULL NULL,
+ other_attributes varchar(4000) DEFAULT NULL NULL,
CONSTRAINT x_portal_user_PK_id PRIMARY KEY CLUSTERED(id),
CONSTRAINT x_portal_user_UK_login_id UNIQUE NONCLUSTERED (login_id)
)
@@ -330,6 +331,7 @@ create table dbo.x_group(
cred_store_id bigint DEFAULT NULL NULL,
group_src int DEFAULT 0 NOT NULL,
is_visible int DEFAULT 1 NOT NULL,
+ other_attributes varchar(4000) DEFAULT NULL NULL,
CONSTRAINT x_group_PK_id PRIMARY KEY CLUSTERED(id),
CONSTRAINT x_group_UK_group_name UNIQUE NONCLUSTERED (group_name)
)
@@ -357,6 +359,7 @@ create table dbo.x_user(
status int DEFAULT 0 NOT NULL,
cred_store_id bigint DEFAULT NULL NULL,
is_visible int DEFAULT 1 NOT NULL,
+ other_attributes varchar(4000) DEFAULT NULL NULL,
CONSTRAINT x_user_PK_id PRIMARY KEY CLUSTERED(id),
CONSTRAINT x_user_UK_user_name UNIQUE NONCLUSTERED (user_name)
)
@@ -487,6 +490,7 @@ create table dbo.x_service_def(
upd_by_id bigint DEFAULT NULL NULL,
version bigint DEFAULT NULL NULL,
name varchar(1024) DEFAULT NULL NULL,
+ display_name varchar(1024) DEFAULT NULL NULL,
impl_class_name varchar(1024) DEFAULT NULL NULL,
label varchar(1024) DEFAULT NULL NULL,
description varchar(1024) DEFAULT NULL NULL,
@@ -507,6 +511,7 @@ create table dbo.x_service (
version bigint DEFAULT NULL NULL,
type bigint DEFAULT NULL NULL,
name varchar(255) DEFAULT NULL NULL,
+ display_name varchar(255) DEFAULT NULL NULL,
policy_version bigint DEFAULT NULL NULL,
policy_update_time datetime DEFAULT NULL NULL,
description varchar(1024) DEFAULT NULL NULL,
@@ -2150,6 +2155,10 @@ INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active
GO
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('043',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
GO
+INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('044',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
+GO
+INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('045',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
+GO
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('DB_PATCHES',CURRENT_TIMESTAMP,'Ranger
1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
GO
INSERT INTO x_user_module_perm
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed)
VALUES
(dbo.getXportalUIdByLoginId('admin'),dbo.getModulesIdByName('Reports'),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,dbo.getXportalUIdByLoginId('admin'),dbo.getXportalUIdByLoginId('admin'),1);
diff --git
a/security-admin/db/sqlanywhere/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
b/security-admin/db/sqlanywhere/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
new file mode 100644
index 0000000..76bb780
--- /dev/null
+++
b/security-admin/db/sqlanywhere/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -0,0 +1,27 @@
+-- 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.
+
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_service_def' and
cname = 'display_name') THEN
+ ALTER TABLE dbo.x_service_def ADD display_name varchar(1024)
DEFAULT NULL NULL;
+ UPDATE dbo.x_service_def SET display_name=name;
+ UPDATE dbo.x_service_def SET display_name='Hadoop SQL' where
name='hive';
+END IF;
+GO
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_service' and cname
= 'display_name') THEN
+ ALTER TABLE dbo.x_service ADD display_name varchar(255) DEFAULT
NULL NULL;
+ UPDATE dbo.x_service SET display_name=name;
+END IF;
+GO
+exit
\ No newline at end of file
diff --git
a/security-admin/db/sqlanywhere/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
b/security-admin/db/sqlanywhere/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..a70bf9d
--- /dev/null
+++
b/security-admin/db/sqlanywhere/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,28 @@
+-- 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.
+
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_portal_user' and
cname = 'other_attributes') THEN
+ ALTER TABLE dbo.x_portal_user ADD other_attributes
varchar(4000) DEFAULT NULL NULL;
+END IF;
+GO
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_user' and cname =
'other_attributes') THEN
+ ALTER TABLE dbo.x_user ADD other_attributes varchar(4000)
DEFAULT NULL NULL;
+END IF;
+GO
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_group' and cname =
'other_attributes') THEN
+ ALTER TABLE dbo.x_group ADD other_attributes varchar(4000)
DEFAULT NULL NULL;
+END IF;
+GO
+exit
\ No newline at end of file
diff --git
a/security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql
b/security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql
index d24de68..d049110 100644
--- a/security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql
+++ b/security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql
@@ -975,6 +975,7 @@ CREATE TABLE [dbo].[x_portal_user](
[status] [int] DEFAULT 0 NOT NULL,
[user_src] [int] DEFAULT 0 NOT NULL,
[notes] [varchar](4000) DEFAULT NULL NULL,
+ [other_attributes] [varchar](4000) DEFAULT NULL NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
@@ -1126,6 +1127,7 @@ CREATE TABLE [dbo].[x_group](
[cred_store_id] [bigint] DEFAULT NULL NULL,
[group_src] [int] DEFAULT 0 NOT NULL,
[is_visible] [int] DEFAULT 1 NOT NULL,
+ [other_attributes] [varchar](4000) DEFAULT NULL NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
@@ -1168,6 +1170,7 @@ CREATE TABLE [dbo].[x_user](
[status] [int] DEFAULT 0 NOT NULL,
[cred_store_id] [bigint] DEFAULT NULL NULL,
[is_visible] [int] DEFAULT 1 NOT NULL,
+ [other_attributes] [varchar](4000) DEFAULT NULL NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
@@ -1350,6 +1353,7 @@ CREATE TABLE [dbo].[x_service_def](
[upd_by_id] [bigint] DEFAULT NULL NULL,
[version] [bigint] DEFAULT NULL NULL,
[name] [varchar](1024) DEFAULT NULL NULL,
+ [display_name] [varchar](1024) DEFAULT NULL NULL,
[impl_class_name] [varchar](1024) DEFAULT NULL NULL,
[label] [varchar](1024) DEFAULT NULL NULL,
[description] [varchar](1024) DEFAULT NULL NULL,
@@ -1375,6 +1379,7 @@ CREATE TABLE [dbo].[x_service] (
[version] [bigint] DEFAULT NULL NULL,
[type] [bigint] DEFAULT NULL NULL,
[name] [varchar](255) DEFAULT NULL NULL,
+ [display_name] [varchar](255) DEFAULT NULL NULL,
[policy_version] [bigint] DEFAULT NULL NULL,
[policy_update_time] [datetime2] DEFAULT NULL NULL,
[description] [varchar](1024) DEFAULT NULL NULL,
@@ -2048,7 +2053,7 @@ CREATE TABLE [dbo].[x_service_version_info](
[policy_update_time] [datetime2] DEFAULT NULL NULL,
[tag_version] [bigint] NOT NULL DEFAULT 0,
[tag_update_time] [datetime2] DEFAULT NULL NULL,
- [policy_version] [bigint] NOT NULL DEFAULT 0,
+ [role_version] [bigint] NOT NULL DEFAULT 0,
[role_update_time] [datetime2] DEFAULT NULL NULL,
PRIMARY KEY CLUSTERED
(
@@ -3895,6 +3900,8 @@ INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('041',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('042',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('043',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
+INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('044',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
+INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('045',CURRENT_TIMESTAMP,'Ranger 1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('DB_PATCHES',CURRENT_TIMESTAMP,'Ranger
1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
INSERT INTO x_user_module_perm
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed)
VALUES
(dbo.getXportalUIdByLoginId('admin'),dbo.getModulesIdByName('Reports'),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,dbo.getXportalUIdByLoginId('admin'),dbo.getXportalUIdByLoginId('admin'),1);
INSERT INTO x_user_module_perm
(user_id,module_id,create_time,update_time,added_by_id,upd_by_id,is_allowed)
VALUES (dbo.getXportalUIdByLoginId('admin'),dbo.getModulesIdByName('Resource
Based
Policies'),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,dbo.getXportalUIdByLoginId('admin'),dbo.getXportalUIdByLoginId('admin'),1);
diff --git
a/security-admin/db/sqlserver/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
b/security-admin/db/sqlserver/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
new file mode 100644
index 0000000..2d47927
--- /dev/null
+++
b/security-admin/db/sqlserver/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -0,0 +1,30 @@
+-- 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.
+
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name =
'x_service_def' and column_name = 'display_name')
+BEGIN
+ ALTER TABLE [dbo].[x_service_def] ADD [display_name] [varchar](1024)
DEFAULT NULL NULL;
+ UPDATE [dbo].[x_service_def] SET [display_name] = [name];
+ UPDATE [dbo].[x_service_def] SET [display_name] = 'Hadoop SQL' where
[name] = 'hive';
+END
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name =
'x_service' and column_name = 'display_name')
+BEGIN
+ ALTER TABLE [dbo].[x_service] ADD [display_name] [varchar](255) DEFAULT
NULL NULL;
+ UPDATE [dbo].[x_service] SET [display_name] = [name];
+END
+GO
+exit
\ No newline at end of file
diff --git
a/security-admin/db/sqlserver/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
b/security-admin/db/sqlserver/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
new file mode 100644
index 0000000..6bd0ff9
--- /dev/null
+++
b/security-admin/db/sqlserver/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
@@ -0,0 +1,32 @@
+-- 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.
+
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name =
'x_portal_user' and column_name = 'other_attributes')
+BEGIN
+ ALTER TABLE [dbo].[x_portal_user] ADD [other_attributes]
[varchar](4000) DEFAULT NULL NULL;
+END
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name =
'x_user' and column_name = 'other_attributes')
+BEGIN
+ ALTER TABLE [dbo].[x_user] ADD [other_attributes] [varchar](4000)
DEFAULT NULL NULL;
+END
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name =
'x_group' and column_name = 'other_attributes')
+BEGIN
+ ALTER TABLE [dbo].[x_group] ADD [other_attributes] [varchar](4000)
DEFAULT NULL NULL;
+END
+GO
+exit
\ No newline at end of file
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 866eed9..0ab733c 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
@@ -1392,6 +1392,31 @@ public class ServiceDBStore extends AbstractServiceStore
{
return ret;
}
+ /**
+ * @param displayName
+ * @return {@link RangerServiceDef} - service using display name if
present in DB, <code>null</code> otherwise.
+ */
+ @Override
+ public RangerServiceDef getServiceDefByDisplayName(String displayName)
throws Exception {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("==>
ServiceDBStore.getServiceDefByDisplayName(" + displayName + ")");
+ }
+
+ RangerServiceDef ret = null;
+
+ XXServiceDef xServiceDef =
daoMgr.getXXServiceDef().findByDisplayName(displayName);
+
+ if(xServiceDef != null) {
+ ret =
serviceDefService.getPopulatedViewObject(xServiceDef);
+ }
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("== ServiceDBStore.getServiceDefByName(" +
displayName + "): " + ret);
+ }
+
+ return ret;
+ }
+
@Override
public List<RangerServiceDef> getServiceDefs(SearchFilter filter)
throws Exception {
if (LOG.isDebugEnabled()) {
@@ -1850,6 +1875,25 @@ public class ServiceDBStore extends AbstractServiceStore
{
return xService == null ? null :
svcService.getPopulatedViewObject(xService);
}
+ @Override
+ public RangerService getServiceByDisplayName(String displayName) throws
Exception {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("==> ServiceDBStore.getServiceByName()");
+ }
+ XXService xService =
daoMgr.getXXService().findByDisplayName(displayName);
+
+ if (ContextUtil.getCurrentUserSession() != null) {
+ if (xService == null) {
+ return null;
+ }
+ if (!bizUtil.hasAccess(xService, null)) {
+ throw restErrorUtil.createRESTException("Logged
in user is not allowed to read service, name: " + displayName,
+
MessageEnums.OPER_NO_PERMISSION);
+ }
+ }
+ return xService == null ? null :
svcService.getPopulatedViewObject(xService);
+ }
+
public RangerService getServiceByNameForDP(String name) throws
Exception {
if(LOG.isDebugEnabled()) {
LOG.debug("==> ServiceDBStore.getServiceByNameForDP()");
diff --git
a/security-admin/src/main/java/org/apache/ranger/common/RangerSearchUtil.java
b/security-admin/src/main/java/org/apache/ranger/common/RangerSearchUtil.java
index 99af818..98a8596 100644
---
a/security-admin/src/main/java/org/apache/ranger/common/RangerSearchUtil.java
+++
b/security-admin/src/main/java/org/apache/ranger/common/RangerSearchUtil.java
@@ -51,9 +51,12 @@ public class RangerSearchUtil extends SearchUtil {
}
ret.setParam(SearchFilter.SERVICE_TYPE,
request.getParameter(SearchFilter.SERVICE_TYPE));
+ ret.setParam(SearchFilter.SERVICE_TYPE_DISPLAY_NAME,
request.getParameter(SearchFilter.SERVICE_TYPE_DISPLAY_NAME));
ret.setParam(SearchFilter.SERVICE_TYPE_ID,
request.getParameter(SearchFilter.SERVICE_TYPE_ID));
ret.setParam(SearchFilter.SERVICE_NAME,
request.getParameter(SearchFilter.SERVICE_NAME));
+ ret.setParam(SearchFilter.SERVICE_DISPLAY_NAME,
request.getParameter(SearchFilter.SERVICE_DISPLAY_NAME));
ret.setParam(SearchFilter.SERVICE_NAME_PARTIAL,
request.getParameter(SearchFilter.SERVICE_NAME_PARTIAL));
+ ret.setParam(SearchFilter.SERVICE_DISPLAY_NAME_PARTIAL,
request.getParameter(SearchFilter.SERVICE_DISPLAY_NAME_PARTIAL));
ret.setParam(SearchFilter.SERVICE_ID,
request.getParameter(SearchFilter.SERVICE_ID));
ret.setParam(SearchFilter.POLICY_NAME,
request.getParameter(SearchFilter.POLICY_NAME));
ret.setParam(SearchFilter.POLICY_NAME_PARTIAL,
request.getParameter(SearchFilter.POLICY_NAME_PARTIAL));
diff --git
a/security-admin/src/main/java/org/apache/ranger/db/XXServiceDao.java
b/security-admin/src/main/java/org/apache/ranger/db/XXServiceDao.java
index 0791f2f..d667f2c 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXServiceDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXServiceDao.java
@@ -51,6 +51,19 @@ public class XXServiceDao extends BaseDao<XXService> {
}
}
+ public XXService findByDisplayName(String displayName) {
+ if (displayName == null) {
+ return null;
+ }
+ try {
+ return getEntityManager()
+
.createNamedQuery("XXService.findByDisplayName", tClass)
+ .setParameter("displayName",
displayName).getSingleResult();
+ } catch (NoResultException e) {
+ return null;
+ }
+ }
+
public Long getMaxIdOfXXService() {
try {
return (Long)
getEntityManager().createNamedQuery("XXService.getMaxIdOfXXService").getSingleResult();
diff --git
a/security-admin/src/main/java/org/apache/ranger/db/XXServiceDefDao.java
b/security-admin/src/main/java/org/apache/ranger/db/XXServiceDefDao.java
index beef5bf..ddf28f2 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXServiceDefDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXServiceDefDao.java
@@ -24,6 +24,8 @@ import org.apache.ranger.common.db.BaseDao;
import org.apache.ranger.entity.XXServiceDef;
import org.springframework.stereotype.Service;
+import java.util.Objects;
+
@Service
public class XXServiceDefDao extends BaseDao<XXServiceDef> {
/**
@@ -47,6 +49,21 @@ public class XXServiceDefDao extends BaseDao<XXServiceDef> {
}
}
+ public XXServiceDef findByDisplayName(String displayName) {
+ if (Objects.isNull(displayName)) {
+ return null;
+ }
+ try {
+ XXServiceDef xServiceDef = getEntityManager()
+
.createNamedQuery("XXServiceDef.findByDisplayName", tClass)
+ .setParameter("displayName",
displayName).getSingleResult();
+ return xServiceDef;
+ } catch (NoResultException e) {
+ return null;
+ }
+ }
+
+
public Long getMaxIdOfXXServiceDef() {
try {
return (Long)
getEntityManager().createNamedQuery("XXServiceDef.getMaxIdOfXXServiceDef").getSingleResult();
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXGroup.java
b/security-admin/src/main/java/org/apache/ranger/entity/XXGroup.java
index dc95b58..996a9e1 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXGroup.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXGroup.java
@@ -119,6 +119,14 @@ public class XXGroup extends XXDBBase implements
java.io.Serializable {
@Column(name="CRED_STORE_ID" )
protected Long credStoreId;
+ /**
+ * Additional store attributes.
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name="OTHER_ATTRIBUTES")
+ protected String otherAttributes;
/**
* Default constructor. This will set all the attributes to default
value.
@@ -239,7 +247,22 @@ public class XXGroup extends XXDBBase implements
java.io.Serializable {
return this.credStoreId;
}
+ /**
+ * This method sets JSON {@link String} representation of additional
store attributes.
+ * This method accepts null values.
+ * @param otherAttributes
+ */
+ public void setOtherAttributes(String otherAttributes) {
+ this.otherAttributes = otherAttributes;
+ }
+ /**
+ * @return JSON {@link String} representation of additional store
attributes if available,
+ * <code>null</code> otherwise.
+ */
+ public String getOtherAttributes() {
+ return otherAttributes;
+ }
/**
* This return the bean content in string format
@@ -256,10 +279,11 @@ public class XXGroup extends XXDBBase implements
java.io.Serializable {
str += "groupType={" + groupType + "} ";
str += "credStoreId={" + credStoreId + "} ";
str += "groupSrc={" + groupSource + "} ";
+ str += "otherAttributes={" + otherAttributes + "} ";
str += "}";
return str;
}
-
+
public int getGroupSource() {
return groupSource;
}
diff --git
a/security-admin/src/main/java/org/apache/ranger/entity/XXPortalUser.java
b/security-admin/src/main/java/org/apache/ranger/entity/XXPortalUser.java
index 89b180d..ed69f38 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPortalUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPortalUser.java
@@ -148,6 +148,15 @@ public class XXPortalUser extends XXDBBase implements
java.io.Serializable {
protected String notes;
/**
+ * Additional store attributes.
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name="OTHER_ATTRIBUTES")
+ protected String otherAttributes;
+
+ /**
* Default constructor. This will set all the attributes to default
value.
*/
public XXPortalUser ( ) {
@@ -314,6 +323,23 @@ public class XXPortalUser extends XXDBBase implements
java.io.Serializable {
}
/**
+ * This method sets JSON {@link String} representation of additional
store attributes.
+ * This method accepts null values.
+ * @param otherAttributes
+ */
+ public void setOtherAttributes(String otherAttributes) {
+ this.otherAttributes = otherAttributes;
+ }
+
+ /**
+ * @return JSON {@link String} representation of additional store
attributes if available,
+ * <code>null</code> otherwise.
+ */
+ public String getOtherAttributes() {
+ return otherAttributes;
+ }
+
+ /**
* This return the bean content in string format
* @return formatedStr
*/
@@ -329,6 +355,7 @@ public class XXPortalUser extends XXDBBase implements
java.io.Serializable {
str += "status={" + status + "} ";
str += "userSource={" + userSource + "} ";
str += "notes={" + notes + "} ";
+ str += "otherAttributes={" + otherAttributes + "} ";
str += "}";
return str;
}
diff --git
a/security-admin/src/main/java/org/apache/ranger/entity/XXServiceBase.java
b/security-admin/src/main/java/org/apache/ranger/entity/XXServiceBase.java
index 366dc55..85ce53c 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXServiceBase.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXServiceBase.java
@@ -70,6 +70,14 @@ public abstract class XXServiceBase extends XXDBBase {
protected String name;
/**
+ * displayName of the XXService
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "display_name")
+ protected String displayName;
+ /**
* tagService of the XXService
* <ul>
* </ul>
@@ -209,6 +217,14 @@ public abstract class XXServiceBase extends XXDBBase {
return this.name;
}
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
/**
* This method sets the value to the member attribute <b>
tagService</b> .
*
@@ -453,7 +469,7 @@ public abstract class XXServiceBase extends XXDBBase {
@Override
public String toString() {
return "XXServiceBase [" + super.toString() + " guid=" + guid +
", version=" + version + ", type=" + type
- + ", name=" + name + ", tagService=" +
tagService + ", policyVersion=" + policyVersion + ", policyUpdateTime=" +
policyUpdateTime
+ + ", name=" + name +", displayName=" +
displayName + ", tagService=" + tagService + ", policyVersion=" + policyVersion
+ ", policyUpdateTime=" + policyUpdateTime
+ ", tagVersion=" + tagVersion + ",
tagUpdateTime=" + tagUpdateTime
+ ", description=" + description + ",
isEnabled=" + isEnabled + "]";
}
diff --git
a/security-admin/src/main/java/org/apache/ranger/entity/XXServiceDefBase.java
b/security-admin/src/main/java/org/apache/ranger/entity/XXServiceDefBase.java
index 9a35359..7f8d619 100644
---
a/security-admin/src/main/java/org/apache/ranger/entity/XXServiceDefBase.java
+++
b/security-admin/src/main/java/org/apache/ranger/entity/XXServiceDefBase.java
@@ -58,6 +58,15 @@ public abstract class XXServiceDefBase extends XXDBBase
implements Serializable
protected String name;
/**
+ * displayName of the XXServiceDef
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "display_name")
+ protected String displayName;
+
+ /**
* implClassName of the XXServiceDef
* <ul>
* </ul>
@@ -306,6 +315,25 @@ public abstract class XXServiceDefBase extends XXDBBase
implements Serializable
return this.isEnabled;
}
+ /**
+ * This method sets the value to the member attribute <b>
displayName</b> . You cannot set null to the attribute.
+ *
+ * @param displayName
+ * Value to set member attribute <b> displayName</b>
+ */
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>displayName</b>
+ *
+ * @return Date - value of member attribute <b>displayName</b> .
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
/*
* (non-Javadoc)
*
@@ -396,7 +424,7 @@ public abstract class XXServiceDefBase extends XXDBBase
implements Serializable
*/
@Override
public String toString() {
- return "XXServiceDefBase [" + super.toString() + " guid=" +
guid + ", version=" + version + ", name=" + name
+ return "XXServiceDefBase [" + super.toString() + " guid=" +
guid + ", version=" + version + ", name=" + name +", displayName=" + displayName
+ ", implClassName=" + implClassName + ",
label=" + label + ", description=" + description
+ ", rbKeyLabel=" + rbKeyLabel + ",
rbKeyDescription=" + rbKeyDescription + ", isEnabled" + isEnabled
+ "]";
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXUser.java
b/security-admin/src/main/java/org/apache/ranger/entity/XXUser.java
index 4720095..0464e7b 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXUser.java
@@ -106,6 +106,14 @@ public class XXUser extends XXDBBase implements
java.io.Serializable {
@Column(name="CRED_STORE_ID" )
protected Long credStoreId;
+ /**
+ * Additional store attributes.
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name="OTHER_ATTRIBUTES")
+ protected String otherAttributes;
/**
* Default constructor. This will set all the attributes to default
value.
@@ -212,6 +220,23 @@ public class XXUser extends XXDBBase implements
java.io.Serializable {
/**
+ * This method sets JSON {@link String} representation of additional
store attributes.
+ * This method accepts null values.
+ * @param otherAttributes
+ */
+ public void setOtherAttributes(String otherAttributes) {
+ this.otherAttributes = otherAttributes;
+ }
+
+ /**
+ * @return JSON {@link String} representation of additional store
attributes if available,
+ * <code>null</code> otherwise.
+ */
+ public String getOtherAttributes() {
+ return otherAttributes;
+ }
+
+ /**
* This return the bean content in string format
* @return formatedStr
*/
@@ -224,6 +249,7 @@ public class XXUser extends XXDBBase implements
java.io.Serializable {
str += "status={" + status + "} ";
str += "isvisible={" + isVisible + "} ";
str += "credStoreId={" + credStoreId + "} ";
+ str += "otherAttributes={" + otherAttributes + "} ";
str += "}";
return str;
}
diff --git
a/security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java
b/security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java
index d60b738..3d8a329 100644
--- a/security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java
+++ b/security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java
@@ -31,6 +31,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
+import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
@@ -266,6 +267,13 @@ public class ServiceREST {
RangerServiceDef ret = null;
RangerPerfTracer perf = null;
+ /**
+ * If display name is blank (EMPTY String or NULL), use name.
+ */
+ if (StringUtils.isBlank(serviceDef.getDisplayName())) {
+ serviceDef.setDisplayName(serviceDef.getName());
+ }
+
try {
if(RangerPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = RangerPerfTracer.getPerfTracer(PERF_LOG,
"ServiceREST.createServiceDef(serviceDefName=" + serviceDef.getName() + ")");
@@ -310,6 +318,21 @@ public class ServiceREST {
if(RangerPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = RangerPerfTracer.getPerfTracer(PERF_LOG,
"ServiceREST.updateServiceDef(" + serviceDef.getName() + ")");
}
+
+ /**
+ * If display name is blank (EMPTY String or NULL), use
previous display name.
+ */
+ if (StringUtils.isBlank(serviceDef.getDisplayName())) {
+ RangerServiceDef rangerServiceDef =
svcStore.getServiceDef(serviceDef.getId());
+
+ // If previous display name is blank (EMPTY
String or NULL), user name.
+ if (Objects.isNull(rangerServiceDef) ||
StringUtils.isBlank(rangerServiceDef.getDisplayName())) {
+
serviceDef.setDisplayName(serviceDef.getName());
+ } else {
+
serviceDef.setDisplayName(rangerServiceDef.getDisplayName());
+ }
+ }
+
RangerServiceDefValidator validator =
validatorFactory.getServiceDefValidator(svcStore);
validator.validate(serviceDef, Action.UPDATE);
@@ -676,18 +699,29 @@ public class ServiceREST {
RangerService ret = null;
RangerPerfTracer perf = null;
+ /**
+ * If display name is blank (EMPTY String or NULL), use name.
+ */
+ if (StringUtils.isBlank(service.getDisplayName())) {
+ service.setDisplayName(service.getName());
+ }
+
try {
-
+
if(RangerPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = RangerPerfTracer.getPerfTracer(PERF_LOG,
"ServiceREST.createService(serviceName=" + service.getName() + ")");
}
RangerServiceValidator validator =
validatorFactory.getServiceValidator(svcStore);
validator.validate(service, Action.CREATE);
-
+
if(!StringUtils.isEmpty(service.getName().trim())){
service.setName(service.getName().trim());
}
+
if(!StringUtils.isEmpty(service.getDisplayName().trim())){
+
service.setDisplayName(service.getDisplayName().trim());
+ }
+
UserSessionBase session =
ContextUtil.getCurrentUserSession();
XXServiceDef xxServiceDef =
daoManager.getXXServiceDef().findByName(service.getType());
if(session != null && !session.isSpnegoEnabled()){
@@ -747,17 +781,36 @@ public class ServiceREST {
RangerPerfTracer perf = null;
try {
-
+
if(RangerPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = RangerPerfTracer.getPerfTracer(PERF_LOG,
"ServiceREST.updateService(serviceName=" + service.getName() + ")");
}
+
+ /**
+ * If display name is blank (EMPTY String or NULL), use
previous display name.
+ */
+ if (StringUtils.isBlank(service.getDisplayName())) {
+ RangerService rangerService =
svcStore.getService(service.getId());
+
+ // If previous display name is blank (EMPTY
String or NULL), user name.
+ if (Objects.isNull(rangerService) ||
StringUtils.isBlank(rangerService.getDisplayName())) {
+
service.setDisplayName(service.getName());
+ } else {
+
service.setDisplayName(rangerService.getDisplayName());
+ }
+ }
+
RangerServiceValidator validator =
validatorFactory.getServiceValidator(svcStore);
validator.validate(service, Action.UPDATE);
-
+
if(!StringUtils.isEmpty(service.getName().trim())){
service.setName(service.getName().trim());
}
+
if(!StringUtils.isEmpty(service.getDisplayName().trim())){
+
service.setDisplayName(service.getDisplayName().trim());
+ }
+
bizUtil.hasAdminPermissions("Services");
// TODO: As of now we are allowing SYS_ADMIN to create
all the
diff --git
a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
index 9b543ef..d8ecd5f 100644
---
a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
+++
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
@@ -69,20 +69,22 @@ public abstract class RangerServiceDefServiceBase<T extends
XXServiceDefBase, V
@Autowired
GUIDUtil guidUtil;
-
+
public RangerServiceDefServiceBase() {
super();
-
+
searchFields.add(new SearchField(SearchFilter.SERVICE_TYPE,
"obj.name", DATA_TYPE.STRING, SEARCH_TYPE.FULL));
+ searchFields.add(new
SearchField(SearchFilter.SERVICE_TYPE_DISPLAY_NAME, "obj.displayName",
DATA_TYPE.STRING, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.SERVICE_TYPE_ID,
"obj.id", DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.IS_ENABLED,
"obj.isEnabled", DATA_TYPE.BOOLEAN, SEARCH_TYPE.FULL));
-
+
sortFields.add(new SortField(SearchFilter.CREATE_TIME,
"obj.createTime"));
sortFields.add(new SortField(SearchFilter.UPDATE_TIME,
"obj.updateTime"));
sortFields.add(new SortField(SearchFilter.SERVICE_TYPE_ID,
"obj.id"));
sortFields.add(new SortField(SearchFilter.SERVICE_TYPE,
"obj.name"));
+ sortFields.add(new
SortField(SearchFilter.SERVICE_TYPE_DISPLAY_NAME, "obj.displayName"));
}
-
+
@Override
protected V populateViewBean(T xServiceDef) {
V serviceDef = super.populateViewBean((T) xServiceDef);
@@ -205,11 +207,12 @@ public abstract class RangerServiceDefServiceBase<T
extends XXServiceDefBase, V
@Override
protected T mapViewToEntityBean(V vObj, T xObj, int operationContext) {
-
+
String guid = (StringUtils.isEmpty(vObj.getGuid())) ?
guidUtil.genGUID() : vObj.getGuid();
-
+
xObj.setGuid(guid);
xObj.setName(vObj.getName());
+ xObj.setDisplayName(vObj.getDisplayName());
xObj.setImplclassname(vObj.getImplClass());
xObj.setLabel(vObj.getLabel());
xObj.setDescription(vObj.getDescription());
@@ -234,9 +237,10 @@ public abstract class RangerServiceDefServiceBase<T
extends XXServiceDefBase, V
vObj.setRbKeyLabel(xObj.getRbkeylabel());
vObj.setRbKeyDescription(xObj.getRbkeydescription());
vObj.setIsEnabled(xObj.getIsEnabled());
+ vObj.setDisplayName(xObj.getDisplayName());
return vObj;
}
-
+
public XXServiceConfigDef
populateRangerServiceConfigDefToXX(RangerServiceConfigDef vObj,
XXServiceConfigDef xObj,
XXServiceDef serviceDef, int operationContext) {
if(serviceDef == null) {
diff --git
a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceService.java
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceService.java
index 22d3c60..9ca6355 100644
---
a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceService.java
+++
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceService.java
@@ -62,6 +62,7 @@ public class RangerServiceService extends
RangerServiceServiceBase<XXService, Ra
String actionDelete;
static {
trxLogAttrs.put("name", new VTrxLogAttr("name", "Service Name",
false));
+ trxLogAttrs.put("displayName", new VTrxLogAttr("displayName",
"Service Display Name", false));
trxLogAttrs.put("description", new VTrxLogAttr("description",
"Service Description", false));
trxLogAttrs.put("isEnabled", new VTrxLogAttr("isEnabled",
"Service Status", false));
trxLogAttrs.put("configs", new VTrxLogAttr("configs",
"Connection Configurations", false));
diff --git
a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java
index 7db67ac..fbe5e42 100755
---
a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java
+++
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java
@@ -44,25 +44,27 @@ public abstract class RangerServiceServiceBase<T extends
XXServiceBase, V extend
public RangerServiceServiceBase() {
super();
-
+
searchFields.add(new SearchField(SearchFilter.SERVICE_TYPE,
"xSvcDef.name", DATA_TYPE.STRING,
SEARCH_TYPE.FULL, "XXServiceDef xSvcDef",
"obj.type = xSvcDef.id"));
searchFields.add(new SearchField(SearchFilter.SERVICE_TYPE_ID,
"obj.type", DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.SERVICE_NAME,
"obj.name", DATA_TYPE.STRING, SEARCH_TYPE.FULL));
+ searchFields.add(new
SearchField(SearchFilter.SERVICE_DISPLAY_NAME, "obj.displayName",
DATA_TYPE.STRING, SEARCH_TYPE.FULL));
searchFields.add(new
SearchField(SearchFilter.SERVICE_NAME_PARTIAL, "obj.name", DATA_TYPE.STRING,
SEARCH_TYPE.PARTIAL));
+ searchFields.add(new
SearchField(SearchFilter.SERVICE_DISPLAY_NAME_PARTIAL, "obj.displayName",
DATA_TYPE.STRING, SEARCH_TYPE.PARTIAL));
searchFields.add(new SearchField(SearchFilter.SERVICE_ID,
"obj.id", DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.IS_ENABLED,
"obj.isEnabled", DATA_TYPE.BOOLEAN, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.TAG_SERVICE_ID,
"obj.tagService", DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.TAG_SERVICE_NAME,
"xTagSvc.name", DATA_TYPE.STRING,
SEARCH_TYPE.FULL, "XXServiceBase xTagSvc",
"obj.tagService = xTagSvc.id"));
-
+
sortFields.add(new SortField(SearchFilter.CREATE_TIME,
"obj.createTime"));
sortFields.add(new SortField(SearchFilter.UPDATE_TIME,
"obj.updateTime"));
sortFields.add(new SortField(SearchFilter.SERVICE_ID, "obj.id",
true, SORT_ORDER.ASC));
sortFields.add(new SortField(SearchFilter.SERVICE_NAME,
"obj.name"));
-
+ sortFields.add(new SortField(SearchFilter.SERVICE_DISPLAY_NAME,
"obj.displayName"));
}
-
+
@Override
protected T mapViewToEntityBean(V vObj, T xObj, int OPERATION_CONTEXT) {
String guid = (StringUtils.isEmpty(vObj.getGuid())) ?
guidUtil.genGUID() : vObj.getGuid();
@@ -92,6 +94,7 @@ public abstract class RangerServiceServiceBase<T extends
XXServiceBase, V extend
xObj.setType(xServiceDef.getId());
xObj.setName(vObj.getName());
+ xObj.setDisplayName(vObj.getDisplayName());
xObj.setTagService(tagServiceId);
if (OPERATION_CONTEXT == OPERATION_CREATE_CONTEXT) {
xObj.setTagVersion(vObj.getTagVersion());
@@ -109,6 +112,7 @@ public abstract class RangerServiceServiceBase<T extends
XXServiceBase, V extend
vObj.setGuid(xObj.getGuid());
vObj.setVersion(xObj.getVersion());
vObj.setName(xObj.getName());
+ vObj.setDisplayName(xObj.getDisplayName());
vObj.setDescription(xObj.getDescription());
vObj.setTagService(xTagService != null ? xTagService.getName()
: null);
XXServiceVersionInfo versionInfoObj =
daoMgr.getXXServiceVersionInfo().findByServiceId(xObj.getId());
diff --git
a/security-admin/src/main/java/org/apache/ranger/service/XGroupServiceBase.java
b/security-admin/src/main/java/org/apache/ranger/service/XGroupServiceBase.java
index 378e393..1a701bb 100644
---
a/security-admin/src/main/java/org/apache/ranger/service/XGroupServiceBase.java
+++
b/security-admin/src/main/java/org/apache/ranger/service/XGroupServiceBase.java
@@ -47,6 +47,7 @@ public abstract class XGroupServiceBase<T extends XXGroup, V
extends VXGroup>
mObj.setGroupType( vObj.getGroupType());
mObj.setCredStoreId( vObj.getCredStoreId());
mObj.setGroupSource(vObj.getGroupSource());
+ mObj.setOtherAttributes(vObj.getOtherAttributes());
return mObj;
}
@@ -58,6 +59,7 @@ public abstract class XGroupServiceBase<T extends XXGroup, V
extends VXGroup>
vObj.setGroupType( mObj.getGroupType());
vObj.setCredStoreId( mObj.getCredStoreId());
vObj.setGroupSource(mObj.getGroupSource());
+ vObj.setOtherAttributes(mObj.getOtherAttributes());
return vObj;
}
diff --git
a/security-admin/src/main/java/org/apache/ranger/service/XPortalUserServiceBase.java
b/security-admin/src/main/java/org/apache/ranger/service/XPortalUserServiceBase.java
index 1c0b7c8..85e4b84 100644
---
a/security-admin/src/main/java/org/apache/ranger/service/XPortalUserServiceBase.java
+++
b/security-admin/src/main/java/org/apache/ranger/service/XPortalUserServiceBase.java
@@ -50,6 +50,7 @@ public abstract class XPortalUserServiceBase<T extends
XXPortalUser, V extends V
mObj.setStatus( vObj.getStatus());
mObj.setUserSource( vObj.getUserSource());
mObj.setNotes( vObj.getNotes());
+ mObj.setOtherAttributes(vObj.getOtherAttributes());
return mObj;
}
@@ -64,6 +65,7 @@ public abstract class XPortalUserServiceBase<T extends
XXPortalUser, V extends V
vObj.setStatus( mObj.getStatus());
vObj.setUserSource( mObj.getUserSource());
vObj.setNotes( mObj.getNotes());
+ vObj.setOtherAttributes(mObj.getOtherAttributes());
return vObj;
}
diff --git
a/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java
b/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java
index 9669c0b..1004952 100644
---
a/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java
+++
b/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java
@@ -46,6 +46,7 @@ public abstract class XUserServiceBase<T extends XXUser, V
extends VXUser>
mObj.setIsVisible(vObj.getIsVisible());
mObj.setDescription( vObj.getDescription());
mObj.setCredStoreId( vObj.getCredStoreId());
+ mObj.setOtherAttributes(vObj.getOtherAttributes());
return mObj;
}
@@ -56,6 +57,7 @@ public abstract class XUserServiceBase<T extends XXUser, V
extends VXUser>
vObj.setIsVisible(mObj.getIsVisible());
vObj.setDescription( mObj.getDescription());
vObj.setCredStoreId( mObj.getCredStoreId());
+ vObj.setOtherAttributes(mObj.getOtherAttributes());
return vObj;
}
diff --git a/security-admin/src/main/java/org/apache/ranger/view/VXGroup.java
b/security-admin/src/main/java/org/apache/ranger/view/VXGroup.java
index 624dd5a..ed64704 100644
--- a/security-admin/src/main/java/org/apache/ranger/view/VXGroup.java
+++ b/security-admin/src/main/java/org/apache/ranger/view/VXGroup.java
@@ -65,7 +65,13 @@ public class VXGroup extends VXDataObject implements
java.io.Serializable {
* Group visibility
*/
protected Integer isVisible;
-
+
+ /**
+ * Additional store attributes.
+ *
+ */
+ protected String otherAttributes;
+
/**
* Default constructor. This will set all the attributes to default
value.
*/
@@ -173,6 +179,21 @@ public class VXGroup extends VXDataObject implements
java.io.Serializable {
}
/**
+ * @return {@link String} - additional attributes.
+ */
+ public String getOtherAttributes() {
+ return otherAttributes;
+ }
+
+ /**
+ * This method sets additional attributes.
+ * @param otherAttributes
+ */
+ public void setOtherAttributes(final String otherAttributes) {
+ this.otherAttributes = otherAttributes;
+ }
+
+ /**
* This return the bean content in string format
* @return formatedStr
*/
@@ -185,6 +206,7 @@ public class VXGroup extends VXDataObject implements
java.io.Serializable {
str += "credStoreId={" + credStoreId + "} ";
str += "isVisible={" + isVisible + "} ";
str += "groupSrc={" + groupSource + "} ";
+ str += "otherAttributes={" + otherAttributes + "} ";
str += "}";
return str;
}
diff --git
a/security-admin/src/main/java/org/apache/ranger/view/VXPortalUser.java
b/security-admin/src/main/java/org/apache/ranger/view/VXPortalUser.java
index 0295649..b6035b2 100644
--- a/security-admin/src/main/java/org/apache/ranger/view/VXPortalUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/view/VXPortalUser.java
@@ -84,6 +84,13 @@ public class VXPortalUser extends VXDataObject implements
java.io.Serializable {
protected List<VXUserPermission> userPermList;
protected List<VXGroupPermission> groupPermissions;
+
+ /**
+ * Additional store attributes.
+ *
+ */
+ protected String otherAttributes;
+
/**
* Default constructor. This will set all the attributes to default
value.
*/
@@ -292,6 +299,22 @@ public class VXPortalUser extends VXDataObject implements
java.io.Serializable {
this.groupPermissions = groupPermissions;
}
+
+ /**
+ * @return {@link String} - additional attributes.
+ */
+ public String getOtherAttributes() {
+ return otherAttributes;
+ }
+
+ /**
+ * This method sets additional attributes.
+ * @param otherAttributes
+ */
+ public void setOtherAttributes(final String otherAttributes) {
+ this.otherAttributes = otherAttributes;
+ }
+
/**
* This return the bean content in string format
* @return formatedStr
@@ -308,6 +331,7 @@ public class VXPortalUser extends VXDataObject implements
java.io.Serializable {
str += "userSource={" + userSource + "} ";
str += "notes={" + notes + "} ";
str += "userRoleList={" + userRoleList + "} ";
+ str += "otherAttributes={" + otherAttributes + "} ";
str += "}";
return str;
}
diff --git a/security-admin/src/main/java/org/apache/ranger/view/VXUser.java
b/security-admin/src/main/java/org/apache/ranger/view/VXUser.java
index 1c01219..96f6468 100644
--- a/security-admin/src/main/java/org/apache/ranger/view/VXUser.java
+++ b/security-admin/src/main/java/org/apache/ranger/view/VXUser.java
@@ -86,6 +86,12 @@ public class VXUser extends VXDataObject implements
java.io.Serializable {
protected Collection<String> userRoleList;
/**
+ * Additional store attributes.
+ *
+ */
+ protected String otherAttributes;
+
+ /**
* Default constructor. This will set all the attributes to default
value.
*/
public VXUser ( ) {
@@ -285,6 +291,21 @@ public class VXUser extends VXDataObject implements
java.io.Serializable {
}
/**
+ * @return {@link String} - additional attributes.
+ */
+ public String getOtherAttributes() {
+ return otherAttributes;
+ }
+
+ /**
+ * This method sets additional attributes.
+ * @param otherAttributes
+ */
+ public void setOtherAttributes(final String otherAttributes) {
+ this.otherAttributes = otherAttributes;
+ }
+
+ /**
* This return the bean content in string format
* @return formatedStr
*/
@@ -301,6 +322,7 @@ public class VXUser extends VXDataObject implements
java.io.Serializable {
str += "groupIdList={" + groupIdList + "} ";
str += "groupNameList={" + groupNameList + "} ";
str += "roleList={" + userRoleList + "} ";
+ str += "otherAttributes={" + otherAttributes + "} ";
str += "}";
return str;
}
diff --git a/security-admin/src/main/resources/META-INF/jpa_named_queries.xml
b/security-admin/src/main/resources/META-INF/jpa_named_queries.xml
index b619b7a..e36f563 100755
--- a/security-admin/src/main/resources/META-INF/jpa_named_queries.xml
+++ b/security-admin/src/main/resources/META-INF/jpa_named_queries.xml
@@ -330,6 +330,10 @@
<query>select obj from XXServiceDef obj where obj.name =
:name</query>
</named-query>
+ <named-query name="XXServiceDef.findByDisplayName">
+ <query>select obj from XXServiceDef obj where obj.displayName =
:displayName</query>
+ </named-query>
+
<named-query name="XXServiceDef.getMaxIdOfXXServiceDef">
<query>select MAX(obj.id) from XXServiceDef obj</query>
</named-query>
@@ -462,10 +466,14 @@
<query>select obj from XXService obj where obj.name =
:name</query>
</named-query>
+ <named-query name="XXService.findByDisplayName">
+ <query>select obj from XXService obj where obj.displayName =
:displayName</query>
+ </named-query>
+
<named-query name="XXService.getMaxIdOfXXService">
<query>select MAX(obj.id) from XXService obj</query>
</named-query>
-
+
<named-query name="XXService.findByServiceDefId">
<query>select obj from XXService obj where obj.type =
:serviceDefId</query>
</named-query>
diff --git a/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
b/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
index 398941a..e5a28e8 100644
--- a/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
+++ b/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
@@ -54,6 +54,11 @@ define(function(require){
// Overwrite your schema definition here
return _.extend(attrs,{
+ displayName : {
+ type : 'Text',
+ title : 'Display Name'
+ },
+
name : {
type : 'Text',
title : 'Service Name *',
diff --git
a/security-admin/src/main/webapp/scripts/views/service/RangerServiceViewDetail.js
b/security-admin/src/main/webapp/scripts/views/service/RangerServiceViewDetail.js
index a169baa..24aeedb 100644
---
a/security-admin/src/main/webapp/scripts/views/service/RangerServiceViewDetail.js
+++
b/security-admin/src/main/webapp/scripts/views/service/RangerServiceViewDetail.js
@@ -44,6 +44,7 @@ define(function(require) {
description : this.options.rangerService.get('description'),
isEnabled : this.options.rangerService.get('isEnabled'),
tagService : (this.options.rangerService.get('tagService')) ?
this.options.rangerService.get('tagService') : false,
+ displayName : this.options.rangerService.get('displayName'),
}
},
diff --git
a/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js
b/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js
index b7215f2..59df159 100644
--- a/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js
+++ b/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js
@@ -82,7 +82,7 @@ define(function(require){
* Override here ONLY if special case!!
*/
- fields: ['name', 'description', 'isEnabled', 'type','configs',
'_vPassword'],
+ fields: ['displayName', 'name', 'description', 'isEnabled',
'type','configs', '_vPassword'],
schema : function(){
var attrs =
_.pick(_.result(this.rangerServiceDefModel,'schemaBase'),
this.getSerivceBaseFieldNames());
@@ -225,7 +225,7 @@ define(function(require){
}
},
getSerivceBaseFieldNames : function(){
- var fields = ['name', 'description',
'isEnabled','tagService']
+ var fields = ['displayName', 'name', 'description',
'isEnabled','tagService']
return this.rangerServiceDefModel.get('name') ==
XAEnums.ServiceType.SERVICE_TAG.label ?
fields.slice(0,fields.indexOf("tagService")) : fields;
}
});
diff --git
a/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html
b/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html
index 82b667c..ded4c34 100644
---
a/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html
+++
b/security-admin/src/main/webapp/templates/common/ServiceManagerLayout_tmpl.html
@@ -57,7 +57,7 @@
<!-- Remove alt attribut from img tag
-->
<span>
<img src="images/folder-grey.png">
- {{./this.attributes.name}}
+ {{./this.attributes.displayName}}
</span>
{{#if ../operation}}
<span>
diff --git a/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
b/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
index 4b64d01..d190a87 100644
--- a/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
+++ b/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
@@ -525,8 +525,14 @@
if (!serv.get('isEnabled')) {
tr += '<i class="icon-ban-circle
text-color-red pull-left icon-large"></i>';
}
- tr += '<a class="pull-left serviceNameEllipsis"
data-id="'+serv.id+'" href="#!/service/'+serv.id+'/policies/'+policyType+'"
title="'+_.escape(serv.attributes.name)+'">'+_.escape(serv.attributes.name)+'</a>'+serviceOperationDiv+'\
- </div></td></tr>';
+ //For service name
+ if(!_.isUndefined(serv) &&
!_.isUndefined(serv.get('displayName')) ) {
+ tr += '<a class="pull-left
serviceNameEllipsis" data-id="'+serv.id+'"
href="#!/service/'+serv.id+'/policies/'+policyType+'"
title="'+_.escape(serv.get('displayName'))+'">'+_.escape(serv.get('displayName'))+'</a>'+serviceOperationDiv+'\
+ </div></td></tr>';
+ } else {
+ tr += '<a class="pull-left
serviceNameEllipsis" data-id="'+serv.id+'"
href="#!/service/'+serv.id+'/policies/'+policyType+'"
title="'+_.escape(serv.attributes.name)+'">'+_.escape(serv.attributes.name)+'</a>'+serviceOperationDiv+'\
+ </div></td></tr>';
+ }
});
}
return tr;
diff --git
a/security-admin/src/main/webapp/templates/service/RangerServiceViewDetail_tmpl.html
b/security-admin/src/main/webapp/templates/service/RangerServiceViewDetail_tmpl.html
index d9fe51f..e3a2e67 100644
---
a/security-admin/src/main/webapp/templates/service/RangerServiceViewDetail_tmpl.html
+++
b/security-admin/src/main/webapp/templates/service/RangerServiceViewDetail_tmpl.html
@@ -22,6 +22,14 @@
<tbody>
<tr>
<td>
+ {{tt 'lbl.displayName'}}
+ </td>
+ <td>
+ {{displayName}}
+ </td>
+ </tr>
+ <tr>
+ <td>
{{tt 'lbl.serviceName'}}
</td>
<td>
diff --git
a/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java
b/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java
index f687ab8..422cdbe 100644
--- a/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java
+++ b/security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java
@@ -301,6 +301,7 @@ public class TestServiceREST {
rangerService.setGuid("1427365526516_835_0");
rangerService.setIsEnabled(true);
rangerService.setName("HDFS_1");
+ rangerService.setDisplayName("HDFS_1");
rangerService.setPolicyUpdateTime(new Date());
rangerService.setType("1");
rangerService.setUpdatedBy("Admin");