You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ab...@apache.org on 2019/05/10 17:07:31 UTC

[ranger] branch master updated: RANGER-2424: Track and display application id of service generating access audit on access audit page

This is an automated email from the ASF dual-hosted git repository.

abhay 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 f2d310a  RANGER-2424: Track and display application id of service generating access audit on access audit page
f2d310a is described below

commit f2d310a54ee64a1738a9c1a6afdd93d032e64ddf
Author: Abhay Kulkarni <ab...@apache.org>
AuthorDate: Fri May 10 09:32:34 2019 -0700

    RANGER-2424: Track and display application id of service generating access audit on access audit page
---
 .../ranger/plugin/audit/RangerDefaultAuditHandler.java     |  4 ++++
 .../main/webapp/scripts/modules/globalize/message/en.js    |  2 ++
 .../src/main/webapp/scripts/views/reports/AuditLayout.js   | 14 +++++++++++++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/audit/RangerDefaultAuditHandler.java b/agents-common/src/main/java/org/apache/ranger/plugin/audit/RangerDefaultAuditHandler.java
index 5de13bd..5e2c492 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/audit/RangerDefaultAuditHandler.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/audit/RangerDefaultAuditHandler.java
@@ -206,6 +206,10 @@ public class RangerDefaultAuditHandler implements RangerAccessResultProcessor {
 			auditEvent.setEventId(generateNextAuditEventId());
 		}
 
+		if (auditEvent.getAgentId() == null) {
+			auditEvent.setAgentId(MiscUtil.getApplicationType());
+		}
+
 		auditEvent.setSeqNum(sequenceNumber++);
 	}
 
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 2220d50..a928745 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
@@ -181,6 +181,7 @@ define(function(require) {
 				operation						: 'Operation',
 				auditType						: 'Audit Type',
 				user							: 'User',
+				application						: 'Application',
 				actions							: 'Actions',
 				loginId							: 'Login ID',
 				loginType						: 'Login Type',
@@ -340,6 +341,7 @@ define(function(require) {
                 serviceTypeMsg              :'Select type of service.',
                 startDate                   :'Set start date.',
                 userMsg                     :'Name of User.',
+                application                 :'Application.',
                 tagsMsg                     :'Tag Name.',
                 endDate                     :'Set end date.',
                 groupNameMsg                :'Name of Group.',
diff --git a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
index 068ebce..18dba7a 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -178,6 +178,7 @@ define(function(require) {
 					<th class="renderable cip"></th>\
 					<th class="renderable ruser"></th>\
 					<th class="renderable ruser"></th>\
+					<th class="renderable cip"></th>\
 					<th class="renderable cip">Service</th>\
 					<th class="renderable name">Resource</th>\
 					<th class="renderable cip"></th>\
@@ -335,6 +336,7 @@ define(function(require) {
 			var serverListForRepoType =  this.serviceDefList.map(function(serviceDef){ return {'label' : serviceDef.get('name').toUpperCase(), 'value' : serviceDef.get('id')}; })
             var serviceUser = [{'label' : 'True' , 'value' : true},{'label' : 'False' , 'value' : false}]
 			var serverAttrName = [{text : 'Start Date',label :'startDate'},{text : 'End Date',label :'endDate'},
+				                  {text : 'Application',label : 'agentId'},
 			                      {text : 'User',label :'requestUser'},{text : 'Resource Name',label :'resourcePath'},
 			                      {text : 'Service Name',label :'repoName'},{text : 'Policy ID',label :'policyId'},
 			                      {text : 'Service Type',label :'repoType','multiple' : true, 'optionsArr' : serverListForRepoType},
@@ -343,7 +345,7 @@ define(function(require) {
 			                      {text : 'Client IP',label :'clientIP'},{text : 'Tags',label :'tags'},
 			                      {text : 'Resource Type',label : 'resourceType'},{text : 'Cluster Name',label : 'cluster'},
                                   {text : 'Zone Name',label : 'zoneName'},{text : localization.tt("lbl.agentHost"), label :"agentHost"}];
-            var searchOpt = ['Resource Type','Start Date','End Date','User','Service Name','Service Type','Resource Name','Access Type','Result','Access Enforcer',
+            var searchOpt = ['Resource Type','Start Date','End Date','Application','User','Service Name','Service Type','Resource Name','Access Type','Result','Access Enforcer',
             'Client IP','Tags','Cluster Name', 'Zone Name', localization.tt("lbl.agentHost")];//,'Policy ID'
                         this.clearVisualSearch(this.accessAuditList, serverAttrName);
                         this.searchInfoArr =[{text :'Access Enforcer', info :localization.tt('msg.accessEnforcer')},
@@ -359,6 +361,7 @@ define(function(require) {
                                         {text :'Service Type' 	, info :localization.tt('h.serviceTypeMsg')},
                                             {text :'Start Date'     , info :localization.tt('h.startDate')},
                                             {text :'User' 			, info :localization.tt('h.userMsg')},
+                                            {text :'Application' 	, info :localization.tt('h.application')},
                                             {text :'Tags' 			, info :localization.tt('h.tagsMsg')} ];
                         //initilize info popover
                         XAUtils.searchInfoPopover(this.searchInfoArr , this.ui.iconSearchInfo , 'bottom');
@@ -1036,6 +1039,8 @@ define(function(require) {
 
                     var policyVersion = this.model.get('policyVersion');
 
+                    var application = this.model.get('agentId');
+
 					var policy = new RangerPolicy({
 						id: policyId,
 						version:policyVersion
@@ -1132,6 +1137,13 @@ define(function(require) {
 							}
 						})
 					},
+				    agentId : {
+					label : 'Application',
+					cell: "String",
+					click : false,
+					drag : false,
+					editable:false
+				},
 					requestUser : {
 						label : 'User',
 						cell: "String",