You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ga...@apache.org on 2016/11/28 08:34:03 UTC

incubator-ranger git commit: RANGER-1227 : UI hints for Audit search for Ranger Audit Logs & Policy Search on Policy Listing Page

Repository: incubator-ranger
Updated Branches:
  refs/heads/master de8f444d2 -> d328d023e


RANGER-1227 : UI hints for Audit search for Ranger Audit Logs & Policy Search on Policy Listing Page

Signed-off-by: Gautam Borad <ga...@apache.org>


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

Branch: refs/heads/master
Commit: d328d023ef69bf0c2952a461c547f2a9ff7fb722
Parents: de8f444
Author: Mehul Parikh <me...@freestoneinfotech.com>
Authored: Fri Nov 25 16:56:49 2016 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Mon Nov 28 14:01:31 2016 +0530

----------------------------------------------------------------------
 .../scripts/modules/globalize/message/en.js     | 41 +++++++++++++---
 .../src/main/webapp/scripts/utils/XAUtils.js    | 16 +++++++
 .../views/policies/RangerPolicyTableLayout.js   | 49 ++++++++++++++++----
 .../webapp/scripts/views/reports/AuditLayout.js | 26 +++++++++--
 .../scripts/views/reports/UserAccessLayout.js   | 15 ++++--
 security-admin/src/main/webapp/styles/xa.css    | 13 ++++++
 .../policies/RangerPolicyTableLayout_tmpl.html  |  6 ++-
 .../templates/reports/AuditLayout_tmpl.html     |  4 ++
 .../reports/UserAccessLayout_tmpl.html          |  7 ++-
 9 files changed, 151 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
----------------------------------------------------------------------
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 786d08f..72f10a3 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
@@ -302,9 +302,25 @@ define(function(require) {
 				searchForKeys				:"Search for your keys...",
 				encryption					: 'Encryption',
 				settings					: 'Settings',
-				
-				
-			},
+                                serviceNameMsg              :'Name of service.',
+                                serviceTypeMsg              :'Select type of service.',
+                                startDate                   :'Set start date.',
+                                userMsg                     :'Name of User.',
+                                tagsMsg                     :'Tag Name.',
+                                endDate                     :'Set end date.',
+                                groupNameMsg                :'Name of Group.',
+                                collection                  :'Solr collection.',
+                                database                    :'Hive database.',
+                                entity                      :'Atlas all-entity.',
+                                operation                   :'Atlas all-operation.',
+                                path                        :'Name of policy resource.',
+                                queue                       :'Yarn queue.',
+                                taxonomy                    :'Atlas all-taxonomy.',
+                                term                        :'Policy for all-term.',
+                                topic                       :'Kafka topic.',
+                                type                        :'Policy for all type.',
+                                udf                         :'Hive udf.',
+                        },
 			msg : {
 				deletePolicyValidationMsg : 'Policy does not have any settings for the specific resource. Policy will be deleted. Press [Ok] to continue. Press [Cancel] to edit the policy.',
 				areYouSureWantToDelete	  : 'Are you sure want to delete ?',
@@ -339,10 +355,21 @@ define(function(require) {
 				grpUpdatedSucc            : 'Group updated successfully',
 				grpCreatedSucc            : 'Group created successfully',
 				errorLoadingAuditLogs	  : 'Unable to connect to Audit store !!',
-				enterCustomMask			  : 'Please enter custom masked value or expression !!'
-				
-				
-				
+                                enterCustomMask			  : 'Please enter custom masked value or expression !!',
+                                    policyNameMsg         :'Enter name of policy.',
+                                        policyTypeMsg         :'Select Type of policy eg. access, masking, row level filter policies.',
+                                        componentMsg          :'Select Hadoop Component eg. HDFS, Hive etc.',
+                                        searchBy              :'Search by user name or group name.',
+                                        resourceMsg           :'Enter name of resource for eg. path, table/column name etc.',
+                                        accessEnforcer        :'Search by access enforcer name.',
+                                        accessTypeMsg         : 'Access type like READ_EXECUTE, WRITE_EXECUTE.',
+                                        clientIP              :'Search by IP address from where resource was accessed.',
+                                        resourceName          :'Resource name.',
+                                        resourceTypeMsg       :'Search by resource type based on component. eg. path in HDFS, database,table in Hive.',
+                                        resultMsg             :'Search by access result i.e Allowed/Denied logs.',
+                                        statusMsg             :'Status of Policy Enable/Disable.',
+                                        columnfamily          :'Hbase column-family',
+
 			},
 			plcHldr : {
 				search 						:'Search',

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/scripts/utils/XAUtils.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index a1915cf..14ac70b 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -173,6 +173,22 @@ define(function(require) {
 		});
 		return nvPairs;
 	};
+   //	Search Info it give popover box
+   XAUtils.searchInfoPopover = function(myArray, $infoEle, placement){
+		var msg = "";
+		myArray.map(function(m){
+                   msg += '<div><span><b>'+m.text+' : </b></span><span>'+m.info+'</span></div>'
+                })
+                $infoEle.popover({
+                   content: msg,
+               html: true,
+               trigger: 'hover',
+               placement: placement,
+               container: 'body'
+
+                })
+   };
+
 
 	/**
 	 * Notify Info the given title / text

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
index 5b7f584..964d263 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
@@ -75,7 +75,8 @@ define(function(require){
 			'btnShowLess' : '[data-id="showLess"]',
 			'visualSearch' : '.visual_search',
 			'policyTypeTab' : 'div[data-id="policyTypeTab"]',
-			'addNewPolicy' : '[data-js="addNewPolicy"]'
+                        'addNewPolicy' : '[data-js="addNewPolicy"]',
+                        'iconSearchInfo' : '[data-id="searchInfo"]',
 		},
 
 		/** ui events hash */
@@ -112,7 +113,7 @@ define(function(require){
 			this.rangerServiceDefModel.fetch({
 				cache : false,
 				async : false
-			})
+                        });
 		},
 		
 		initializePolicies : function(policyType){
@@ -130,8 +131,9 @@ define(function(require){
 			this.addVisualSearch();
 			this.renderTable();
 			this.initializePolicies();
+                        XAUtil.searchInfoPopover(this.searchInfoArray , this.ui.iconSearchInfo , 'bottom');
+
 		},
-		
 		/** all post render plugin initialization */
 		initializePlugins: function(){
 		},
@@ -316,21 +318,47 @@ define(function(require){
 			$td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').parents('div[data-id="groupsDiv"]').removeClass('set-height-groups');
 		},
 		addVisualSearch : function(){
-			var that = this;
-			var resourceSearchOpt = _.map(this.rangerServiceDefModel.get('resources'), function(resource){ return XAUtil.capitaliseFirstLetter(resource.name) });
+
+                        var that = this, resources = this.rangerServiceDefModel.get('resources');
+                        var policyType = this.collection.queryParams['policyType'];
+                        if(XAUtil.isMaskingPolicy(policyType) ){
+                                resources = this.rangerServiceDefModel.get('dataMaskDef')['resources'];
+                        }else if(XAUtil.isRowFilterPolicy(policyType) ){
+                                resources = this.rangerServiceDefModel.get('rowFilterDef')['resources'];
+                        }
+                        var resourceSearchOpt = _.map(resources, function(resource){
+                                        return { 'name' : resource.name, 'label' : resource.label };
+                        });
 			var PolicyStatusValue = _.map(XAEnums.ActiveStatus, function(status) { return { 'label': status.label, 'value': Boolean(status.value)}; });
 	
 			var searchOpt = ['Policy Name','Group Name','User Name','Status'];//,'Start Date','End Date','Today'];
-			searchOpt = _.union(searchOpt, resourceSearchOpt)
-			var serverAttrName  = [{text : "Policy Name", label :"policyNamePartial"},{text : "Group Name", label :"group"},
-			                       {text : "User Name", label :"user"}, {text : "Status", label :"isEnabled",'multiple' : true, 'optionsArr' : PolicyStatusValue}];
+                        searchOpt = _.union(searchOpt, _.map(resourceSearchOpt, function(opt){ return opt.label }))
+                        var serverAttrName  = [{text : "Group Name",  label :"group",   info:localization.tt('h.groupNameMsg')},
+                                               {text : "Policy Name", label :"policyNamePartial",  info :localization.tt('msg.policyNameMsg')},
+                                               {text : "Status",      info : localization.tt('msg.statusMsg') ,  label :"isEnabled",'multiple' : true, 'optionsArr' : PolicyStatusValue},
+                                               {text : "User Name",   label :"user" ,  info :localization.tt('h.userMsg')},
+                                               ];
 			                     // {text : 'Start Date',label :'startDate'},{text : 'End Date',label :'endDate'},
 				                 //  {text : 'Today',label :'today'}];
+                        var info = { collection : localization.tt('h.collection')    , column   :localization.tt('lbl.columnName'),
+                                         'column-family':localization.tt('msg.columnfamily') , database :localization.tt('h.database'),
+                                          entity        :localization.tt('h.entity') , keyname  :localization.tt('lbl.keyName'),
+                                          operation:localization.tt('h.operation')   , path:localization.tt('h.path') ,
+                                          queue:localization.tt('h.queue')        , service:localization.tt('h.serviceNameMsg'),
+                                          table:localization.tt('lbl.tableName')   , tag : localization.tt('h.tagsMsg'),
+                                          taxonomy:localization.tt('h.taxonomy')  ,term: localization.tt('h.term') ,
+                                          topic:localization.tt('h.topic')    ,topology:localization.tt('lbl.topologyName'),
+                                          type:localization.tt('h.type')    ,udf:localization.tt('h.udf') ,
+                                                 };
 			var serverRsrcAttrName = _.map(resourceSearchOpt,function(opt){ 
-				return { 'text': XAUtil.capitaliseFirstLetter(opt), 
-					'label': 'resource:'+XAUtil.lowerCaseFirstLetter(opt) }; 
+                                        return {
+                                                'text': opt.label,
+                                                'label': 'resource:'+ opt.name,
+                                                'info' : info[opt.name],
+                                        };
 			});
 			serverAttrName = _.union(serverAttrName, serverRsrcAttrName)
+                    this.searchInfoArray = serverAttrName;
 			var pluginAttr = {
 				      placeholder :localization.tt('h.searchForPolicy'),
 				      container : this.ui.visualSearch,
@@ -365,6 +393,7 @@ define(function(require){
 				};
 			window.vs = XAUtil.addVisualSearch(searchOpt,serverAttrName, this.collection,pluginAttr);
 		},
+
 		getActiveStatusNVList : function() {
 			var activeStatusList = _.filter(XAEnums.ActiveStatus, function(obj){
 				if(obj.label != XAEnums.ActiveStatus.STATUS_DELETED.label)

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
----------------------------------------------------------------------
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 023dcc8..744c7ac 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -84,7 +84,8 @@ define(function(require) {
 			tab 				: '.nav-tabs',
 			refreshTable		: '[data-id="refreshTable"]',
 			quickFilter			: '[data-id="quickFilter"]',
-			visualSearch		: '.visual_search'
+                        visualSearch		: '.visual_search',
+                        'iconSearchInfo' : '[data-id="searchInfo"]',
 			
 		},
 
@@ -143,6 +144,9 @@ define(function(require) {
 				this.addSearchForBigDataTab();
 				this.modifyTableForSubcolumns();
 			}
+                        this.addSearchForBigDataTab();
+                        XAUtils.searchInfoPopover(this.searchInfoArr , this.ui.iconSearchInfo , 'bottom');
+
 		 },
 		displayDatepicker : function ($el, callback) {
 			var input = $el.find('.search_facet.is_editing input.search_facet_input');
@@ -208,6 +212,7 @@ define(function(require) {
 					this.modifyTableForSubcolumns();
 					this.addSearchForBigDataTab();
 					this.listenTo(this.accessAuditList, "request", that.updateLastRefresh)
+                                        this.ui.iconSearchInfo.show();
 					break;
 				case "#admin":
 					this.currentTab = '#admin';
@@ -220,6 +225,7 @@ define(function(require) {
 					}
 					this.addSearchForAdminTab();
 					this.listenTo(this.trxLogList, "request", that.updateLastRefresh)
+                                        this.ui.iconSearchInfo.hide();
 					break;
 				case "#loginSession":
 					this.currentTab = '#loginSession';
@@ -232,6 +238,7 @@ define(function(require) {
 					});
 					this.addSearchForLoginSessionTab();
 					this.listenTo(this.authSessionList, "request", that.updateLastRefresh)
+                                        this.ui.iconSearchInfo.hide();
 					break;
 				case "#agent":
 					this.currentTab = '#agent';
@@ -245,6 +252,7 @@ define(function(require) {
 					});
 					this.addSearchForAgentTab();
 					this.listenTo(this.policyExportAuditList, "request", that.updateLastRefresh)
+                                        this.ui.iconSearchInfo.hide();
 					break;	
 			}
 			var lastUpdateTime = Globalize.format(new Date(),  "MM/dd/yyyy hh:mm:ss tt");
@@ -265,8 +273,20 @@ define(function(require) {
 			                      {text : 'Tags',label :'tags'},
 			                      {text : 'Resource Type',label : 'resourceType'}];
             var searchOpt = ['Resource Type','Start Date','End Date','User','Service Name','Service Type','Resource Name','Access Type','Result','Access Enforcer','Client IP','Tags'];//,'Policy ID'
-            this.clearVisualSearch(this.accessAuditList, serverAttrName);
-            
+		this.clearVisualSearch(this.accessAuditList, serverAttrName);
+		this.searchInfoArr =[{text :'Access Enforcer', info :localization.tt('msg.accessEnforcer')},
+		                    {text :'Access Type' 	, info :localization.tt('msg.accessTypeMsg')},
+		                    {text :'Client IP' 		, info :localization.tt('msg.clientIP')},
+		                    {text :'End Date'       , info :localization.tt('h.endDate')},
+		                    {text :'Resource Name' 	, info :localization.tt('msg.resourceName')},
+		                    {text :'Resource Type'  , info :localization.tt('msg.resourceTypeMsg')},
+		                    {text :'Result'			, info :localization.tt('msg.resultMsg')},
+		                    {text :'Service Name' 	, info :localization.tt('h.serviceNameMsg')},
+	                        {text :'Service Type' 	, info :localization.tt('h.serviceTypeMsg')},
+		                    {text :'Start Date'     , info :localization.tt('h.startDate')},
+		                    {text :'User' 			, info :localization.tt('h.userMsg')},
+		                    {text :'Tags' 			, info :localization.tt('h.tagsMsg')},];
+
 			//'Resource Type','Audit Type','Session IP','Client Type','Today',
             var query = '"Start Date": "'+Globalize.format(new Date(),"MM/dd/yyyy")+'"';
 			var pluginAttr = {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js b/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
index 0e2401e..39770d9 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
@@ -79,7 +79,8 @@ define(function(require) {'use strict';
 			downloadReport      : '[data-id="downloadReport"]',
 			policyType          : '[data-id="policyType"]',
 			btnShowMoreAccess 	: '[data-id="showMoreAccess"]',
-			btnShowLessAccess 	: '[data-id="showLessAccess"]'
+                        btnShowLessAccess 	: '[data-id="showLessAccess"]',
+                        'iconSearchInfo' 	: '[data-id="searchInfo"]',
 		},
 
 		/** ui events hash */
@@ -151,9 +152,17 @@ define(function(require) {'use strict';
 				urlString = urlString.slice(0,-1);
 			}
 			this.previousSearchUrl = urlString+"/service/plugins/policies/downloadExcel?";
-		},
+                        XAUtil.searchInfoPopover(this.getSearchInfoArray() , this.ui.iconSearchInfo , 'left');
 		
-		getResourceLists: function(collName, serviceDefName){
+                },
+                 getSearchInfoArray: function(){
+                         return [{text :'Policy Name' , info :localization.tt('msg.policyNameMsg')},
+                                 {text :'Policy Type' , info :localization.tt('msg.policyTypeMsg')},
+                                 {text :'Component'   , info :localization.tt('msg.componentMsg')},
+                                 {text :'Search By'   , info :localization.tt('msg.searchBy')},
+                                 {text :'Resource'    , info :localization.tt('msg.resourceMsg')}]
+                 },
+                 getResourceLists: function(collName, serviceDefName){
 
 			var that = this, coll = this[collName];
 			that.allowDownload = false;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/styles/xa.css
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index 1eb7b6e..d99a172 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -384,6 +384,19 @@ body {
     padding: 62px 0 0 0;
   }
 }
+/*  Seach Info btn*/
+.searchInfo{
+        margin-left:12px;
+        color:#4c504b;
+        font-size:larger;
+}
+.searchInfoUserAccsss{
+        margin-left:12px;
+        color:#4c504b;
+        font-size:large;
+        margin-top:10px
+}
+
 /* overriding backgrid height property */
 .backgrid td {
   height: auto;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/templates/policies/RangerPolicyTableLayout_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/policies/RangerPolicyTableLayout_tmpl.html b/security-admin/src/main/webapp/templates/policies/RangerPolicyTableLayout_tmpl.html
index bde6b37..5031c7f 100644
--- a/security-admin/src/main/webapp/templates/policies/RangerPolicyTableLayout_tmpl.html
+++ b/security-admin/src/main/webapp/templates/policies/RangerPolicyTableLayout_tmpl.html
@@ -30,13 +30,17 @@
 <h3 class="wrap-header bold"> {{tt 'lbl.listOfPolicies'}} : {{rangerService.attributes.name}} </h3>
 <div class="wrap non-collapsible m-height ">
 	<div>
+        <div>
 		<div class="span9">
 			<div class="visual_search"></div>
 		</div>
+
+                <i class="icon-info-sign searchInfo" title="Search Filter Hints" data-id="searchInfo"> </i>
+
 		<div class="clearfix">
 			<a data-js="addNewPolicy" href="#!/service/{{rangerService.id}}/policies/create/{{this.rangerPolicyType}}" class="btn btn-primary btn-right" type="button"> {{tt 'lbl.addNewPolicy'}} </a>
 		</div>
-		
+                </div>
 		<div data-id="r_table" class="clickable"></div>
 	</div>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html b/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
index 48467aa..854b47a 100644
--- a/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
@@ -34,7 +34,11 @@
 			<div class="span9">
 				<div class="visual_search"></div>
 			</div>
+                        <div>
+                <i class="icon-info-sign searchInfo" title="Search Filter Hints" data-id="searchInfo"> </i>
 		</div>
+
+                        </div>
 	</div>
 	<div class="row-fluid">
 		<div class="clearfix" data-id="refreshTable">

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d328d023/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html b/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html
index df7acfb..da323ef 100644
--- a/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html
@@ -17,7 +17,7 @@
 <h3 class="wrap-header bold"> Reports </h3>
 
 <div class="wrap non-collapsible ">
-	<h3 class="wrap-header reportSearchHeader">Search Criteria
+<h3 class="wrap-header reportSearchHeader">Search Criteria
 		<span class="label label-yellow pull-right" data-js="searchResult" ></span>
 	</h3>
 	<div class="wrap well ">
@@ -26,7 +26,7 @@
 				<div class="form-horizontal">
 					<div class="span12">
 						<div class="control-group">
-							<div class="span4">
+                                                    <div class="span4">
 								<label class="control-label">Policy Name</label>
 								<div class="controls">
 									<input type="text" name="policyName" data-js="policyName" autofocus >
@@ -38,6 +38,9 @@
 									<input type="text" data-id="policyType">
 								</div>
 							</div>
+                                                        <div class="pull-right">
+                                         <i class="icon-info-sign searchInfoUserAccsss" title="Search Filter Hints"  data-id="searchInfo"></i>
+                                </div>
 						</div>
 						<div class="control-group">
 							<div class="span4">