diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js index c9cbbb3e8d3..fa2eaffb6ea 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js @@ -150,8 +150,7 @@ function loadRoles() { var innerhtml = ''; - //TODO: Remove the hardcoded admin role name. - var isAdmin = data.name === 'admin'; + var isAdminRole = $("#role-table").data("role") === data.name; var editLink = ''; - if (!isCloud && !isAdmin) { + if (!isCloud && !isAdminRole) { innerhtml = editLink + editPermissionLink + removeLink; } return innerhtml; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js index 63304c70b05..f16ea8db7c5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js @@ -46,9 +46,9 @@ function onRequest(context) { canView = true; } - //TODO: Remove hardcoded admin user name. var canEdit = false; - if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit") && userName !== 'admin') { + if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit") && + userName !== deviceMgtProps['adminUser'].split("@")[0]) { canEdit = true; }