From 57e46525f8161923e0d0cde74d77db7b2f65b9e5 Mon Sep 17 00:00:00 2001 From: Megala Date: Tue, 15 Nov 2016 10:25:33 +0530 Subject: [PATCH] Changing the dashboard menu to be only visible for super-tenant users --- .../app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js index b7aba2e89..34500e206 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js @@ -30,6 +30,8 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; var constants = require("/app/modules/constants.js"); + var carbon = require("carbon"); + var superTenant = carbon.server.superTenant; var links = { "user-mgt": [], "role-mgt": [], @@ -55,7 +57,10 @@ function onRequest(context) { permissions["LIST_CERTIFICATES"] = userModule.isAuthorized("/permission/admin/device-mgt/certificates/view"); permissions["CONFIG_MGT_PERMITTED"] = (permissions["LIST_PLATFORM_CONFIGURATIONS"] || permissions["LIST_CERTIFICATES"]); permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view"); - permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view"); + + // Restricting the dashboard menu only for super-tenant users + permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view") && + (viewModel["currentUser"].domain == superTenant.domain); viewModel["permissions"] = permissions; viewModel["appContext"] = mdmProps["appContext"];