diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js
index 43d6de1a83..1074b271cf 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js
@@ -313,7 +313,7 @@ function loadUsers() {
if (!data.firstname && !data.lastname) {
return "";
} else if (data.firstname && data.lastname) {
- return "
" + data.firstname + " " + data.lastname + "
";
+ return "" + data.firstname + " " + data.lastname + "
";
}
}
},
@@ -321,7 +321,7 @@ function loadUsers() {
class: "fade-edge remove-padding-top",
data: 'filter',
render: function (filter, type, row, meta) {
- return ' ' + filter;
+ return '' + filter;
}
},
{
@@ -331,7 +331,7 @@ function loadUsers() {
if (!data.emailAddress) {
return "";
} else {
- return " " + data.emailAddress + "";
+ return "" + data.emailAddress + "";
}
}
},
@@ -339,17 +339,13 @@ function loadUsers() {
class: "text-right content-fill text-left-on-grid-view no-wrap",
data: null,
render: function (data, type, row, meta) {
- var editbtn = ' ' +
' ' +
'' +
'' +
- '' +
- '' +
- ' Edit' +
- '' +
- '';
+ 'Edit';
var resetPasswordbtn = '' +
'' +
'' +
- '' +
- '' +
- ' Reset Password' +
- '' +
- '';
+ 'Reset Password';
var removebtn = '' +
'' +
'' +
- '' +
- '' +
- ' Remove' +
- '' +
- '';
+ 'Remove';
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;
}
- if ($("#can-reset-password").length > 0) {
+ if ($("#can-reset-password").length > 0 && adminUser !== data.filter) {
returnbtnSet = returnbtnSet + resetPasswordbtn;
}
- if ($("#can-remove").length > 0) {
+ if ($("#can-remove").length > 0 && adminUser !== data.filter && currentUser !== data.filter) {
returnbtnSet = returnbtnSet + removebtn;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs
index fe56dedb3c..ea30ecbfc9 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs
@@ -65,7 +65,7 @@
-
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js
index e4ef55ed1f..e777b314ac 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js
@@ -31,7 +31,8 @@ function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
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")) {
page.canManage = true;