ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gau...@apache.org
Subject incubator-ranger git commit: RANGER-1246: Update UI hints for wildcards in search filters
Date Mon, 19 Dec 2016 05:46:43 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master 5e7b555cd -> 4b9497b62


RANGER-1246: Update UI hints for wildcards in search filters


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

Branch: refs/heads/master
Commit: 4b9497b62fdd2b7f0bd2c57b0331fe815ae928b8
Parents: 5e7b555
Author: Gautam Borad <gautam@apache.org>
Authored: Thu Dec 15 20:40:14 2016 +0530
Committer: Gautam Borad <gautam@apache.org>
Committed: Mon Dec 19 11:16:17 2016 +0530

----------------------------------------------------------------------
 .../main/webapp/scripts/modules/XAOverrides.js  |  9 ++++++-
 .../scripts/modules/globalize/message/en.js     | 14 ++++++----
 .../src/main/webapp/scripts/utils/XAEnums.js    |  2 +-
 .../src/main/webapp/scripts/utils/XAUtils.js    | 28 +++++++++++++++-----
 .../views/permissions/ModulePermsTableLayout.js | 20 +++++++++++---
 .../views/policies/RangerPolicyCreate.js        | 10 ++++++-
 .../views/policies/RangerPolicyTableLayout.js   |  1 +
 .../webapp/scripts/views/reports/AuditLayout.js |  7 ++++-
 .../scripts/views/reports/UserAccessLayout.js   |  1 +
 security-admin/src/main/webapp/styles/xa.css    |  4 ++-
 .../policies/RangerPolicyCreate_tmpl.html       | 12 ++++++---
 11 files changed, 83 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/modules/XAOverrides.js b/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
index 8122ae1..b23318e 100644
--- a/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
+++ b/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
@@ -458,7 +458,8 @@
 			  	}
 		  },
 		  renderSameLevelResource : function() {
-			  var that = this, dirtyFieldValue = null
+                          var that = this, dirtyFieldValue = null;
+                          var XAUtil = require('utils/XAUtils'), localization	= require('utils/XALangSupport');;
 			  if(!_.isUndefined(this.$resourceType) && this.$resourceType.length > 0){
 			  		if(!_.isNull(this.value) && !_.isEmpty(this.value)){
 			  			this.$resourceType.val(this.value.resourceType);
@@ -479,6 +480,12 @@
 			  			//resource are shown if parent is selected or showned
 			  			that.$el.parents('.control-group').attr('data-name', 'field-'+this.value);
 			  			that.formView.trigger('policyForm:parentChildHideShow',true);
+						if(!_.isUndefined(this.value)
+								&& ( XAUtil.capitaliseFirstLetter(this.value) === XAEnums.ResourceType.RESOURCE_TABLE.label
+										|| XAUtil.capitaliseFirstLetter(this.value) === XAEnums.ResourceType.RESOURCE_UDF.label)
){
+							XAUtil.alertPopup({ msg :localization.tt('msg.udfPolicyViolation') });
+						}
+
 					});
 			  	}
 		  },

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/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 63a5b0f..866844c 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
@@ -237,9 +237,9 @@ define(function(require) {
 				selectMaskingOption             : 'Select Masking Option',
 				versionTime                     : 'Version / Time',
 				serviceType                     : 'Service Type',
-                                hostName						: 'Host Name',
-                                selectAndAddUser                                : 'Select
and Add User',
-                                selectAndAddGroup                               : 'Select
and Add Group',
+                hostName						: 'Host Name',
+                selectAndAddUser                : 'Select and Add User',
+                selectAndAddGroup               : 'Select and Add Group',
 			},
 			btn : {
 				add							: 'Add',
@@ -368,7 +368,7 @@ define(function(require) {
                 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.',
+                accessTypeMsg           :'Search by 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.',
@@ -378,7 +378,11 @@ define(function(require) {
                 searchForPluginStatus   : "Search for Plugin Status....",
                 pleaseSelectUser        : 'Please select user.',
                 pleaseSelectGroup       : 'Please select group.',
-                addSelectedUserGroup	: 'Please add selected user/group to permissions else
user/group will not be added.'
+                addSelectedUserGroup	: 'Please add selected user/group to permissions else
user/group will not be added.',
+                maskingPolicyInfoMsg   	: 'Please ensure that users/groups listed in this
policy have access to the column via an <b>Access Policy</b>. This policy does
not implicitly grant access to the column.',
+                rowFilterPolicyInfoMsg 	: 'Please ensure that users/groups listed in this
policy have access to the table via an <b>Access Policy</b>. This policy does
not implicitly grant access to the table.',
+                udfPolicyViolation      : '<b> Warning !!</b>  : UDF create is
a privileged operation. Please make sure you grant them to only trusted users.'
+
 
 			},
 			plcHldr : {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/security-admin/src/main/webapp/scripts/utils/XAEnums.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAEnums.js b/security-admin/src/main/webapp/scripts/utils/XAEnums.js
index c05dcf3..164e939 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAEnums.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAEnums.js
@@ -283,7 +283,7 @@ define(function(require) {
 		RESOURCE_COL_FAM:{value:4, label:'Column Family', rbkey:'xa.enum.ResourceType.RESOURCE_COL_FAM',
tt: 'lbl.ResourceType_RESOURCE_COL_FAM'},
 		RESOURCE_COLUMN:{value:5, label:'Column', rbkey:'xa.enum.ResourceType.RESOURCE_COLUMN',
tt: 'lbl.ResourceType_RESOURCE_COLUMN'},
 		RESOURCE_VIEW:{value:6, label:'VIEW', rbkey:'xa.enum.ResourceType.RESOURCE_VIEW', tt: 'lbl.ResourceType_RESOURCE_VIEW'},
-		RESOURCE_UDF:{value:7, label:'UDF', rbkey:'xa.enum.ResourceType.RESOURCE_UDF', tt: 'lbl.ResourceType_RESOURCE_UDF'},
+                RESOURCE_UDF:{value:7, label:'Udf', rbkey:'xa.enum.ResourceType.RESOURCE_UDF',
tt: 'lbl.ResourceType_RESOURCE_UDF'},
 		RESOURCE_VIEW_COL:{value:8, label:'View Column', rbkey:'xa.enum.ResourceType.RESOURCE_VIEW_COL',
tt: 'lbl.ResourceType_RESOURCE_VIEW_COL'},
 		RESOURCE_TOPOLOGY:{value:9, label:'Topology', rbkey:'xa.enum.ResourceType.RESOURCE_TOPOLOGY',
tt: 'lbl.RESOURCE_TOPOLOGY'},
 		RESOURCE_SERVICE:{value:10, label:'Service', rbkey:'xa.enum.ResourceType.RESOURCE_SERVICE',
tt: 'lbl.RESOURCE_SERVICE'},

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/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 c026b52..4493e91 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -175,7 +175,7 @@ define(function(require) {
 	};
    //	Search Info it give popover box
    XAUtils.searchInfoPopover = function(myArray, $infoEle, placement){
-		var msg = "";
+		var msg = "<span> ( <b> *</b> ) Indicates wildcard support.</span>";
 		myArray.map(function(m){
                    msg += '<div><span><b>'+m.text+' : </b></span><span>'+m.info+'</span></div>'
                 })
@@ -537,22 +537,36 @@ define(function(require) {
 	};
 
 	XAUtils.showGroupsOrUsers = function(rawValue, model, userOrGroups) {
-                var showMoreLess = false, objArr;
+                var showMoreLess = false, objArr, lastShowMoreCnt = 1, j = 1, listShownCnt
= 5000;
 		if (!_.isArray(rawValue) && rawValue.length == 0)
 			return '--';
                 objArr = (userOrGroups == 'groups') ? _.pluck(rawValue, 'groupName') : _.pluck(rawValue,
'userName');
 		var newObjArr = _.map(objArr, function(name, i) {
 			if (i >= 4) {
-				return '<span class="label label-info float-left-margin-2" policy-' + userOrGroups
-						+ '-id="' + model.id + '" style="display:none;">'
-						+ name + '</span>';
+                                var eleStr = '', span = '<span class="label label-info
float-left-margin-2" policy-' + userOrGroups
+                                        + '-id="' + model.id +'">'
+                                        +  _.escape(name) + '</span>';
+                                if( (i + listShownCnt ) === (listShownCnt*j) + 4){
+                                        eleStr = '<div data-id="moreSpans" style="display:none;">'+span;
+                                        if(i == objArr.length - 1){
+                                                eleStr += '</div>';
+                                        }
+                                        lastShowMoreCnt = ( listShownCnt*j) + 4;
+                                        j++;
+                                }else if(i === lastShowMoreCnt - 1 || i == objArr.length
- 1){
+                                        eleStr = span + '</div>';
+
+                                }else{
+                                        eleStr = span;
+                                }
+                                return eleStr;
 			} else if (i == 3 && objArr.length > 4) {
 				showMoreLess = true;
 				return '<span class="label label-info float-left-margin-2" policy-' + userOrGroups
-						+ '-id="' + model.id + '">' + name + '</span>';
+                                                + '-id="' + model.id + '">' +  _.escape(name)
+ '</span>';
 			} else {
 				return '<span class="label label-info float-left-margin-2" policy-' + userOrGroups
-						+ '-id="' + model.id + '">' + name + '</span>';
+                                                + '-id="' + model.id + '">' +  _.escape(name)
+ '</span>';
 			}
 		});
 		if (showMoreLess) {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
index 76dc027..92c07c7 100644
--- a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
@@ -184,9 +184,21 @@ define(function(require){
 				attrName = 'policy-users-id';
 			}
 			var $td = $(e.currentTarget).parents('td');
-			$td.find('['+attrName+'="'+id+'"]').show();
-			$td.find('[data-id="showLess"]['+attrName+'="'+id+'"]').show();
-			$td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').hide();
+                        var show = false, shownCnt = 1;
+                        $.each($td.find('[data-id="moreSpans"]'), function(i, div){
+                                if($(div).is(':hidden') && !show){
+                                        $(div).show();
+                                        show = true;
+                                        return false;
+                                }
+                                if(!$(div).is(':hidden')){
+                                        shownCnt++;
+                                }
+                        })
+                        if($td.find('[data-id="moreSpans"]').length == shownCnt){
+                                $td.find('[data-id="showLess"]['+attrName+'="'+id+'"]').show();
+                                $td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').hide();
+                        }
 			$td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').parents('div[data-id="groupsDiv"]').addClass('set-height-groups');
 		},
 		onShowLess : function(e){
@@ -197,7 +209,7 @@ define(function(require){
 				attrName = 'policy-users-id';
 			}
 			var $td = $(e.currentTarget).parents('td');
-			$td.find('['+attrName+'="'+id+'"]').slice(4).hide();
+                        $td.find('[data-id="moreSpans"]').hide();
 			$td.find('[data-id="showLess"]['+attrName+'="'+id+'"]').hide();
 			$td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').show();
 			$td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').parents('div[data-id="groupsDiv"]').removeClass('set-height-groups');

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
index 8dc3485..728e5bf 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
@@ -43,8 +43,16 @@ define(function(require){
 		
     	template : RangerPolicycreateTmpl,
     	templateHelpers : function(){
+		var infoMsg = '', displayClass = 'hide';
+		if(XAUtil.isMaskingPolicy(this.model.get('policyType'))){
+			infoMsg = localization.tt('msg.maskingPolicyInfoMsg'), displayClass = 'show';
+		}else if(XAUtil.isRowFilterPolicy(this.model.get('policyType'))){
+			infoMsg = localization.tt('msg.rowFilterPolicyInfoMsg'), displayClass = 'show';
+		}
     		return {
-    			editPolicy : this.editPolicy
+			editPolicy : this.editPolicy,
+			infoMsg : infoMsg,
+			displayClass : displayClass
     		};
     	},
     	breadCrumbs :function(){

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/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 964d263..1eaf3da 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
@@ -425,6 +425,7 @@ define(function(require){
 		},
 		/** on close */
 		onClose: function(){
+                        $('.popover').remove();
 		}
 
 	});

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/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 bf00a7e..1e1f0f7 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -224,7 +224,7 @@ define(function(require) {
 					this.modifyTableForSubcolumns();
 					this.addSearchForBigDataTab();
 					this.listenTo(this.accessAuditList, "request", that.updateLastRefresh)
-                                        this.ui.iconSearchInfo.show();
+                    this.ui.iconSearchInfo.show();
 					break;
 				case "#admin":
 					this.currentTab = '#admin';
@@ -238,6 +238,7 @@ define(function(require) {
 					this.addSearchForAdminTab();
 					this.listenTo(this.trxLogList, "request", that.updateLastRefresh)
                                         this.ui.iconSearchInfo.hide();
+                                        $('.popover').remove();
 					break;
 				case "#loginSession":
 					this.currentTab = '#loginSession';
@@ -251,6 +252,7 @@ define(function(require) {
 					this.addSearchForLoginSessionTab();
 					this.listenTo(this.authSessionList, "request", that.updateLastRefresh)
                                         this.ui.iconSearchInfo.hide();
+                                        $('.popover').remove();
 					break;
 				case "#agent":
 					this.currentTab = '#agent';
@@ -265,6 +267,7 @@ define(function(require) {
 					this.addSearchForAgentTab();
 					this.listenTo(this.policyExportAuditList, "request", that.updateLastRefresh)
                                         this.ui.iconSearchInfo.hide();
+                                        $('.popover').remove();
 					break;
 				case "#pluginStatus":
 					 this.currentTab = '#pluginStatus';
@@ -278,6 +281,7 @@ define(function(require) {
 					 this.pluginInfoList.fetch({cache : false});
 					 this.addSearchForPluginStatusTab();
 					 this.ui.iconSearchInfo.hide();
+                                         $('.popover').remove();
 					 break;
 			}
 			var lastUpdateTime = Globalize.format(new Date(),  "MM/dd/yyyy hh:mm:ss tt");
@@ -1366,6 +1370,7 @@ define(function(require) {
 			clearInterval(this.timerId);
 			clearInterval(this.clearTimeUpdateInterval);
 			$('.datepicker').remove();
+                        $('.popover').remove();
 		}
 	});
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/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 39770d9..56bba66 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
@@ -840,6 +840,7 @@ define(function(require) {'use strict';
 		},
 		/** on close */
 		onClose : function() {
+                        $('.popover').remove();
 		}
 	});
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/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 7d86dfa..154b588 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -2055,7 +2055,9 @@ td.subgrid-custom-cell{
 .VS-search .search_facet_input_container{
 	margin-top: 1px;
 }
-.selected-widget {
+.padding-right-10{
+        padding-right: 10px;
+}.selected-widget {
     padding: 3px 5px 3px 4px;
     border-radius: 3px;
     border: 1px solid #aaaaaa;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4b9497b6/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html
b/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html
index eab1c22..31252af 100644
--- a/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html
+++ b/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html
@@ -20,10 +20,14 @@
 	<h4> {{tt 'h.createPolicy'}} </h4>
 {{/if}}
 <div class="wrap non-collapsible ">
-<div class="alert alert-danger" data-id="policyDisabledAlert" style="display:none;">
-  <button type="button" class="close" data-dismiss="alert">&times;</button>
-  <strong>Warning !</strong> {{tt 'msg.policyDisabledMsg'}}
-</div>
+        <div class="alert alert-danger" data-id="policyDisabledAlert" style="display:none;">
+          <button type="button" class="close" data-dismiss="alert">&times;</button>
+          <strong>Warning !</strong> {{tt 'msg.policyDisabledMsg'}}
+        </div>
+        <div class="alert alert-warning {{displayClass}}" data-id="policyInfoAlert">
+          <button type="button" class="close" data-dismiss="alert">&times;</button>
+          <i class="icon-info-sign searchInfoUserAccsss padding-right-10"></i>{{{infoMsg}}}
+        </div>
 	<div data-id="r_form"></div>
 	<div class="form-actions form-policy" class="row-fluid">
 	{{#if editPolicy}}


Mime
View raw message