From 21b0ed284b9df78541172e435cd7f5576473024b Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Thu, 31 Aug 2017 17:24:12 +0530 Subject: [PATCH] Removed hardcoded admin user name. --- .../app/pages/cdmf.page.roles/public/js/role-listing.js | 5 ++--- .../devicemgt/app/pages/cdmf.page.user.view/view.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) 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 c9cbbb3e8d..fa2eaffb6e 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 63304c70b0..f16ea8db7c 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; }