ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-ranger git commit: RANGER-595: TagDBStore updates: to handle simultaneous update-requests; new columns for policyItem
Date Fri, 25 Sep 2015 18:14:45 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/tag-policy 133b82cb2 -> e250f0291


RANGER-595: TagDBStore updates: to handle simultaneous update-requests; new columns for policyItem


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

Branch: refs/heads/tag-policy
Commit: e250f0291a23775a8f18f2a34f401575ddf2ed91
Parents: 133b82c
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Fri Sep 25 09:14:21 2015 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Fri Sep 25 11:14:21 2015 -0700

----------------------------------------------------------------------
 .../ranger/plugin/model/RangerPolicy.java       | 44 ++++++++++++
 .../RangerAbstractPolicyItemEvaluator.java      |  5 ++
 .../RangerDefaultPolicyEvaluator.java           |  2 +
 .../RangerPolicyItemEvaluator.java              |  2 +
 .../016-updated-schema-for-tag-based-policy.sql | 19 +++---
 .../org/apache/ranger/biz/ServiceDBStore.java   |  2 +
 .../java/org/apache/ranger/biz/TagDBStore.java  | 45 ++++--------
 .../org/apache/ranger/entity/XXPolicyItem.java  | 72 ++++++++++++++++++++
 .../apache/ranger/entity/XXServiceResource.java |  2 +
 .../java/org/apache/ranger/entity/XXTag.java    | 26 +++++++
 .../java/org/apache/ranger/entity/XXTagDef.java |  2 +
 .../org/apache/ranger/rest/ServiceREST.java     |  2 -
 .../ranger/service/RangerPolicyServiceBase.java |  2 +
 13 files changed, 182 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
index 6486429..a813a6e 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
@@ -583,6 +583,8 @@ public class RangerPolicy extends RangerBaseModelObject implements java.io.Seria
 		private List<String>                    groups        = null;
 		private List<RangerPolicyItemCondition> conditions    = null;
 		private Boolean                         delegateAdmin = null;
+		private Boolean                         isEnabled     = Boolean.TRUE;
+		private String                          comments      = null;
 
 		public RangerPolicyItem() {
 			this(null, null, null, null, null);
@@ -707,6 +709,34 @@ public class RangerPolicy extends RangerBaseModelObject implements java.io.Seria
 			this.delegateAdmin = delegateAdmin == null ? Boolean.FALSE : delegateAdmin;
 		}
 
+		/**
+		 * @return the isEnabled
+		 */
+		public Boolean getIsEnabled() {
+			return isEnabled;
+		}
+
+		/**
+		 * @param isEnabled the isEnabled to set
+		 */
+		public void setIsEnabled(Boolean isEnabled) {
+			this.isEnabled = isEnabled == null ? Boolean.TRUE : isEnabled;
+		}
+
+		/**
+		 * @return the comments
+		 */
+		public String getComments() {
+			return comments;
+		}
+
+		/**
+		 * @param comments the comments to set
+		 */
+		public void setComments(String comments) {
+			this.comments = comments;
+		}
+
 		@Override
 		public String toString( ) {
 			StringBuilder sb = new StringBuilder();
@@ -760,6 +790,8 @@ public class RangerPolicy extends RangerBaseModelObject implements java.io.Seria
 			sb.append("} ");
 
 			sb.append("delegateAdmin={").append(delegateAdmin).append("} ");
+			sb.append("isEnabled={").append(isEnabled).append("} ");
+			sb.append("comments={").append(comments).append("} ");
 			sb.append("}");
 
 			return sb;
@@ -775,6 +807,8 @@ public class RangerPolicy extends RangerBaseModelObject implements java.io.Seria
 					+ ((conditions == null) ? 0 : conditions.hashCode());
 			result = prime * result
 					+ ((delegateAdmin == null) ? 0 : delegateAdmin.hashCode());
+			result = prime * result + ((isEnabled == null) ? 0 : isEnabled.hashCode());
+			result = prime * result + ((comments == null) ? 0 : comments.hashCode());
 			result = prime * result
 					+ ((groups == null) ? 0 : groups.hashCode());
 			result = prime * result + ((users == null) ? 0 : users.hashCode());
@@ -805,6 +839,16 @@ public class RangerPolicy extends RangerBaseModelObject implements java.io.Seria
 					return false;
 			} else if (!delegateAdmin.equals(other.delegateAdmin))
 				return false;
+			if (isEnabled == null) {
+				if (other.isEnabled != null)
+					return false;
+			} else if (!isEnabled.equals(other.isEnabled))
+				return false;
+			if (comments == null) {
+				if (other.comments != null)
+					return false;
+			} else if (!comments.equals(other.comments))
+				return false;
 			if (groups == null) {
 				if (other.groups != null)
 					return false;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyItemEvaluator.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyItemEvaluator.java
b/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyItemEvaluator.java
index 450f766..ffd1d79 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyItemEvaluator.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyItemEvaluator.java
@@ -82,6 +82,11 @@ public abstract class RangerAbstractPolicyItemEvaluator implements RangerPolicyI
 	}
 
 	@Override
+	public String getComments() {
+		return policyItem == null ? null : policyItem.getComments();
+	}
+
+	@Override
 	public int compareTo(RangerPolicyItemEvaluator other) {
 		if(LOG.isDebugEnabled()) {
 			LOG.debug("==> RangerAbstractPolicyItemEvaluator.compareTo()");

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java
b/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java
index a6285d9..1764b60 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java
@@ -161,10 +161,12 @@ public class RangerDefaultPolicyEvaluator extends RangerAbstractPolicyEvaluator
                             if(isResourceMatch) {
 	                            result.setIsAllowed(false);
 	                            result.setPolicyId(policy.getId());
+	                            result.setReason(matchedPolicyItem.getComments());
                             }
 	                    } else {
 	                        result.setIsAllowed(true);
 	                        result.setPolicyId(policy.getId());
+	                        result.setReason(matchedPolicyItem.getComments());
 	                    }
                     }
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerPolicyItemEvaluator.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerPolicyItemEvaluator.java
b/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerPolicyItemEvaluator.java
index 6360dc9..95d2b4e 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerPolicyItemEvaluator.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerPolicyItemEvaluator.java
@@ -37,6 +37,8 @@ public interface RangerPolicyItemEvaluator extends Comparable<RangerPolicyItemEv
 
 	int getPolicyItemType();
 
+	String getComments();
+
 	List<RangerConditionEvaluator> getConditionEvaluators();
 
 	int getEvalOrder();

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/db/mysql/patches/016-updated-schema-for-tag-based-policy.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/016-updated-schema-for-tag-based-policy.sql b/security-admin/db/mysql/patches/016-updated-schema-for-tag-based-policy.sql
index 89c5cbe..532e723 100644
--- a/security-admin/db/mysql/patches/016-updated-schema-for-tag-based-policy.sql
+++ b/security-admin/db/mysql/patches/016-updated-schema-for-tag-based-policy.sql
@@ -53,6 +53,7 @@ CREATE TABLE IF NOT EXISTS `x_tag` (
 `update_time` DATETIME DEFAULT NULL,
 `added_by_id` BIGINT(20) DEFAULT NULL,
 `upd_by_id` BIGINT(20) DEFAULT NULL,
+`version` BIGINT(20) DEFAULT NULL,
 `type` BIGINT(20) NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `x_tag_UK_guid` (`guid`),
@@ -207,23 +208,25 @@ DELIMITER ;
 CALL add_column_x_service_def_options();
 DROP PROCEDURE IF EXISTS add_column_x_service_def_options;
 
--- ---------------------------------------
--- add column in x_policy_item.item_type
--- ---------------------------------------
-DROP PROCEDURE IF EXISTS add_column_x_policy_item_item_type;
+-- ---------------------------------------------------------------------------------------
+-- add column in x_policy_item.item_type, x_policy_item.is_enabled, x_policy_item.comments
+-- ---------------------------------------------------------------------------------------
+DROP PROCEDURE IF EXISTS add_columns_x_policy_item;
 
 DELIMITER ;;
-CREATE PROCEDURE add_column_x_policy_item_item_type() BEGIN
+CREATE PROCEDURE add_columns_x_policy_item() BEGIN
   IF EXISTS (SELECT * FROM information_schema.tables WHERE table_schema=database() AND table_name
= 'x_policy_item') THEN
     IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=database()
AND table_name = 'x_policy_item' AND column_name = 'item_type') THEN
-      ALTER TABLE `x_policy_item` ADD COLUMN `item_type` INT DEFAULT 0 NOT NULL;
+      ALTER TABLE `x_policy_item` ADD COLUMN `item_type` INT DEFAULT 0 NOT NULL,
+                                  ADD COLUMN `is_enabled` TINYINT(1) NOT NULL DEFAULT '1',
+                                  ADD COLUMN `comments` VARCHAR(255) DEFAULT NULL NULL;
     END IF;
   END IF;
 END;;
 
 DELIMITER ;
-CALL add_column_x_policy_item_item_type();
-DROP PROCEDURE IF EXISTS add_column_x_policy_item_item_type;
+CALL add_columns_x_policy_item();
+DROP PROCEDURE IF EXISTS add_columns_x_policy_item;
 
 -- ---------------------------------------------------------------------------------------
 -- add columns in x_service.tag_service, x_service.tag_version, x_service.tag_update_time

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java b/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java
index 3cd94c4..99e58fe 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
@@ -2015,6 +2015,8 @@ public class ServiceDBStore extends AbstractServiceStore {
 					xPolicyItem, xPolicy);
 			xPolicyItem.setDelegateAdmin(policyItem.getDelegateAdmin());
 			xPolicyItem.setItemType(policyItemType);
+			xPolicyItem.setIsEnabled(policyItem.getIsEnabled());
+			xPolicyItem.setComments(policyItem.getComments());
 			xPolicyItem.setPolicyId(policy.getId());
 			xPolicyItem.setOrder(itemOrder);
 			xPolicyItem = daoMgr.getXXPolicyItem().create(xPolicyItem);

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/src/main/java/org/apache/ranger/biz/TagDBStore.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/TagDBStore.java b/security-admin/src/main/java/org/apache/ranger/biz/TagDBStore.java
index 6a5684b..f2a1ad9 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/TagDBStore.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/TagDBStore.java
@@ -120,17 +120,10 @@ public class TagDBStore extends AbstractTagStore {
 			throw errorUtil.createRESTException("failed to update tag-def [" + tagDef.getName() +
"], Reason: No TagDef found with id: [" + tagDef.getId() + "]", MessageEnums.DATA_NOT_UPDATABLE);
 		}
 
-		if (StringUtils.isEmpty(tagDef.getCreatedBy())) {
-			tagDef.setCreatedBy(existing.getCreatedBy());
-		}
-
-		if (tagDef.getCreateTime() == null) {
-			tagDef.setCreateTime(existing.getCreateTime());
-		}
-
-		if (StringUtils.isEmpty(tagDef.getGuid())) {
-			tagDef.setGuid(existing.getGuid());
-		}
+		tagDef.setCreatedBy(existing.getCreatedBy());
+		tagDef.setCreateTime(existing.getCreateTime());
+		tagDef.setGuid(existing.getGuid());
+		tagDef.setVersion(existing.getVersion());
 
 		RangerTagDef ret = rangerTagDefService.update(tagDef);
 
@@ -302,17 +295,10 @@ public class TagDBStore extends AbstractTagStore {
 			throw errorUtil.createRESTException("failed to update tag [" + tag.getType() + "], Reason:
No Tag found with id: [" + tag.getId() + "]", MessageEnums.DATA_NOT_UPDATABLE);
 		}
 
-		if (StringUtils.isEmpty(tag.getCreatedBy())) {
-			tag.setCreatedBy(existing.getCreatedBy());
-		}
-
-		if (tag.getCreateTime() == null) {
-			tag.setCreateTime(existing.getCreateTime());
-		}
-
-		if (StringUtils.isEmpty(tag.getGuid())) {
-			tag.setGuid(existing.getGuid());
-		}
+		tag.setCreatedBy(existing.getCreatedBy());
+		tag.setCreateTime(existing.getCreateTime());
+		tag.setGuid(existing.getGuid());
+		tag.setVersion(existing.getVersion());
 
 		RangerTag ret = rangerTagService.update(tag);
 
@@ -494,17 +480,10 @@ public class TagDBStore extends AbstractTagStore {
 			throw errorUtil.createRESTException("failed to update tag [" + resource.getId() + "],
Reason: No resource found with id: [" + resource.getId() + "]", MessageEnums.DATA_NOT_UPDATABLE);
 		}
 
-		if (StringUtils.isEmpty(resource.getCreatedBy())) {
-			resource.setCreatedBy(existing.getCreatedBy());
-		}
-
-		if (resource.getCreateTime() == null) {
-			resource.setCreateTime(existing.getCreateTime());
-		}
-
-		if (StringUtils.isEmpty(resource.getGuid())) {
-			resource.setGuid(existing.getGuid());
-		}
+		resource.setCreatedBy(existing.getCreatedBy());
+		resource.setCreateTime(existing.getCreateTime());
+		resource.setGuid(existing.getGuid());
+		resource.setVersion(existing.getVersion());
 
 		rangerServiceResourceService.update(resource);
 		deleteResourceForServiceResource(existing.getId());

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyItem.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyItem.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyItem.java
index be8507e..3386fae 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyItem.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyItem.java
@@ -77,6 +77,24 @@ public class XXPolicyItem extends XXDBBase implements java.io.Serializable
{
 	protected Integer itemType;
 
 	/**
+	 * isEnabled of the XXPolicyItem
+	 * <ul>
+	 * </ul>
+	 *
+	 */
+	@Column(name = "is_enabled")
+	protected Boolean isEnabled;
+
+	/**
+	 * comments of the XXPolicyItem
+	 * <ul>
+	 * </ul>
+	 *
+	 */
+	@Column(name = "comments")
+	protected String comments;
+
+	/**
 	 * order of the XXPolicyItem
 	 * <ul>
 	 * </ul>
@@ -181,6 +199,46 @@ public class XXPolicyItem extends XXDBBase implements java.io.Serializable
{
 	}
 
 	/**
+	 * This method sets the value to the member attribute <b> isEnabled</b> . You
+	 * cannot set null to the attribute.
+	 * 
+	 * @param isEnabled
+	 *            Value to set member attribute <b> isEnabled</b>
+	 */
+	public void setIsEnabled(Boolean isEnabled) {
+		this.isEnabled = isEnabled;
+	}
+
+	/**
+	 * Returns the value for the member attribute <b>isEnabled</b>
+	 * 
+	 * @return Boolean - value of member attribute <b>isEnabled</b> .
+	 */
+	public Boolean getIsEnabled() {
+		return this.isEnabled;
+	}
+
+	/**
+	 * This method sets the value to the member attribute <b> comments</b> . You
+	 * cannot set null to the attribute.
+	 * 
+	 * @param comments
+	 *            Value to set member attribute <b> comments</b>
+	 */
+	public void setComments(String comments) {
+		this.comments = comments;
+	}
+
+	/**
+	 * Returns the value for the member attribute <b>comments</b>
+	 * 
+	 * @return Boolean - value of member attribute <b>comments</b> .
+	 */
+	public String getComments() {
+		return this.comments;
+	}
+
+	/**
 	 * This method sets the value to the member attribute <b> order</b> . You
 	 * cannot set null to the attribute.
 	 * 
@@ -258,6 +316,20 @@ public class XXPolicyItem extends XXDBBase implements java.io.Serializable
{
 		} else if (!itemType.equals(other.itemType)) {
 			return false;
 		}
+		if (isEnabled == null) {
+			if (other.isEnabled != null) {
+				return false;
+			}
+		} else if (!isEnabled.equals(other.isEnabled)) {
+			return false;
+		}
+		if (comments == null) {
+			if (other.comments != null) {
+				return false;
+			}
+		} else if (!comments.equals(other.comments)) {
+			return false;
+		}
 		return true;
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
b/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
index 8fd3866..2624154 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
@@ -29,6 +29,7 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
+import javax.persistence.Version;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.ranger.common.AppConstants;
@@ -49,6 +50,7 @@ public class XXServiceResource extends XXDBBase implements Serializable
{
 	@Column(name = "guid", unique = true, nullable = false, length = 512)
 	protected String guid;
 
+	@Version
 	@Column(name = "version")
 	protected Long version;
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java b/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java
index dd154b9..c8a9d35 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java
@@ -29,6 +29,7 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
+import javax.persistence.Version;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.ranger.common.AppConstants;
@@ -49,6 +50,10 @@ public class XXTag extends XXDBBase implements Serializable {
 	@Column(name = "guid", unique = true, nullable = false, length = 512)
 	protected String guid;
 
+	@Version
+	@Column(name = "version")
+	protected Long version;
+
 	@Column(name = "type")
 	protected Long type;
 
@@ -78,6 +83,21 @@ public class XXTag extends XXDBBase implements Serializable {
 	}
 
 	/**
+	 * @return the version
+	 */
+	public Long getVersion() {
+		return version;
+	}
+
+	/**
+	 * @param version
+	 *            the version to set
+	 */
+	public void setVersion(Long version) {
+		this.version = version;
+	}
+
+	/**
 	 * @return the type
 	 */
 	public Long getType() {
@@ -106,6 +126,7 @@ public class XXTag extends XXDBBase implements Serializable {
 	public int hashCode() {
 		final int prime = 31;
 		int result = 1;
+		result = prime * result + ((version == null) ? 0 : version.hashCode());
 		result = prime * result + ((guid == null) ? 0 : guid.hashCode());
 		result = prime * result + ((id == null) ? 0 : id.hashCode());
 		result = prime * result + ((type == null) ? 0 : type.hashCode());
@@ -126,6 +147,11 @@ public class XXTag extends XXDBBase implements Serializable {
 		if (getClass() != obj.getClass())
 			return false;
 		XXTag other = (XXTag) obj;
+		if (version == null) {
+			if (other.version != null)
+				return false;
+		} else if (!version.equals(other.version))
+			return false;
 		if (guid == null) {
 			if (other.guid != null)
 				return false;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java
index 256522a..5a3df65 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java
@@ -29,6 +29,7 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
+import javax.persistence.Version;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.ranger.common.AppConstants;
@@ -49,6 +50,7 @@ public class XXTagDef extends XXDBBase implements Serializable {
 	@Column(name = "guid", unique = true, nullable = false, length = 512)
 	protected String guid;
 
+	@Version
 	@Column(name = "version")
 	protected Long version;
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java
----------------------------------------------------------------------
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 ddbcb91..ff4d297 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
@@ -78,13 +78,11 @@ import org.apache.ranger.plugin.policyengine.RangerPolicyEngineOptions;
 import org.apache.ranger.plugin.policyevaluator.RangerPolicyEvaluator;
 import org.apache.ranger.plugin.service.ResourceLookupContext;
 import org.apache.ranger.plugin.store.PList;
-import org.apache.ranger.plugin.store.ServiceStore;
 import org.apache.ranger.plugin.store.EmbeddedServiceDefsUtil;
 import org.apache.ranger.plugin.util.GrantRevokeRequest;
 import org.apache.ranger.plugin.util.SearchFilter;
 import org.apache.ranger.plugin.util.ServicePolicies;
 import org.apache.ranger.security.context.RangerAPIList;
-import org.apache.ranger.security.context.RangerPreAuthSecurityHandler;
 import org.apache.ranger.service.RangerPolicyService;
 import org.apache.ranger.service.RangerServiceDefService;
 import org.apache.ranger.service.RangerServiceService;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/e250f029/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java
b/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java
index 9ee2c2e..8c73c4c 100644
--- a/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java
+++ b/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java
@@ -218,6 +218,8 @@ public abstract class RangerPolicyServiceBase<T extends XXPolicyBase,
V extends
 		rangerPolItem.setGroups(grpList);
 
 		rangerPolItem.setDelegateAdmin(xPolItem.getDelegateAdmin());
+		rangerPolItem.setIsEnabled(xPolItem.getIsEnabled());
+		rangerPolItem.setComments(xPolItem.getComments());
 		return rangerPolItem;
 	}
 


Mime
View raw message