diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js index 31d9a04ff2..62fdc9ef0e 100644 --- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js +++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js @@ -1664,8 +1664,8 @@ define(function(require) { if(that.model && !_.isEmpty(that.model.get($select))){ _.map (that.model.get($select) , function(name){ tags.push({ - 'id': _.escape(name), - 'text': _.escape(name) + 'id': name, + 'text': name }); }) } @@ -1706,8 +1706,8 @@ define(function(require) { } results = data.vXStrings.map(function(m) { return { - id: _.escape(m.value), - text: _.escape(m.value) + id: m.value, + text: m.value }; }); } else { @@ -1718,8 +1718,8 @@ define(function(require) { } results = data.roles.map(function(m){ return { - id : _.escape(m.name), - text: _.escape(m.name) + id : m.name, + text: m.name }; }); } diff --git a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js index dbcd3b8b5f..c7b98cff0e 100644 --- a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js +++ b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js @@ -123,14 +123,14 @@ define(function(require) { }); if(this.model.has('editMode') && this.model.get('editMode')){ if(!_.isUndefined(this.model.get('groupName')) && !_.isNull(this.model.get('groupName'))){ - this.ui.selectGroups.val(_.map(this.model.get('groupName'), function(name){ return _.escape(name); })); + this.ui.selectGroups.val(this.model.get('groupName')); } if(!_.isUndefined(this.model.get('userName')) && !_.isNull(this.model.get('userName'))){ - this.ui.selectUsers.val(_.map(this.model.get('userName'), function(name){ return _.escape(name); })); + this.ui.selectUsers.val(this.model.get('userName')); + } + if(!_.isUndefined(this.model.get('roleName')) && !_.isNull(this.model.get('roleName'))){ + this.ui.selectRoles.val(this.model.get('roleName')); } - if(!_.isUndefined(this.model.get('roleName')) && !_.isNull(this.model.get('roleName'))){ - this.ui.selectRoles.val(_.map(this.model.get('roleName'), function(name){ return _.escape(name); })); - } if(!_.isUndefined(this.model.get('conditions'))){ _.each(this.model.get('conditions'), function(obj){ this.$el.find('input[data-js="'+obj.type+'"]').val(obj.values.toString()) @@ -214,9 +214,9 @@ define(function(require) { placeholder = (type == 'users') ? 'Select Users' : ((type == 'groups') ? 'Select Groups' : 'Select Roles'), searchUrl = (type == 'users') ? "service/xusers/lookup/users" : ((type == 'groups') ? "service/xusers/lookup/groups" : "service/roles/roles"); if(this.model.has('editMode') && !_.isEmpty($select.val())){ - var temp = this.model.attributes[ (type == 'users') ? 'userName' : ((type == 'groups') ? 'groupName' : 'roleName')]; + var temp = this.model.attributes[ (type == 'users') ? 'userName' : ((type == 'groups') ? 'groupName' : 'roleName')]; _.each(temp , function(name){ - tags.push( { 'id' : _.escape( name ), 'text' : _.escape( name ) } ); + tags.push( { 'id' : name, 'text' : name } ); }); } $select.select2({ @@ -247,13 +247,13 @@ define(function(require) { var results = [] , selectedVals = []; //Get selected values of groups/users dropdown selectedVals = that.getSelectedValues($select, type); - if(data.totalCount != "0"){ - if(type == 'users' || type == 'groups'){ - results = data.vXStrings.map(function(m){ return {id : _.escape(m.value), text: _.escape(m.value) }; }); + if (data.totalCount != "0") { + if (type == 'users' || type == 'groups') { + results = data.vXStrings.map(function(m){ return {id : m.value, text: m.value }; }); } else { - results = data.roles.map(function(m){ return {id : _.escape(m.name), text: _.escape(m.name) }; }); + results = data.roles.map(function(m){ return {id : m.name, text: m.name }; }); } - if(!_.isEmpty(selectedVals)){ + if (!_.isEmpty(selectedVals)){ results = XAUtil.filterResultByText(results, selectedVals); } return {results : results}; diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js index 5f6d9ac010..3f84f14f58 100644 --- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js +++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js @@ -506,15 +506,15 @@ define(function(require){ if(!_.isUndefined(m.get('groupName')) || !_.isUndefined(m.get("userName")) || !_.isUndefined(m.get('roleName'))){ //groupName or userName var RangerPolicyItem=Backbone.Model.extend() var policyItem = new RangerPolicyItem(); - if(!_.isUndefined(m.get('groupName')) && !_.isNull(m.get('groupName'))){ - policyItem.set("groups",m.get("groupName")); + if (!_.isUndefined(m.get('groupName')) && !_.isNull(m.get('groupName'))) { + policyItem.set("groups", m.get("groupName")); } - if(!_.isUndefined(m.get('userName')) && !_.isNull(m.get('userName'))){ - policyItem.set("users",m.get("userName")); + if (!_.isUndefined(m.get('userName')) && !_.isNull(m.get('userName'))) { + policyItem.set("users", m.get("userName")); + } + if (!_.isUndefined(m.get('roleName')) && !_.isNull(m.get('roleName'))) { + policyItem.set("roles", m.get("roleName")); } - if(!_.isUndefined(m.get('roleName')) && !_.isNull(m.get('roleName'))){ - policyItem.set("roles",m.get("roleName")); - } if(!(_.isUndefined(m.get('conditions')) && _.isEmpty(m.get('conditions')))){ var RangerPolicyItemConditionList = Backbone.Collection.extend(); var rPolicyItemCondList = new RangerPolicyItemConditionList(m.get('conditions'))