You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by sn...@apache.org on 2014/09/05 04:43:59 UTC

git commit: ARGUS-31:Show Policy Name in the Audit Admin tab

Repository: incubator-argus
Updated Branches:
  refs/heads/master bcc71ef22 -> 2ddb59fb4


ARGUS-31:Show Policy Name in the Audit Admin tab

Signed-off-by: sneethiraj <sn...@apache.org>


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

Branch: refs/heads/master
Commit: 2ddb59fb4b8ba2ee7761c22368b76e1f68f4d7ad
Parents: bcc71ef
Author: vperiasamy <vp...@hortonworks.com>
Authored: Wed Sep 3 18:41:52 2014 -0400
Committer: sneethiraj <sn...@apache.org>
Committed: Thu Sep 4 22:43:30 2014 -0400

----------------------------------------------------------------------
 .../java/com/xasecure/service/XPermMapService.java    | 14 ++++++++++++++
 .../java/com/xasecure/service/XResourceService.java   |  2 +-
 .../scripts/views/reports/OperationDiffDetail.js      | 10 +++++++++-
 .../reports/KnoxPolicyDeleteOperationDiff_tmpl.html   |  3 ++-
 .../reports/KnoxPolicyOperationDiff_tmpl.html         |  3 ++-
 .../reports/KnoxPolicyUpdateOperationDiff_tmpl.html   |  3 ++-
 .../reports/PolicyDeleteOperationDiff_tmpl.html       |  3 ++-
 .../templates/reports/PolicyOperationDiff_tmpl.html   |  3 ++-
 .../reports/PolicyUpdateOperationDiff_tmpl.html       |  3 ++-
 9 files changed, 36 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/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 c20cfa8..677bfc1 100644
--- a/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
@@ -8,6 +8,7 @@ import java.util.List;
 import com.xasecure.common.SearchCriteria;
 import com.xasecure.common.SearchField;
 
+import org.apache.commons.lang.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Service;
@@ -159,6 +160,13 @@ public class XPermMapService extends XPermMapServiceBase<XXPermMap, VXPermMap> {
 				String fieldName = field.getName();
 				if(!trxLogAttrs.containsKey(fieldName)){
 					continue;
+//				int policyType = vObj.getIpAddress();
+				/*if(policyType == AppConstants.ASSET_HDFS){
+					String[] ignoredAttribs = {"ipAddress"};
+					if(ArrayUtils.contains(ignoredAttribs, fieldName)){
+						continue;
+					}
+				}*/	
 //				} else {
 //					if(isGroupPolicy){
 //						if(fieldName.equalsIgnoreCase("userId")){
@@ -170,6 +178,12 @@ public class XPermMapService extends XPermMapServiceBase<XXPermMap, VXPermMap> {
 //						}
 //					}
 				}
+				Long assetId = xADaoManager.getXXResource().getById(vObj.getResourceId()).getAssetId();
+				int policyType = xADaoManager.getXXAsset().getById(assetId).getAssetType();
+				if(policyType != AppConstants.ASSET_KNOX){
+					if(fieldName.equals("ipAddress"))
+						continue;
+				} 
 				
 				VTrxLogAttr vTrxLogAttr = trxLogAttrs.get(fieldName);
 				

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/security-admin/src/main/java/com/xasecure/service/XResourceService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XResourceService.java b/security-admin/src/main/java/com/xasecure/service/XResourceService.java
index babe37d..1e6dec7 100644
--- a/security-admin/src/main/java/com/xasecure/service/XResourceService.java
+++ b/security-admin/src/main/java/com/xasecure/service/XResourceService.java
@@ -1006,7 +1006,7 @@ public class XResourceService extends
 							break;
 						}
 					}
-					if(value.equalsIgnoreCase(oldValue)){
+					if(value.equalsIgnoreCase(oldValue) && !fieldName.equals("policyName")){
 						continue;
 					}
 					xTrxLog.setPreviousValue(oldValue);

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/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 dc5a591..fc1773b 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
@@ -58,7 +58,8 @@ define(function(require){
         							isUserPerm 					: this.isUserPerm,
         							groupList					: this.groupList,
         							userList					: this.userList,
-        							repositoryType				: this.repositoryType
+        							repositoryType				: this.repositoryType,
+        							policyName					: this.policyName
         			  });
         	}
         	if(this.templateType == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value){
@@ -257,6 +258,13 @@ define(function(require){
 						that.template = KnoxPolicyUpdateOperationDiff_tmpl;
 					if(that.repositoryType == XAEnums.AssetType.ASSET_KNOX.label && m.get('action') == "delete")
 						that.template = KnoxPolicyDeleteUpdateOperationDiff_tmpl;
+				}else if(m.get('attributeName') == 'Policy Name'){
+					if(m.get('action') != 'delete')
+						that.policyName = m.get('newValue');
+					else
+						that.policyName = m.get('previousValue');
+					if(m.get('newValue') == m.get('previousValue'))
+						modelColl.push(m);
 				}
 				
 				if(_.isUndefined(m.get('attributeName')))

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/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
index 9bb9d09..756394c 100644
--- a/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
@@ -1,4 +1,5 @@
-<label class="no-margin label-size13-weightbold">Name : {{objectName}}</label>
+<!-- <label class="no-margin label-size13-weightbold">Name : {{objectName}}</label> -->
+<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</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>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/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
index 717f2ac..fa6b714 100644
--- a/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
@@ -1,5 +1,6 @@
 <div class="diff-content">
-	<label class="no-margin label-size13-weightbold">Name : {{objectName}}</label>
+	<!-- <label class="no-margin label-size13-weightbold">Name : {{objectName}}</label> -->
+	<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</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>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/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
index c58fea8..13d7d7d 100644
--- a/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
@@ -2,7 +2,8 @@
 	<div class="row-fluid">
 		<div class="span6">
 			<!-- <label class="no-margin label-size13-weightbold">ID : {{objectId}}</label> -->
-			<label class="no-margin label-size13-weightbold">Name : {{objectName}}</label>
+			<!-- <label class="no-margin label-size13-weightbold">Name : {{objectName}}</label> -->
+			<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</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>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html
index 909bcd0..397f1bb 100644
--- a/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html
@@ -1,4 +1,5 @@
-<label class="no-margin label-size13-weightbold">Name : {{objectName}}</label>
+<!-- <label class="no-margin label-size13-weightbold">Name : {{objectName}}</label> -->
+<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</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>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html
index 913aba4..c46b58a 100644
--- a/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html
@@ -1,5 +1,6 @@
 <div class="diff-content">
-	<label class="no-margin label-size13-weightbold">Name : {{objectName}}</label>
+	<!-- <label class="no-margin label-size13-weightbold">Name : {{objectName}}</label> -->
+	<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</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>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/2ddb59fb/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html
index 795bc34..21af09e 100644
--- a/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html
@@ -1,7 +1,8 @@
 <div class="diff-content">
 	<div class="row-fluid">
 		<div class="span6">
-			<label class="no-margin label-size13-weightbold">Name : {{objectName}}</label>
+			<!-- <label class="no-margin label-size13-weightbold">Name : {{objectName}}</label> -->
+			<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</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>