Skip to content

Commit

Permalink
RANGER-4886: do not Html-escape for user, group and role name
Browse files Browse the repository at this point in the history
on policy items and Users/Groups/Roles.
  • Loading branch information
eubnara committed Nov 10, 2024
1 parent 2a340fa commit dd2508a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions security-admin/src/main/webapp/scripts/utils/XAUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
})
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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
};
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit dd2508a

Please sign in to comment.