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/04/14 14:59:06 UTC

[ranger] 02/02: RANGER-2768 : Ranger audit UI updates to render action field.

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 4e3500192f88cf6c232d729797d08f475aaef44e
Author: Nitin Galave <ni...@apache.org>
AuthorDate: Tue Apr 14 17:24:21 2020 +0530

    RANGER-2768 : Ranger audit UI updates to render action field.
    
    Signed-off-by: Mehul Parikh <me...@apache.org>
---
 .../webapp/scripts/modules/globalize/message/en.js |  1 +
 .../webapp/scripts/views/reports/AuditLayout.js    | 29 +++++++++++++++++++---
 security-admin/src/main/webapp/styles/xa.css       | 10 ++++++++
 .../reports/AuditAccessLogDetail_tmpl.html         | 15 ++++++++---
 4 files changed, 49 insertions(+), 6 deletions(-)

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 d8838c0..f7bd58c 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
@@ -284,6 +284,7 @@ define(function(require) {
                 clientIP                        : 'Client IP',
                 eventCount                      : 'Event Count',
                 tags                            : 'Tags',
+                permission                      : 'Permission'
 
 			},
 			btn : {
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 976bc43..e4c4a3b 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -219,6 +219,7 @@ define(function(require) {
 					<th class="renderable name">Resource</th>\
 					<th class="renderable cip"></th>\
 					<th class="renderable cip"></th>\
+					<th class="renderable cip"></th>\
 					<th class="renderable cip"> </th>\
 					<th class="renderable aip" > </th>\
 					<th class="renderable aip" > </th>\
@@ -423,10 +424,11 @@ define(function(require) {
                                     {text : 'Resource Type',label : 'resourceType', urlLabel : 'resourceType'},
                                     {text : 'Cluster Name',label : 'cluster', urlLabel : 'clusterName'},
                                     {text : 'Zone Name',label : 'zoneName', urlLabel : 'zoneName'},
-                                    {text : localization.tt("lbl.agentHost"), label :"agentHost", urlLabel : 'agentHost'}
+                                    {text : localization.tt("lbl.agentHost"), label :"agentHost", urlLabel : 'agentHost'},
+                                   //{text : localization.tt("lbl.permission"), label :'action', urlLabel : 'permission'}
                                 ];
             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', 'Exclude User', localization.tt("lbl.agentHost")];//,'Policy ID'
+            'Client IP','Tags','Cluster Name', 'Zone Name', 'Exclude User', localization.tt("lbl.agentHost")];//, localization.tt("lbl.permission")];//,'Policy ID'
                         this.clearVisualSearch(this.accessAuditList, serverAttrName);
                         this.searchInfoArr =[{text :'Access Enforcer', info :localization.tt('msg.accessEnforcer')},
                                             {text :'Access Type' 	, info :localization.tt('msg.accessTypeMsg')},
@@ -443,7 +445,8 @@ define(function(require) {
                                             {text :'User' 			, info :localization.tt('h.userMsg')},
                                             {text :'Exclude User' 	, info :localization.tt('h.userMsg')},
                                             {text :'Application' 	, info :localization.tt('h.application')},
-                                            {text :'Tags' 			, info :localization.tt('h.tagsMsg')} ];
+                                            {text :'Tags' 			, info :localization.tt('h.tagsMsg')},
+                                            {text : localization.tt("lbl.permission"), info : localization.tt("lbl.permission")},];
                         //initilize info popover
                         XAUtils.searchInfoPopover(this.searchInfoArr , this.ui.iconSearchInfo , 'bottom');
                         //Set query(search filter values in query)
@@ -1209,6 +1212,8 @@ define(function(require) {
                             escape : true,
                         }).open();
                         modal.$el.find('.cancel').hide();
+                        modal.$el.addClass('modal-dialog-size');
+                        modal.$el.find('.modal-body').addClass('modal-body-size');
                     }
 				}
 			});
@@ -1334,6 +1339,24 @@ define(function(require) {
 						sortable:false,
 						editable:false
 					},
+					action : {
+						label : localization.tt("lbl.permission"),
+						cell: "html",
+						click : false,
+						drag : false,
+						editable:false,
+						sortable : false,
+						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+							fromRaw : function (rawValue, model) {
+								rawValue = _.escape(rawValue);
+								if(_.isUndefined(rawValue) || _.isEmpty(rawValue)){
+									return '<center>--</center>';
+								}else{
+									return '<span  class="label label-info" title="'+rawValue+'">'+rawValue+'</span>';
+								}
+							}
+						})
+					},
 					accessResult : {
 						label : localization.tt("lbl.result"),
 						cell: "html",
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index c8eb397..00a2c67 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -2944,5 +2944,15 @@ a:focus,a:hover,a.active,a:active{
   background-color:#2996ba;
 }
 
+.modal-dialog-size {
+  width: 750px;
+  height: 625px;
+  margin-left: 0px;
+  left: 30%
+}
+
+.modal-body-size {
+  max-height: 525px;
+}
 
 /*End of Overriden styles*/
\ No newline at end of file
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 6e0ac8f..ec6795f 100644
--- a/security-admin/src/main/webapp/templates/reports/AuditAccessLogDetail_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/AuditAccessLogDetail_tmpl.html
@@ -15,9 +15,6 @@
   limitations under the License.
 --}}
 <div id="serviceDetails" class="row-fluid">
-    <p class="formHeader">
-        {{tt 'lbl.auditAccessDetail'}} :
-    </p>
     <table class="table table-bordered table-condensed">
         <tbody>
            <tr>
@@ -131,6 +128,18 @@
             </tr>
             <tr>
                 <td>
+                    {{tt 'lbl.permission'}}
+                </td>
+                <td>
+                    {{#if auditaccessDetail.action}}
+                        {{auditaccessDetail.action}}
+                    {{else}}
+                        --
+                    {{/if}}
+                </td>
+            </tr>
+            <tr>
+                <td>
                     {{tt 'lbl.result'}}
                 </td>
                 <td>