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 f5b9699730..0bf54e2c22 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 e9b07a654b..a6c4955325 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/pages/mdm.page.devices/devices.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs index ca88bd53bb..0c56529574 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs @@ -28,6 +28,7 @@
  • + Devices @@ -35,132 +36,131 @@ {{/zone}} {{#zone "navbarActions"}} -{{!-- #if permissions.enroll --}} -
  • - - - - - - - - - - - Enroll Device - -
  • - {{!-- /if --}} -
  • - - - - - - - - - - - Advanced Search - -
  • + {{#if permissions.ENROLL_DEVICE}} +
  • + + + + + + + + + + +   Enroll Device + +
  • + {{/if}} + {{#if permissions.ADVANCED_SEARCH}} +
  • + + + + + + + + + + +   Advanced Search + +
  • + {{/if}} {{/zone}} {{#zone "content"}} - -
    - -     - Loading devices . . . -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    By Device NameBy OwnerBy StatusBy PlatformBy Ownership
    -
    -
    -