ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject git commit: ARGUS-20: patch to show IP information in diff view for knox policies
Date Mon, 25 Aug 2014 22:31:23 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master dfdd5176c -> c90142915


ARGUS-20: patch to show IP information in diff view for knox policies


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

Branch: refs/heads/master
Commit: c90142915232826a759fab34b111b62b5a484108
Parents: dfdd517
Author: sneethiraj <sneethir@apache.org>
Authored: Mon Aug 25 14:02:25 2014 -0700
Committer: sneethiraj <sneethir@apache.org>
Committed: Mon Aug 25 14:02:25 2014 -0700

----------------------------------------------------------------------
 .../java/com/xasecure/common/XACommonEnums.java |  23 ++-
 .../java/com/xasecure/entity/XXResource.java    |   3 +
 .../com/xasecure/service/XPermMapService.java   |  11 +-
 .../main/java/com/xasecure/util/XAEnumUtil.java |  15 +-
 .../views/reports/OperationDiffDetail.js        |  38 ++--
 .../main/webapp/templates/helpers/XAHelpers.js  |  42 +++--
 .../KnoxPolicyDeleteOperationDiff_tmpl.html     | 100 ++++++++++
 .../reports/KnoxPolicyOperationDiff_tmpl.html   | 101 ++++++++++
 .../KnoxPolicyUpdateOperationDiff_tmpl.html     | 189 +++++++++++++++++++
 9 files changed, 483 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/java/com/xasecure/common/XACommonEnums.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/XACommonEnums.java b/security-admin/src/main/java/com/xasecure/common/XACommonEnums.java
index 53f107b..9d05c8b 100644
--- a/security-admin/src/main/java/com/xasecure/common/XACommonEnums.java
+++ b/security-admin/src/main/java/com/xasecure/common/XACommonEnums.java
@@ -498,11 +498,23 @@ public class XACommonEnums {
 	 * ASSET_HIVE is an element of enum AssetType. Its value is "ASSET_HIVE".
 	 */
 	public static final int ASSET_HIVE = 3;
+	/**
+	 * ASSET_HIVE is an element of enum AssetType. Its value is "ASSET_HIVE".
+	 */
+	public static final int ASSET_AGENT = 4;
+	/**
+	 * ASSET_HIVE is an element of enum AssetType. Its value is "ASSET_HIVE".
+	 */
+	public static final int ASSET_KNOX = 5;
+	/**
+	 * ASSET_HIVE is an element of enum AssetType. Its value is "ASSET_HIVE".
+	 */
+	public static final int ASSET_STORM = 6;
 
 	/**
 	 * Max value for enum AssetType_MAX
 	 */
-	public static final int AssetType_MAX = 3;
+	public static final int AssetType_MAX = 6;
 
 
 	/***************************************************************
@@ -1163,6 +1175,15 @@ public class XACommonEnums {
 		if( elementValue == 3 ) {
 			return "Hive"; //ASSET_HIVE
 		}
+		if( elementValue == 4 ) {
+			return "Agent"; //ASSET_HIVE
+		}
+		if( elementValue == 5 ) {
+			return "Knox"; //ASSET_HIVE
+		}
+		if( elementValue == 6 ) {
+			return "Storm"; //ASSET_HIVE
+		}
 		return null;
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/java/com/xasecure/entity/XXResource.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/entity/XXResource.java b/security-admin/src/main/java/com/xasecure/entity/XXResource.java
index 434aa0c..0868c88 100644
--- a/security-admin/src/main/java/com/xasecure/entity/XXResource.java
+++ b/security-admin/src/main/java/com/xasecure/entity/XXResource.java
@@ -685,6 +685,9 @@ public class XXResource extends XXDBBase implements java.io.Serializable
{
 		if( fieldName.equals("columnType") ) {
 			return "CommonEnums.PolicyType";
 		}
+		if( fieldName.equals("assetType") ) {
+			return "CommonEnums.AssetType";
+		}
 		//Later TODO
 		//return super.getEnumName(fieldName);
 		return null;

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPermMapService.java b/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
index 76973db..36bd9a3 100644
--- a/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
@@ -168,7 +168,7 @@ public class XPermMapService extends XPermMapServiceBase<XXPermMap,
VXPermMap> {
 				XXTrxLog xTrxLog = new XXTrxLog();
 				xTrxLog.setAttributeName(vTrxLogAttr.getAttribUserFriendlyName());
 			
-				String value = null;
+				String value = null,prevValue = "";
 				boolean isEnum = vTrxLogAttr.isEnum();
 				if(isEnum){
 					String enumName = XXPermMap.getEnumName(fieldName);
@@ -178,7 +178,11 @@ public class XPermMapService extends XPermMapServiceBase<XXPermMap,
VXPermMap> {
 					value = ""+field.get(vObj);
 //					XXUser xUser = xADaoManager.getXXUser().getById(Long.parseLong(value));
 //					value = xUser.getName();
-					if(value == null || value.equalsIgnoreCase("null") || stringUtil.isEmpty(value)){
+					if(fieldName.equals("ipAddress") && action.equalsIgnoreCase("update")){
+						prevValue = ""+field.get(mObj);
+						value = value.equalsIgnoreCase("null") ? "" : value; 
+					}
+					else if(value == null || value.equalsIgnoreCase("null") || stringUtil.isEmpty(value)){
 						continue;
 					}
 				}
@@ -191,6 +195,9 @@ public class XPermMapService extends XPermMapServiceBase<XXPermMap,
VXPermMap> {
 					// Not Changed.
 					xTrxLog.setNewValue(value);
 					xTrxLog.setPreviousValue(value);
+					if(fieldName.equals("ipAddress")){
+						xTrxLog.setPreviousValue(prevValue);
+					}
 				}
 				
 				xTrxLog.setAction(action);

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/java/com/xasecure/util/XAEnumUtil.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/util/XAEnumUtil.java b/security-admin/src/main/java/com/xasecure/util/XAEnumUtil.java
index 315a0e3..16d587a 100644
--- a/security-admin/src/main/java/com/xasecure/util/XAEnumUtil.java
+++ b/security-admin/src/main/java/com/xasecure/util/XAEnumUtil.java
@@ -961,23 +961,24 @@ public class XAEnumUtil {
 	vEnum.getElementList().add(vElement);
 
 	vElement = new VEnumElement();
-	vElement.setElementName("ASSET_KNOX");
+	vElement.setElementName("ASSET_AGENT");
 	vElement.setElementValue(4);
-	vElement.setElementLabel("Knox");
-	vElement.setRbKey("xa.enum.AssetType.ASSET_KNOX");
+	vElement.setElementLabel("Agent");
+	vElement.setRbKey("xa.enum.AssetType.ASSET_AGENT");
 	vElement.setEnumName(vEnum.getEnumName());
-
+	
 	vEnum.getElementList().add(vElement);
 	
 	vElement = new VEnumElement();
-	vElement.setElementName("ASSET_AGENT");
+	vElement.setElementName("ASSET_KNOX");
 	vElement.setElementValue(5);
-	vElement.setElementLabel("Agent");
-	vElement.setRbKey("xa.enum.AssetType.ASSET_AGENT");
+	vElement.setElementLabel("Knox");
+	vElement.setRbKey("xa.enum.AssetType.ASSET_KNOX");
 	vElement.setEnumName(vEnum.getEnumName());
 
 	vEnum.getElementList().add(vElement);
 	
+	
 	vElement = new VEnumElement();
 	vElement.setElementName("ASSET_STORM");
 	vElement.setElementValue(6);

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js b/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
index f708859..dc5a591 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
@@ -18,6 +18,9 @@ define(function(require){
 	var PolicyOperationDiff_tmpl 		= require('hbs!tmpl/reports/PolicyOperationDiff_tmpl');
 	var PolicyUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/PolicyUpdateOperationDiff_tmpl');
 	var PolicyDeleteUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/PolicyDeleteOperationDiff_tmpl');
+	var KnoxPolicyOperationDiff_tmpl 		= require('hbs!tmpl/reports/KnoxPolicyOperationDiff_tmpl');
+	var KnoxPolicyUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/KnoxPolicyUpdateOperationDiff_tmpl');
+	var KnoxPolicyDeleteUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/KnoxPolicyDeleteOperationDiff_tmpl');
 	var AssetOperationDiff_tmpl 		= require('hbs!tmpl/reports/AssetOperationDiff_tmpl');
 	var AssetUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/AssetUpdateOperationDiff_tmpl');
 	var UserOperationDiff_tmpl 			= require('hbs!tmpl/reports/UserOperationDiff_tmpl');
@@ -97,8 +100,8 @@ define(function(require){
 			_.extend(this, _.pick(options, 'classType','objectName','objectId','objectCreatedDate','action','userName'));
 			this.bindEvents();
 			//this.initializeDiffOperation();
-			
 			this.getTemplateForView();
+			
 		},
 
 		/** all events binding here */
@@ -120,7 +123,6 @@ define(function(require){
 				if(_.isEmpty($(m).text().trim()))
 					$(m).removeClass('change-row').text('--');
 			});
-			
 		},
 		getTemplateForView : function(){
 			if(this.classType == XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value){
@@ -145,10 +147,12 @@ define(function(require){
 				}
 				this.resourceDiffOperation();
 			} 
-			if(this.classType == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value){
+			if(this.classType == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value
+					|| this.classType == XAEnums.ClassTypes.CLASS_TYPE_USER_PROFILE.value
+					|| this.classType == XAEnums.ClassTypes.CLASS_TYPE_PASSWORD_CHANGE.value){
 				if(this.action == 'create' || this.action == 'delete'){
 					this.template = UserOperationDiff_tmpl;	
-				}else if(this.action == 'update'){
+				}else if(this.action == 'update' || this.action == "password change"){
 					this.template = UserUpdateOperationDiff_tmpl;
 				}else{
 					this.template = UserOperationDiff_tmpl;
@@ -195,19 +199,25 @@ define(function(require){
 			this.userList = [],this.groupList = [];
 			this.collection.each(function(m){
 				var attrName = m.get('attributeName'), type = 'permType';
-//				if(attrName == "IP Address")
-//					type = 'ipAddress';
-//				if(m.get('attributeName') == 'Permission Type' || m.get('attributeName') == "IP Address"){
-				if(m.get('attributeName') == 'Permission Type'){
+				if(attrName == "IP Address")
+					type = 'ipAddress';
+				if(m.get('attributeName') == 'Permission Type' || m.get('attributeName') == "IP Address"){
+//				if(m.get('attributeName') == 'Permission Type'){
 					if(m.get('parentObjectClassType') == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value){
 						if(m.get('action') != 'delete'){
 							if(m.get('action') == 'create'){
-								that.previousGroupPermList.push({groupName : m.get('parentObjectName'), permType
: ""});
+								var obj = {groupName : m.get('parentObjectName')};
+								obj[type] = ""; 
+								that.previousGroupPermList.push(obj);
 							}
-							that.newGroupPermList.push({groupName : m.get('parentObjectName'), permType : m.get('newValue')});
+							obj = {groupName : m.get('parentObjectName')};
+							obj[type] = m.get('newValue');
+							that.newGroupPermList.push(obj);
 						}
 						if(m.get('action') == 'delete' || m.get('action') == 'update'){
-							that.previousGroupPermList.push({groupName : m.get('parentObjectName'), permType :
m.get('previousValue')});
+							obj = {groupName : m.get('parentObjectName')};
+							obj[type] = m.get('previousValue');
+							that.previousGroupPermList.push(obj);
 						}
 						if($.inArray(m.get('parentObjectName'),that.groupList) < 0)
 							that.groupList.push(m.get('parentObjectName'));
@@ -241,6 +251,12 @@ define(function(require){
 					else
 						that.repositoryType = m.get('previousValue');
 					modelColl.push(m);
+					if(that.repositoryType == XAEnums.AssetType.ASSET_KNOX.label && m.get('action')
== "create")//XAEnums.AssetType.ASSET_KNOX.value)
+						that.template = KnoxPolicyOperationDiff_tmpl;
+					if(that.repositoryType == XAEnums.AssetType.ASSET_KNOX.label && m.get('action')
== "update")
+						that.template = KnoxPolicyUpdateOperationDiff_tmpl;
+					if(that.repositoryType == XAEnums.AssetType.ASSET_KNOX.label && m.get('action')
== "delete")
+						that.template = KnoxPolicyDeleteUpdateOperationDiff_tmpl;
 				}
 				
 				if(_.isUndefined(m.get('attributeName')))

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/helpers/XAHelpers.js b/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
index 7d0cbad..8c0e77a 100644
--- a/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
+++ b/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
@@ -390,67 +390,73 @@ define(function ( require ){
 	    return html;
 	});
 	Handlebars.registerHelper('highlightPermissionsForUser', function(perm, newValue, pemList,
hightlightValue) {
-		var html=perm.permType;
+		var type = 'permType';
+		if(_.isUndefined(perm.permType))
+			type = 'ipAddress';
+		var html = perm[type];
 		if(hightlightValue == 'old'){
-			if(_.isNull(perm.permType) || perm.permType != ""){
+			if(_.isNull(perm[type]) || perm[type] != ""){
 				if(!_.isUndefined(pemList[perm.userName]) || _.isEmpty(pemList)){
 					var isRemoved = true;
 					_.each(pemList[perm.userName] ,function(m){
-						if(m.permType == perm.permType)
+						if(m[type] == perm[type])
 							isRemoved = false;
 					});
 					if(isRemoved)
-						return html = '<span class="delete-text">'+perm.permType+'</span>';
+						return html = '<span class="delete-text">'+perm[type]+'</span>';
 				}else{
-					return html = '<span class="delete-text">'+perm.permType+'</span>';
+					return html = '<span class="delete-text">'+perm[type]+'</span>';
 				}
 			}
 		}else{
-			if(_.isNull(perm.permType) || perm.permType != ""){
+			if(_.isNull(perm[type]) || perm[type] != ""){
 				if(!_.isUndefined(pemList[perm.userName])){
 					var isNewAdd = true;
 					_.each(pemList[perm.userName] ,function(m){
-						if(m.permType == perm.permType)
+						if(m[type] == perm[type])
 							isNewAdd = false;
 					});
 					if(isNewAdd)
-						return html = '<span class="add-text">'+perm.permType+'</span>';
+						return html = '<span class="add-text">'+perm[type]+'</span>';
 				}else{
-					return html = '<span class="delete-text">'+perm.permType+'</span>';
+					return html = '<span class="delete-text">'+perm[type]+'</span>';
 				}
 			}
 		}
 	    return html;
 	});
 	Handlebars.registerHelper('highlightPermissionsForGroup', function(perm, newValue, pemList,
hightlightValue) {
-		var html = perm.permType;;
+		var type = 'permType';
+		if(_.isUndefined(perm.permType))
+			type = 'ipAddress';
+		var html = perm[type];
 		if(hightlightValue == 'old'){
-			if(_.isNull(perm.permType) || perm.permType != ""){
+			if(_.isNull(perm[type]) || perm[type] != ""){
 				if(!_.isUndefined(pemList[perm.groupName]) || _.isEmpty(pemList)){
 					var isRemoved = true;
 					_.each(pemList[perm.groupName] ,function(m){
-						if(m.permType == perm.permType)
+						if(m[type] == perm[type])
 							isRemoved = false;
 					});
 					if(isRemoved)
-						return html = '<span class="delete-text">'+perm.permType+'</span>';
+						return html = '<span class="delete-text">'+perm[type]+'</span>';
 				}else{
-					return html = '<span class="delete-text">'+perm.permType+'</span>';
+					return html = '<span class="delete-text">'+perm[type]+'</span>';
 				}
 			}
 		}else{
-			if(_.isNull(perm.permType) || perm.permType != ""){
+			if(_.isNull(perm[type]) || perm[type] != ""){
 				if(!_.isUndefined(pemList[perm.groupName])){
 					var isNewAdd = true;
 					_.each(pemList[perm.groupName] ,function(m){
-						if(m.permType == perm.permType)
+						if(m[type] == perm[type])
 							isNewAdd = false;
 					});
 					if(isNewAdd)
-						return html = '<span class="add-text">'+perm.permType+'</span>';
+						return html = '<span class="add-text">'+perm[type]+'</span>';
 				}
 				else{
-					return html = '<span class="add-text">'+perm.permType+'</span>';
+					return html = '<span class="add-text">'+perm[type]+'</span>';
 				}
 			}
 		}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
b/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
new file mode 100644
index 0000000..7de39d2
--- /dev/null
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
@@ -0,0 +1,100 @@
+<label class="no-margin label-size13-weightbold">ID : {{objectId}}</label>
+<label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+<label class="no-margin label-size13-weightbold"> Date  &nbsp;&nbsp;:  {{objectCreatedDate}}</label>
+<label class="no-margin label-size13-weightbold" > Deleted By  &nbsp;&nbsp;:
 {{userName}}</label>
+
+{{#if collection.length}}
+	<h5>Policy Details :</h5>
+	<div class="diff">
+		<div class="diff-left">
+			<h3>Fields</h3>
+			<ol class="attr">
+			{{#each collection}}
+				<li class="change-row">{{./this.attributes.attributeName}}</li>
+			{{/each}}	
+			</ol>
+		</div>
+		 <div class="diff-left" >
+			<h3>Old Value</h3>
+			<ol class="unstyled data">
+			{{#each collection}}
+				{{#if ./this.attributes.previousValue}}
+					{{#compare ./this.attributes.previousValue "eq" ''}}
+		 					<li>--</li>		
+					{{else}}
+		 					<li class="change-row">{{./this.attributes.previousValue}}</li>
+					{{/compare}}
+				{{else}}
+						<li>--</li>
+				{{/if}}		
+			{{/each}}	
+		</div> 
+	</div>
+{{/if}}	
+{{#if isGroupPerm}}	
+	<h5>Group Permissions :</h5>
+	<div class="diff">
+		<div class="diff-left">
+			<h3>Groups</h3>
+			<ol class="attr">
+			{{#eachProperty previousGroupPermList}}
+					<li class="change-row">{{property}}</li>
+			{{/eachProperty }}	
+			</ol>
+		</div>
+		<div class="diff-left" data-id="diff">
+			<h3>Old Value</h3>
+			<ol class="unstyled data">
+				{{#eachProperty previousGroupPermList}}
+					<li class="change-row">
+						{{#each value}}
+							{{#if permType}}
+								{{permType}} 
+								<span>,</span>
+							{{/if}}	
+						{{/each}}
+						{{#each value}}
+							{{#if ipAddress}}
+								IP : {{ipAddress}} 
+							{{/if}}	
+						{{/each}}
+				</li>
+			{{/eachProperty }}
+			</ol>
+		</div>
+	</div>
+{{/if}}
+{{#if isUserPerm}}
+	<h5>User Permissions :</h5>
+	<div class="diff">
+		<div class="diff-left" >
+			<h3>Users</h3>
+			<ol class="attr">
+				{{#eachProperty previousUserPermList}}
+					<li class="change-row">{{property}}</li>
+				{{/eachProperty }}	
+			</ol>
+		</div>
+	
+		<div class="diff-left" data-id="diff">
+			<h3>Old Value</h3>
+			<ol class="unstyled data">
+				{{#eachProperty previousUserPermList}}
+					<li class="change-row">
+						{{#each value}}
+							{{#if permType}}
+								{{permType}} 
+								<span>,</span>
+							{{/if}}	
+						{{/each}}
+						{{#each value}}
+							{{#if ipAddress}}
+								IP : {{ipAddress}} 
+							{{/if}}	
+						{{/each}}
+				</li>
+			{{/eachProperty }}
+			</ol>
+		</div>
+	</div> 
+{{/if}}	
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
b/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
new file mode 100644
index 0000000..29255a7
--- /dev/null
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
@@ -0,0 +1,101 @@
+<div class="diff-content">
+	<label class="no-margin label-size13-weightbold">Name : {{objectName}}</label>
+	<!-- <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
-->
+	<label class="no-margin label-size13-weightbold"> Date  &nbsp;&nbsp;:  {{objectCreatedDate}}</label>
+	<label class="no-margin label-size13-weightbold" > Created By  &nbsp;&nbsp;:
 {{userName}}</label>
+
+{{#if collection.length}}
+	<h5>Policy Details :</h5>
+	<div class="diff">
+		<div class="diff-left">
+			<h3>Fields</h3>
+			<ol class="attr">
+			{{#each collection}}
+				<li class="change-row">{{./this.attributes.attributeName}}</li>
+			{{/each}}	
+			</ol>
+		</div>
+		<div class="diff-right">
+			<h3>New Value</h3>
+			<ol class="unstyled data">
+			{{#each collection}}
+				{{#if ./this.attributes.newValue}}
+					{{#compare ./this.attributes.newValue "eq" ''}}
+  						<li>--</li>		
+					{{else}}
+  						<li class="change-row">{{./this.attributes.newValue}}</li>
+					{{/compare}}
+				{{else}}
+					<li>--</li>
+				{{/if}}		
+			{{/each}}	
+			</ol>
+		</div>
+	</div>
+{{/if}}	
+{{#if isGroupPerm}}	
+	<h5>Group Permissions :</h5>
+	<div class="diff">
+		<div class="diff-left">
+			<h3>Groups</h3>
+			<ol class="attr">
+			{{#eachProperty newGroupPermList}}
+					<li class="change-row">{{property}}</li>
+			{{/eachProperty }}	
+			</ol>
+		</div>
+		<div class="diff-right" data-id="diff">
+			<h3>New Value</h3>
+			<ol class="unstyled data">
+				{{#eachProperty newGroupPermList}}
+					<li class="change-row">
+						{{#each value}}
+							{{#if permType}}
+								{{permType}}<span>,</span>
+							{{/if}}	
+						{{/each}}
+						{{#each value}}
+							{{#if ipAddress}}
+								IP : {{ipAddress}}
+							{{/if}}	
+						{{/each}}
+				</li>
+			{{/eachProperty }}
+			</ol>
+		</div>
+	</div>
+{{/if}}
+{{#if isUserPerm}}
+	<h5>User Permissions :</h5>
+	<div class="diff">
+		<div class="diff-left">
+			<h3>Users</h3>
+			<ol class="attr">
+				{{#eachProperty newUserPermList}}
+					<li class="change-row">{{property}}</li>
+				{{/eachProperty }}	
+			</ol>
+		</div>
+		<div class="diff-right" data-id="diff">
+			<h3>New Value</h3>
+			<ol class="unstyled data">
+				{{#eachProperty newUserPermList}}
+					<li class="change-row">
+						{{#each value}}
+							{{#if permType}}
+								{{permType}}<span>,</span>
+							{{/if}}	
+						{{/each}}
+						{{#each value}}
+							{{#if ipAddress}}
+								IP : {{ipAddress}}
+							{{/if}}	
+						{{/each}}
+				</li>
+			{{/eachProperty }}
+			</ol>
+		</div>
+	</div> 
+{{/if}}	
+
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/c9014291/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
b/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
new file mode 100644
index 0000000..99297a3
--- /dev/null
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
@@ -0,0 +1,189 @@
+<div class="diff-content">
+	<div class="row-fluid">
+		<div class="span6">
+			<label class="no-margin label-size13-weightbold">ID : {{objectId}}</label>
+			<label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+			<label class="no-margin label-size13-weightbold"> Date  &nbsp;&nbsp;:  {{objectCreatedDate}}</label>
+			<label class="no-margin label-size13-weightbold" > Updated By  &nbsp;&nbsp;:
 {{userName}}</label>
+		</div>	
+		<div class="span6 text-right">
+			<div class="add-text legend"></div> Added
+			<div class="delete-text legend"></div> Deleted
+		</div>
+	</div>
+{{#if collection.length}}
+	<h5>Policy Details :</h5>
+	<div class="diff">
+		<div class="diff-left">
+			<h3>Fields</h3>
+			<ol class="attr">
+			{{#each collection}}
+				<li class="change-row">{{./this.attributes.attributeName}}</li>
+			{{/each}}	
+			</ol>
+		</div>
+	    <div class="diff-left">
+			<h3>Old Value</h3>
+			<ol class="unstyled data">
+			{{#each collection}}
+				{{#if ./this.attributes.previousValue}}
+					{{#compare ./this.attributes.previousValue "eq" ''}}
+		 					<li>--</li>		
+					{{else}}
+		 					<li class="change-row">{{{highlightNewForAttr ./this.attributes.newValue ./this.attributes.previousValue
'old'}}}</li>
+					{{/compare}}
+				{{else}}
+						<li>--</li>
+				{{/if}}		
+			{{/each}}	
+			</ol>
+		</div> 
+		<div class="diff-right">
+			<h3>New Value</h3>
+			<ol class="unstyled data">
+			{{#each collection}}
+				{{#if ./this.attributes.newValue}}
+					{{#compare ./this.attributes.newValue "eq" ''}}
+  						<li>--</li>		
+					{{else}}
+  						<li class="change-row">{{{highlightNewForAttr ./this.attributes.newValue ./this.attributes.previousValue
'new'}}}</li>
+					{{/compare}}
+				{{else}}
+					<li>--</li>
+				{{/if}}		
+			{{/each}}	
+			</ol>
+		</div>
+	</div>
+{{/if}}
+{{#if isGroupPerm}}	
+	<h5>Group Permissions :</h5>
+	<div class="diff">
+		<div class="diff-left">
+			<h3>Groups</h3>
+			<ol class="attr">
+			{{#each groupList}}
+					<li class="change-row">{{./this}}</li>
+			{{/each}}	
+			</ol>
+		</div>
+		<div class="diff-left" data-id="diff" data-name="policyDiff">
+			<h3>Old Value</h3>
+			<ol class="unstyled data">
+					{{#eachProperty previousGroupPermList}}
+						<li class="change-row">
+							{{#each value}}
+								{{#if permType}}
+							 		{{#compare permType "eq" ''}}
+									
+									{{else}}
+										{{{highlightPermissionsForGroup ../this ../../../property ../../../../newGroupPermList
'old'}}}
+										<span>,</span> 
+									{{/compare}}
+								{{/if}}	
+							{{/each}}
+							{{#each value}}
+								{{#if ipAddress}}
+							 		{{#compare ipAddress "eq" ''}}
+									
+									{{else}}
+										IP : {{{highlightPermissionsForGroup ../this ../../../property ../../../../newGroupPermList
'old'}}}
+										<span>,</span> 
+									{{/compare}}
+								{{/if}}	
+							{{/each}}
+						</li>
+					{{/eachProperty }}
+			</ol>
+		</div>
+		<div class="diff-right" data-id="diff" data-name="policyDiff">
+			<h3>New Value</h3>
+			<ol class="unstyled data">
+				{{#eachProperty newGroupPermList}}
+					<li class="change-row">
+						{{#each value}}
+							<!-- {{permType}}, -->
+							{{#if permType}}
+								{{{highlightPermissionsForGroup ./this ../property ../../../previousGroupPermList
'new'}}}
+								<span>,</span> 
+							{{/if}}
+						{{/each}}
+						{{#each value}}
+							<!-- {{permType}}, -->
+							{{#if ipAddress}}
+								IP : {{{highlightPermissionsForGroup ./this ../property ../../../previousGroupPermList
'new'}}}
+								<span>,</span> 
+							{{/if}}
+						{{/each}}
+				</li>
+			{{/eachProperty }}
+			</ol>
+		</div>
+	</div>
+{{/if}}
+{{#if isUserPerm}}
+	<h5>User Permissions :</h5>
+	<div class="diff">
+		<div class="diff-left">
+			<h3>Users</h3>
+			<ol class="attr">
+				{{#each userList}}
+					<li class="change-row">{{./this}}</li>
+				{{/each }}	
+			</ol>
+		</div>
+		<div class="diff-left" data-id="diff" data-name="policyDiff">
+			<h3>Old Value</h3>
+			<ol class="unstyled data">
+				{{#eachProperty previousUserPermList}}
+					<li class="change-row">
+						{{#each value}}
+							{{#if permType}}
+							 	{{#compare permType "eq" ''}}
+									
+								{{else}}
+									{{{highlightPermissionsForUser ../this ../../property ../../../../newUserPermList
'old'}}}
+									<span>,</span> 
+								{{/compare}}
+							{{/if}}	
+						{{/each}}
+						{{#each value}}
+							{{#if ipAddress}}
+							 	{{#compare permType "eq" ''}}
+									
+								{{else}}
+									IP : {{{highlightPermissionsForUser ../this ../../property ../../../../newUserPermList
'old'}}}
+									<span>,</span> 
+								{{/compare}}
+							{{/if}}	
+						{{/each}}
+					</li>
+				{{/eachProperty }}
+			</ol>
+		</div>
+		<div class="diff-right" data-id="diff" data-name="policyDiff">
+			<h3>New Value</h3>
+			<ol class="unstyled data">
+				{{#eachProperty newUserPermList}}
+					<li class="change-row">
+						{{#each value}}
+							{{#if permType}}
+								<!-- {{permType}}, -->
+								{{{highlightPermissionsForUser ./this ../property ../../../previousUserPermList 'new'}}}
+								<span>,</span>
+							{{/if}}
+						{{/each}}
+						{{#each value}}
+							{{#if ipAddress}}
+								<!-- {{permType}}, -->
+								 IP : {{{highlightPermissionsForUser ./this ../property ../../../previousUserPermList
'new'}}}
+								<span>,</span>
+							{{/if}}
+						{{/each}}
+				</li>
+				{{/eachProperty}}
+			</ol>
+		</div>
+	</div> 
+{{/if}}	
+</div>
\ No newline at end of file


Mime
View raw message