diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.hbs index f5b969973..0bf54e2c2 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.hbs @@ -19,7 +19,6 @@ {{unit "cdmf.unit.lib.qrcode"}} {{unit "mdm.unit.device.qr-modal"}} {{#zone "content"}} - {{#if permissions.VIEW_DASHBOARD}} {{#if permissions.LIST_DEVICES}}
@@ -151,9 +150,6 @@
{{/if}} - {{else}} - Permission denied - {{/if}} {{/zone}} {{#zone "bottomJs"}} {{js "js/dashboard.js"}} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.js index e9b07a654..a6c495532 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.js @@ -20,10 +20,16 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var generalConfig = context.app.conf["generalConfig"]; var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; - var viewModel = {}; - viewModel.permissions = userModule.getUIPermissions(); - new Log().debug("## Permissions : " + stringify(userModule.getUIPermissions())); + var permissions = {}; + permissions.LIST_DEVICES = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view"); + permissions.LIST_POLICIES = userModule.isAuthorized("/permission/admin/device-mgt/policies/view"); + permissions.LIST_ROLES = userModule.isAuthorized("/permission/admin/device-mgt/roles/view"); + permissions.LIST_USERS = userModule.isAuthorized("/permission/admin/device-mgt/users/view"); + permissions.ADD_POLICY = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage"); + permissions.ADD_ROLE = userModule.isAuthorized("/permission/admin/device-mgt/roles/manage"); + permissions.ADD_USER = userModule.isAuthorized("/permission/admin/device-mgt/users/manage"); + viewModel.permissions = permissions; //TODO: Move enrollment URL into app-conf.json viewModel.enrollmentURL = mdmProps.generalConfig.host + mdmProps.enrollmentDir; return viewModel; 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.hbs 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.hbs index 18afc371a..9d24059a2 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.hbs +++ 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.hbs @@ -22,30 +22,20 @@ {{/zone}} {{#zone "navMenu-items"}} - {{#if permissions.VIEW_DASHBOARD}}
  • Admin Dashboard
  • - {{/if}} - {{#if permissions.LIST_DEVICES_ADMIN}} + + {{#if permissions.LIST_DEVICES}}
  • Device Management
  • - {{else}} - {{#if permissions.LIST_OWN_DEVICES}} -
  • - - - Device Management - -
  • - {{/if}} {{/if}}
  • User Management @@ -64,12 +54,12 @@ {{/if}}
  • Configuration Management {{/zone}} {{#zone "sidePanes"}} -