Fix for EMM-1651

4.x.x
kamidu 8 years ago
parent 33cc38defb
commit 43b1a9f278

@ -313,7 +313,7 @@ function loadUsers() {
if (!data.firstname && !data.lastname) { if (!data.firstname && !data.lastname) {
return ""; return "";
} else if (data.firstname && data.lastname) { } else if (data.firstname && data.lastname) {
return "<h4>&nbsp;&nbsp;" + data.firstname + " " + data.lastname + "</h4>"; return "<h4>" + data.firstname + " " + data.lastname + "</h4>";
} }
} }
}, },
@ -321,7 +321,7 @@ function loadUsers() {
class: "fade-edge remove-padding-top", class: "fade-edge remove-padding-top",
data: 'filter', data: 'filter',
render: function (filter, type, row, meta) { render: function (filter, type, row, meta) {
return '&nbsp;&nbsp;<i class="fw-user"></i>&nbsp;&nbsp;' + filter; return '<i class="fw-user"></i>' + filter;
} }
}, },
{ {
@ -331,7 +331,7 @@ function loadUsers() {
if (!data.emailAddress) { if (!data.emailAddress) {
return ""; return "";
} else { } else {
return "&nbsp;&nbsp;<a href='mailto:" + data.emailAddress + "' ><i class='fw-mail'></i>&nbsp;&nbsp;" + data.emailAddress + "</a>"; return "<a href='mailto:" + data.emailAddress + "' ><i class='fw-mail'></i>" + data.emailAddress + "</a>";
} }
} }
}, },
@ -339,17 +339,13 @@ function loadUsers() {
class: "text-right content-fill text-left-on-grid-view no-wrap", class: "text-right content-fill text-left-on-grid-view no-wrap",
data: null, data: null,
render: function (data, type, row, meta) { render: function (data, type, row, meta) {
var editbtn = '&nbsp;<a data-toggle="tooltip" data-placement="bottom" title="Edit User"href="' + context + '/user/edit?username=' + data.filter + '" data-username="' + data.filter + '" ' + var editbtn = '<a data-toggle="tooltip" data-placement="bottom" title="Edit User"href="' + context + '/user/edit?username=' + data.filter + '" data-username="' + data.filter + '" ' +
'data-click-event="edit-form" ' + 'data-click-event="edit-form" ' +
'class="btn padding-reduce-on-grid-view edit-user-link"> ' + 'class="btn padding-reduce-on-grid-view edit-user-link"> ' +
'<span class="fw-stack"> ' + '<span class="fw-stack"> ' +
'<i class="fw fw-ring fw-stack-2x"></i>' + '<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-edit fw-stack-1x"></i>' + '<i class="fw fw-edit fw-stack-1x"></i>' +
'</span>' + '</span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
'<span class="hidden-xs hidden-on-grid-view">' +
'&nbsp;&nbsp;Edit' +
'</span>' +
'</a>';
var resetPasswordbtn = '<a data-toggle="tooltip" data-placement="bottom" title="Reset Password" href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' + var resetPasswordbtn = '<a data-toggle="tooltip" data-placement="bottom" title="Reset Password" href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' +
'data-click-event="edit-form" ' + 'data-click-event="edit-form" ' +
@ -358,11 +354,7 @@ function loadUsers() {
'<span class="fw-stack">' + '<span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i>' + '<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-key fw-stack-1x"></i>' + '<i class="fw fw-key fw-stack-1x"></i>' +
'</span>' + '</span><span class="hidden-xs hidden-on-grid-view">Reset Password</span></a>';
'<span class="hidden-xs hidden-on-grid-view">' +
'&nbsp;&nbsp;Reset Password' +
'</span>' +
'</a>';
var removebtn = '<a data-toggle="tooltip" data-placement="bottom" title="Remove User" href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' + var removebtn = '<a data-toggle="tooltip" data-placement="bottom" title="Remove User" href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' +
'data-click-event="remove-form" ' + 'data-click-event="remove-form" ' +
@ -371,20 +363,18 @@ function loadUsers() {
'<span class="fw-stack">' + '<span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i>' + '<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-delete fw-stack-1x"></i>' + '<i class="fw fw-delete fw-stack-1x"></i>' +
'</span>' + '</span><span class="hidden-xs hidden-on-grid-view">Remove</span></a>';
'<span class="hidden-xs hidden-on-grid-view">' +
'&nbsp;&nbsp;Remove' +
'</span>' +
'</a>';
var returnbtnSet = ''; var returnbtnSet = '';
if ($("#can-edit").length > 0) { var adminUser = $("#user-table").data("user");
var currentUser = $("#user-table").data("logged-user");
if ($("#can-edit").length > 0 && adminUser !== data.filter) {
returnbtnSet = returnbtnSet + editbtn; returnbtnSet = returnbtnSet + editbtn;
} }
if ($("#can-reset-password").length > 0) { if ($("#can-reset-password").length > 0 && adminUser !== data.filter) {
returnbtnSet = returnbtnSet + resetPasswordbtn; returnbtnSet = returnbtnSet + resetPasswordbtn;
} }
if ($("#can-remove").length > 0) { if ($("#can-remove").length > 0 && adminUser !== data.filter && currentUser !== data.filter) {
returnbtnSet = returnbtnSet + removebtn; returnbtnSet = returnbtnSet + removebtn;
} }

@ -65,7 +65,7 @@
<br> <br>
</div> </div>
<div id="user-table" data-user={{adminUser}}> <div id="user-table" data-user={{adminUser}} data-logged-user={{currentUser}}>
<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view" <table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view"
id="user-grid"> id="user-grid">
<thead> <thead>

@ -31,7 +31,8 @@ function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
page["adminUser"] = deviceMgtProps["adminUser"]; page["currentUser"] = userModule.getCarbonUser().username;
page["adminUser"] = deviceMgtProps["adminUser"].split("@")[0];
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
page.canManage = true; page.canManage = true;

Loading…
Cancel
Save