You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by me...@apache.org on 2020/10/27 09:23:02 UTC

[ranger] 01/03: RANGER-3056: Show Audit ID in Audit->Access tab

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

commit cddb43501f0c2b1dd1a1fc776e823aac4f0b12d8
Author: Kishor Gollapalliwar <ki...@gmail.com>
AuthorDate: Thu Oct 22 13:20:54 2020 +0530

    RANGER-3056: Show Audit ID in Audit->Access tab
    
    Signed-off-by: Mehul Parikh <me...@apache.org>
---
 .../java/org/apache/ranger/solr/SolrAccessAuditsService.java |  1 +
 .../src/main/java/org/apache/ranger/view/VXAccessAudit.java  | 11 +++++++++++
 .../src/main/webapp/scripts/modules/globalize/message/en.js  |  3 ++-
 .../webapp/templates/reports/AuditAccessLogDetail_tmpl.html  | 12 ++++++++++++
 4 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java b/security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java
index f3c6e3f..4b1cf5b 100644
--- a/security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java
+++ b/security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java
@@ -127,6 +127,7 @@ public class SolrAccessAuditsService extends AccessAuditsService {
 		if (value != null) {
 			// TODO: Converting ID to hashcode for now
 			accessAudit.setId((long) value.hashCode());
+			accessAudit.setEventId(value.toString());
 		}
 		
 		value = doc.getFieldValue("cluster");
diff --git a/security-admin/src/main/java/org/apache/ranger/view/VXAccessAudit.java b/security-admin/src/main/java/org/apache/ranger/view/VXAccessAudit.java
index a9a9cb9..4dfd207 100644
--- a/security-admin/src/main/java/org/apache/ranger/view/VXAccessAudit.java
+++ b/security-admin/src/main/java/org/apache/ranger/view/VXAccessAudit.java
@@ -152,6 +152,9 @@ public class VXAccessAudit extends VXDataObject implements java.io.Serializable
 
 	protected Long policyVersion;
 
+	// Event ID
+	protected String eventId;
+
 	/**
 	 * Default constructor. This will set all the attributes to default value.
 	 */
@@ -604,6 +607,13 @@ public class VXAccessAudit extends VXDataObject implements java.io.Serializable
 		this.policyVersion = policyVersion;
 	}
 
+	public String getEventId() {
+		return eventId;
+	}
+
+	public void setEventId(String eventId) {
+		this.eventId = eventId;
+	}
 
 	/**
 	 * This return the bean content in string format
@@ -641,6 +651,7 @@ public class VXAccessAudit extends VXDataObject implements java.io.Serializable
 		str += "clusterName={" + clusterName + "}";
 		str += "zoneName={" + zoneName + "}";
 		str += "agentHost={" + agentHost + "}";
+		str += "eventId={" + eventId + "}";
 		str += "}";
 		return str;
 	}
diff --git a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
index 0989976..3b99c86 100644
--- a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
+++ b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
@@ -286,7 +286,8 @@ define(function(require) {
                 tags                            : 'Tags',
                 permission                      : 'Permission',
                 override                        : 'Override',
-                normal                          : 'Normal'
+                normal                          : 'Normal',
+                auditId                         : 'Audit ID'
 
 			},
 			btn : {
diff --git a/security-admin/src/main/webapp/templates/reports/AuditAccessLogDetail_tmpl.html b/security-admin/src/main/webapp/templates/reports/AuditAccessLogDetail_tmpl.html
index e0f9348..fe41386 100644
--- a/security-admin/src/main/webapp/templates/reports/AuditAccessLogDetail_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/AuditAccessLogDetail_tmpl.html
@@ -17,6 +17,18 @@
 <div id="serviceDetails" class="row">
     <table class="table table-bordered table-condensed">
         <tbody>
+            <tr>
+                <td>
+                    {{tt 'lbl.auditId'}}
+                </td>
+                {{#compare auditaccessDetail.eventId "eq" ''}}
+                    <td> -- </td>
+                {{else}}
+                    <td>
+                        {{auditaccessDetail.eventId}}
+                    </td>
+                {{/compare}}
+            </tr>
            <tr>
                 <td>
                     {{tt 'lbl.policyId'}}