RANGER-2520 : Prevent Roles to be saved in Ranger Role Management page when user or groups are not added to the role.

(cherry picked from commit 716591dec8a80ac50d4fc0ff4a1c3337404e3ec7)
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 c320fdb..4096020 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
@@ -476,6 +476,7 @@
                 noDeleteRoleRow         :'Please select ranger role first to delete.',
                 addRolePermission       : 'Please add permission(s) for the selected role, else role will not be added.',
                 addRole                 : 'Please select role for the selected permission(s), else role will not be added.',
+                addSelectedUserGroupRoles : 'Please add selected user/group/roles to there respective table else user/group/roles will not be added.'
 
 			},
 			plcHldr : {
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index 5fca82c..80277f6 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -466,40 +466,40 @@
 		options = _.isUndefined(options) ? Opt : options;
 		$.msg(options);
 	};
-	XAUtils.showGroups = function(rawValue) {
+        XAUtils.showMoreLessBtnForGroupsUsersRoles = function(rawValue , type) {
 		var showMoreLess = false, id;
 		if (_.isArray(rawValue))
 			rawValue = new Backbone.Collection(rawValue);
 		if (!_.isUndefined(rawValue) && rawValue.models.length > 0) {
 			var groupArr = _.uniq(_.compact(_.map(rawValue.models, function(m,
 					i) {
-				if (m.has('groupName'))
-					return _.escape(m.get('groupName'));
+                                if (m.has('entityName'))
+                                        return _.escape(m.get('entityName'));
 			})));
 			if (groupArr.length > 0) {
 				if (rawValue.first().has('resourceId'))
 					id = rawValue.first().get('resourceId');
 				else
-					id = rawValue.first().get('userId');
+                                        id = rawValue.first().get('modelId');
 			}
 			var newGroupArr = _.map(groupArr, function(name, i) {
 				if (i >= 4)
-					return '<span class="label label-info float-left-margin-2" policy-group-id="'
+                                        return '<span class="label label-info float-left-margin-2" data-name='+type+' model-'+ type +'-id="'
 							+ id + '" style="display:none;">' + name
 							+ '</span>';
 				else if (i == 3 && groupArr.length > 4) {
 					showMoreLess = true;
-					return '<span class="label label-info float-left-margin-2" policy-group-id="'
+                                        return '<span class="label label-info float-left-margin-2" data-name='+type+' model-'+ type +'-id="'
 							+ id + '">' + name + '</span>';
 				} else
-					return '<span class="label label-info float-left-margin-2" policy-group-id="'
+                                        return '<span class="label label-info float-left-margin-2" data-name='+type+' model-'+ type +'-id="'
 							+ id + '">' + name + '</span>';
 			});
 			if (showMoreLess) {
 				newGroupArr
-						.push('<span class="float-left-margin-2"><a href="javascript:void(0);" data-id="showMore" class="" policy-group-id="'
+                                                .push('<span class="float-left-margin-2"><a href="javascript:void(0);" data-id="showMore" class="" data-name='+type+' model-'+ type +'-id="'
 								+ id
-								+ '"><code style=""> + More..</code></a></span><span class="float-left-margin-2"><a href="javascript:void(0);" data-id="showLess" class="" policy-group-id="'
+                                                                + '"><code style=""> + More..</code></a></span><span class="float-left-margin-2"><a href="javascript:void(0);" data-id="showLess" class="" data-name='+type+' model-'+ type +'-id="'
 								+ id
 								+ '" style="display:none;"><code> - Less..</code></a></span>');
 			}
@@ -1729,6 +1729,14 @@
         });
     }
 
+    //Scroll up for roles create page
+    XAUtils.scrollToRolesField = function(field) {
+        $("html, body").animate({
+            scrollTop : field.position().top - 150
+        }, 1100, function() {
+            field.focus();
+        });
+    };
 
 	return XAUtils;
 });
\ No newline at end of file
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 f8b71e1..31fc7c1 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
@@ -417,7 +417,7 @@
 			$td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').parents('div[data-id="groupsDiv"]').removeClass('set-height-groups');
 		},
                 attributName :function(e){
-                    var attrName = ['policy-groups-id', 'policy-users-id', 'policy-label-id'], attributeName = "";
+                    var attrName = ['policy-groups-id', 'policy-users-id', 'policy-label-id' , 'policy-roles-id'], attributeName = "";
                     attributeName =_.filter(attrName, function(name){
                         if($(e.currentTarget).attr(name)){
                             return name;
diff --git a/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js b/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
index ce3af44..c319d81 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
@@ -152,6 +152,7 @@
 			
 			_.each(oldOl, function(ol, i) {
 				this.highLightElement($(ol).find('.username'), $(newOl[i]).find('.username'));
+                                this.highLightElement($(ol).find('.rolename'), $(newOl[i]).find('.rolename'));
 				this.highLightElement($(ol).find('.groupname'), $(newOl[i]).find('.groupname'));
 				this.highLightElement($(ol).find('.perm'), $(newOl[i]).find('.perm'));
 				this.highLightElement($(ol).find('.condition'), $(newOl[i]).find('.condition'));
diff --git a/security-admin/src/main/webapp/scripts/views/users/AddUsersOrGroupsList.js b/security-admin/src/main/webapp/scripts/views/users/AddUsersOrGroupsList.js
index 8d23b80..3a24690 100644
--- a/security-admin/src/main/webapp/scripts/views/users/AddUsersOrGroupsList.js
+++ b/security-admin/src/main/webapp/scripts/views/users/AddUsersOrGroupsList.js
@@ -108,6 +108,7 @@
 
         ui : {
             'selectUsersOrGroups' : '[data-js="selectUsersOrGroups"]',
+            'addUserGroupRoleBtn' : '[data-action="addUserGroup"]'
         },
 
         events : {
@@ -128,6 +129,8 @@
                     +this.fieldName+' found</td></tr>');
             }
             this.ui.selectUsersOrGroups.select2(XAUtil.getUsersGroupsList(this.fieldName, this));
+            this.ui.selectUsersOrGroups.attr("data-name", this.fieldName+"Select");
+            this.ui.addUserGroupRoleBtn.attr("data-name", this.fieldName+"AddBtn")
         },
 
         addNew : function() {
diff --git a/security-admin/src/main/webapp/scripts/views/users/RoleCreate.js b/security-admin/src/main/webapp/scripts/views/users/RoleCreate.js
index e7e9f06..91da5ab 100644
--- a/security-admin/src/main/webapp/scripts/views/users/RoleCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/users/RoleCreate.js
@@ -107,6 +107,10 @@
             }
             XAUtil.blockUI();
             this.form.beforeSave()
+            if(!this.form.beforeSave()){
+                XAUtil.blockUI('unblock');
+                return
+            }
             this.form.usersColl.models.filter(function(m){
                 usersDetails.push ({'name' : m.get('name') , 'isAdmin' : m.get('isAdmin')});
             })
diff --git a/security-admin/src/main/webapp/scripts/views/users/RoleForm.js b/security-admin/src/main/webapp/scripts/views/users/RoleForm.js
index a3fd9f3..e55899a 100644
--- a/security-admin/src/main/webapp/scripts/views/users/RoleForm.js
+++ b/security-admin/src/main/webapp/scripts/views/users/RoleForm.js
@@ -107,6 +107,21 @@
 
         beforeSave : function() {
             var that = this;
+            if(!_.isEmpty(this.$el.find('[data-name="usersSelect"]').select2('data')) ||
+                !_.isEmpty(this.$el.find('[data-name="groupsSelect"]').select2('data')) ||
+                !_.isEmpty(this.$el.find('[data-name="rolesSelect"]').select2('data'))) {
+                if(!_.isEmpty(this.$el.find('[data-name="usersSelect"]').select2('data'))) {
+                    XAUtils.scrollToRolesField(this.$el.find('[data-name="usersAddBtn"]'));
+                } else if (!_.isEmpty(this.$el.find('[data-name="groupsSelect"]').select2('data'))) {
+                    XAUtils.scrollToRolesField(this.$el.find('[data-name="groupsAddBtn"]'));
+                } else {
+                    XAUtils.scrollToRolesField(this.$el.find('[data-name="rolesAddBtn"]'));
+                }
+                XAUtils.alertPopup({
+                    msg :localization.tt('msg.addSelectedUserGroupRoles'),
+                });
+                return false;
+            }
             this.usersColl.remove(that.usersColl.models.filter(function(model){
                 return _.isUndefined(model.get('name'))
             }));
@@ -116,6 +131,7 @@
             this.rolesColl.remove(that.rolesColl.models.filter(function(model){
                 return _.isUndefined(model.get('name'))
             }))
+            return true;
         },
 
     });
diff --git a/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js b/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
index 13f7681..dabad17 100755
--- a/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
@@ -424,8 +424,8 @@
 					label : localization.tt("lbl.groups"),
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue,model) {
-							if(!_.isUndefined(rawValue)){
-								return XAUtil.showGroups(_.map(rawValue,function(name){return {'userId': model.id,'groupName': name}}));
+                                                        if(!_.isUndefined(rawValue) && !_.isEmpty(rawValue)){
+                                                                return XAUtil.showMoreLessBtnForGroupsUsersRoles(_.map(rawValue,function(name){return {'modelId': model.id,'entityName': name}}) , 'groups');
 							}
 							else
 							return '--';
@@ -621,8 +621,7 @@
                                         formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                                                 fromRaw: function (rawValue, model) {
                                                         if(!_.isUndefined(rawValue) && rawValue.length != 0){
-                                                                var users = rawValue.map(function(m){return m.name});
-                                                                return XAUtil.showMoreAndLessButton(users, model)
+                                                                return XAUtil.showMoreLessBtnForGroupsUsersRoles(_.map(rawValue,function(m){return {'modelId': model.id,'entityName': m.name}}), 'users');
                                                         }else{
                                                                 return '--';
                                                         }
@@ -637,8 +636,7 @@
                                         formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                                                 fromRaw: function (rawValue, model) {
                                                         if(!_.isUndefined(rawValue) && rawValue.length != 0){
-                                                                var groups = rawValue.map(function(m){return m.name});
-                                                                return XAUtil.showMoreAndLessButton(groups, model)
+								return XAUtil.showMoreLessBtnForGroupsUsersRoles(_.map(rawValue,function(m){return {'modelId': model.id,'entityName': m.name}}), 'groups');
                                                         }else{
                                                                 return '--';
                                                         }
@@ -653,8 +651,7 @@
                                         formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                                                 fromRaw: function (rawValue, model) {
                                                         if(!_.isUndefined(rawValue) && rawValue.length != 0){
-                                                                var roles = rawValue.map(function(m){return m.name});
-                                                                return XAUtil.showMoreAndLessButton(roles, model)
+								return XAUtil.showMoreLessBtnForGroupsUsersRoles(_.map(rawValue,function(m){return {'modelId': model.id,'entityName': m.name}}), 'roles');
                                                         }else{
                                                                 return '--';
                                                         }
@@ -1040,18 +1037,20 @@
 			return _.map(activeStatusList, function(status) { return { 'label': status.label, 'value': status.label}; })
 		},
 		onShowMore : function(e){
-			var id = $(e.currentTarget).attr('policy-group-id');
-			this.rTableList.$el.find('[policy-group-id="'+id+'"]').show();
-			$('[data-id="showLess"][policy-group-id="'+id+'"]').show();
-			$('[data-id="showMore"][policy-group-id="'+id+'"]').hide();
-			$('[data-id="showMore"][policy-group-id="'+id+'"]').parents('div[data-id="groupsDiv"]').addClass('set-height-groups');
+                        var name = $(e.currentTarget).attr('data-name');
+                        var id = $(e.currentTarget).attr('model-'+name+'-id');
+                        this.rTableList.$el.find('[model-'+name+'-id="'+id+'"]').show();
+                        $('[data-id="showLess"][model-'+name+'-id="'+id+'"]').show();
+                        $('[data-id="showMore"][model-'+name+'-id="'+id+'"]').hide();
+                        $('[data-id="showMore"][model-'+name+'-id="'+id+'"]').parents('div[data-id="groupsDiv"]').addClass('set-height-groups');
 		},
 		onShowLess : function(e){
-			var id = $(e.currentTarget).attr('policy-group-id');
-			this.rTableList.$el.find('[policy-group-id="'+id+'"]').slice(4).hide();
-			$('[data-id="showLess"][policy-group-id="'+id+'"]').hide();
-			$('[data-id="showMore"][policy-group-id="'+id+'"]').show();
-			$('[data-id="showMore"][policy-group-id="'+id+'"]').parents('div[data-id="groupsDiv"]').removeClass('set-height-groups')
+                        var name = $(e.currentTarget).attr('data-name');
+                        var id = $(e.currentTarget).attr('model-'+name+'-id');
+                        this.rTableList.$el.find('[model-'+name+'-id="'+id+'"]').slice(4).hide();
+                        $('[data-id="showLess"][model-'+name+'-id="'+id+'"]').hide();
+                        $('[data-id="showMore"][model-'+name+'-id="'+id+'"]').show();
+                        $('[data-id="showMore"][model-'+name+'-id="'+id+'"]').parents('div[data-id="groupsDiv"]').removeClass('set-height-groups')
 		},
 		checkRoleKeyAdmin : function() {
 			if(SessionMgr.isKeyAdmin()){
diff --git a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html
index fc5c302..f37c158 100644
--- a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html
@@ -104,6 +104,15 @@
 			<h3>Old Value</h3>
 			{{#each oldPolicyItems}}
 				<ol class="unstyled data">
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt; 
@@ -149,6 +158,15 @@
 			<h3>old Value</h3>
 				{{#each oldMaskPolicyItems}}
 					<ol class="unstyled data">
+                                                <li class="change-row"><i>Roles</i>:
+                                                        {{#if_eq this.roles compare=0}}
+                                                                &lt;empty&gt;
+                                                        {{else}}
+                                                                {{#each this.roles}}
+                                                                        <span class="rolename">{{this}}</span><span>,</span>
+                                                                {{/each}}
+                                                        {{/if_eq}}
+                                                </li>
 						<li class="change-row">Groups:
 							{{#if_eq this.groups compare=0}}
 								&lt;empty&gt;
@@ -190,6 +208,15 @@
 			<h3>Old Value</h3>
 			{{#each oldRowFilterPolicyItems}}
 				<ol class="unstyled data">
+                                                <li class="change-row"><i>Roles</i>:
+                                                        {{#if_eq this.roles compare=0}}
+                                                                &lt;empty&gt;
+                                                        {{else}}
+                                                                {{#each this.roles}}
+                                                                        <span class="rolename">{{this}}</span><span>,</span>
+                                                                {{/each}}
+                                                        {{/if_eq}}
+                                                </li>
 						<li class="change-row">Groups:
 							{{#if_eq this.groups compare=0}}
 								&lt;empty&gt;
@@ -228,6 +255,15 @@
 			<h3>Old Value</h3>
 			{{#each oldAllowExceptionPolicyItems}}
 				<ol class="unstyled data">
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt; 
@@ -273,6 +309,15 @@
 			<h3>Old Value</h3>
 			{{#each oldDenyPolicyItems}}
 				<ol class="unstyled data">
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt; 
@@ -318,6 +363,15 @@
 			<h3>Old Value</h3>
 			{{#each oldDenyExceptionPolicyItems}}
 				<ol class="unstyled data">
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt; 
diff --git a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html
index 0dcae38..59fa1f3 100644
--- a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html
@@ -103,13 +103,20 @@
 			<h3>New Value</h3>
 				{{#each newPolicyItems}}
 				<ol class="unstyled data">
-						<li class="change-row">Groups: 
-							{{#if_eq this.groups compare=0}}
-								&lt;empty&gt;	 
-							{{else}}
-								{{this.groups}}  
-							{{/if_eq}}
-						</li>
+                                        <li class="change-row">Roles:
+                                                {{#if_eq this.roles compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.roles}}
+                                                {{/if_eq}}
+                                        </li>
+                                        <li class="change-row">Groups:
+                                                {{#if_eq this.groups compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.groups}}
+                                                {{/if_eq}}
+                                        </li>
 					<li class="change-row">Users:
 						{{#if_eq this.users compare=0}}
 								&lt;empty&gt;	 
@@ -146,13 +153,20 @@
 			<h3>New Value</h3>
 				{{#each newAllowExceptionPolicyItems}}
 				<ol class="unstyled data">
-						<li class="change-row">Groups: 
-							{{#if_eq this.groups compare=0}}
-								&lt;empty&gt;	 
-							{{else}}
-								{{this.groups}}  
-							{{/if_eq}}
-						</li>
+                                        <li class="change-row">Roles:
+                                                {{#if_eq this.roles compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.roles}}
+                                                {{/if_eq}}
+                                        </li>
+                                        <li class="change-row">Groups:
+                                                {{#if_eq this.groups compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.groups}}
+                                                {{/if_eq}}
+                                        </li>
 					<li class="change-row">Users:
 						{{#if_eq this.users compare=0}}
 								&lt;empty&gt;	 
@@ -189,13 +203,20 @@
 			<h3>New Value</h3>
 				{{#each newDenyPolicyItems}}
 				<ol class="unstyled data">
-						<li class="change-row">Groups: 
-							{{#if_eq this.groups compare=0}}
-								&lt;empty&gt;	 
-							{{else}}
-								{{this.groups}}  
-							{{/if_eq}}
-						</li>
+                                        <li class="change-row">Roles:
+                                                {{#if_eq this.roles compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.roles}}
+                                                {{/if_eq}}
+                                        </li>
+                                        <li class="change-row">Groups:
+                                                {{#if_eq this.groups compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.groups}}
+                                                {{/if_eq}}
+                                        </li>
 					<li class="change-row">Users:
 						{{#if_eq this.users compare=0}}
 								&lt;empty&gt;	 
@@ -230,13 +251,20 @@
 			<h3>New Value</h3>
 				{{#each newDenyExceptionPolicyItems}}
 				<ol class="unstyled data">
-						<li class="change-row">Groups: 
-							{{#if_eq this.groups compare=0}}
-								&lt;empty&gt;	 
-							{{else}}
-								{{this.groups}}  
-							{{/if_eq}}
-						</li>
+                                        <li class="change-row">Roles:
+                                                {{#if_eq this.roles compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.roles}}
+                                                {{/if_eq}}
+                                        </li>
+                                        <li class="change-row">Groups:
+                                                {{#if_eq this.groups compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.groups}}
+                                                {{/if_eq}}
+                                        </li>
 					<li class="change-row">Users:
 						{{#if_eq this.users compare=0}}
 								&lt;empty&gt;	 
@@ -272,13 +300,20 @@
 			<h3>New Value</h3>
 			{{#each newMaskPolicyItems}}
 				<ol class="unstyled data">
-						<li class="change-row">Groups:
-							{{#if_eq this.groups compare=0}}
-								&lt;empty&gt;
-							{{else}}
-								{{this.groups}}
-							{{/if_eq}}
-						</li>
+                                        <li class="change-row">Roles:
+                                                {{#if_eq this.roles compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.roles}}
+                                                {{/if_eq}}
+                                        </li>
+                                        <li class="change-row">Groups:
+                                                {{#if_eq this.groups compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.groups}}
+                                                {{/if_eq}}
+                                        </li>
 					<li class="change-row">Users:
 						{{#if_eq this.users compare=0}}
 								&lt;empty&gt;
@@ -313,13 +348,20 @@
 			<h3>New Value</h3>
 			{{#each newRowFilterPolicyItems}}
 				<ol class="unstyled data">
-						<li class="change-row">Groups:
-							{{#if_eq this.groups compare=0}}
-								&lt;empty&gt;
-							{{else}}
-								{{this.groups}}
-							{{/if_eq}}
-						</li>
+                                        <li class="change-row">Roles:
+                                                {{#if_eq this.roles compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.roles}}
+                                                {{/if_eq}}
+                                        </li>
+                                        <li class="change-row">Groups:
+                                                {{#if_eq this.groups compare=0}}
+                                                        &lt;empty&gt;
+                                                {{else}}
+                                                        {{this.groups}}
+                                                {{/if_eq}}
+                                        </li>
 					<li class="change-row">Users:
 						{{#if_eq this.users compare=0}}
 								&lt;empty&gt;
diff --git a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html
index c06c237..4c00a8a 100644
--- a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html
@@ -180,6 +180,15 @@
 				{{#each oldPolicyItems}}
 					<ol class="unstyled data">
 						{{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;		 
@@ -222,7 +231,16 @@
 			<h3>New Value</h3>
 			{{#each newPolicyItems}}
 				<ol class="unstyled data">
-				{{#ifCond this.users '||' this.groups}}
+                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;		 
@@ -271,7 +289,16 @@
 			<h3>Old Value</h3>
 				{{#each oldAllowExceptionPolicyItems}}
 					<ol class="unstyled data">
-						{{#ifCond this.users '||' this.groups}}
+                                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;		 
@@ -314,7 +341,16 @@
 			<h3>New Value</h3>
 			{{#each newAllowExceptionPolicyItems}}
 				<ol class="unstyled data">
-				{{#ifCond this.users '||' this.groups}}
+                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;		 
@@ -364,7 +400,16 @@
 			<h3>Old Value</h3>
 				{{#each oldDenyPolicyItems}}
 					<ol class="unstyled data">
-						{{#ifCond this.users '||' this.groups}}
+                                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;		 
@@ -407,7 +452,16 @@
 			<h3>New Value</h3>
 			{{#each newDenyPolicyItems}}
 				<ol class="unstyled data">
-				{{#ifCond this.users '||' this.groups}}
+                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;		 
@@ -458,7 +512,16 @@
 			<h3>Old Value</h3>
 				{{#each oldDenyExceptionPolicyItems}}
 					<ol class="unstyled data">
-						{{#ifCond this.users '||' this.groups}}
+                                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;		 
@@ -501,7 +564,16 @@
 			<h3>New Value</h3>
 			{{#each newDenyExceptionPolicyItems}}
 				<ol class="unstyled data">
-				{{#ifCond this.users '||' this.groups}}
+                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                        <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;		 
@@ -551,7 +623,16 @@
 			<h3>Old Value</h3>
 				{{#each oldMaskPolicyItems}}
 					<ol class="unstyled data">
-						{{#ifCond this.users '||' this.groups}}
+                                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;
@@ -591,7 +672,16 @@
 			<h3>New Value</h3>
 			{{#each newMaskPolicyItems}}
 				<ol class="unstyled data">
-				{{#ifCond this.users '||' this.groups}}
+                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;
@@ -639,7 +729,16 @@
 			<h3>Old Value</h3>
 				{{#each oldRowFilterPolicyItems}}
 					<ol class="unstyled data">
-						{{#ifCond this.users '||' this.groups}}
+                                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;
@@ -679,7 +778,16 @@
 			<h3>New Value</h3>
 			{{#each newRowFilterPolicyItems}}
 				<ol class="unstyled data">
-				{{#ifCond this.users '||' this.groups}}
+                                {{#ifCond this.users '||' this.groups }}
+                                                        <li class="change-row"><i>Roles</i>:
+                                                                {{#if_eq this.roles compare=0}}
+                                                                        &lt;empty&gt;
+                                                                {{else}}
+                                                                        {{#each this.roles}}
+                                                                                <span class="rolename">{{this}}</span><span>,</span>
+                                                                        {{/each}}
+                                                                {{/if_eq}}
+                                                        </li>
 							<li class="change-row"><i>Groups</i>:
 								{{#if_eq this.groups compare=0}}
 									&lt;empty&gt;