From 2206e258d113c841a3c8c2c89f5998c85677f1be Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sun, 15 Jan 2017 23:40:00 +0530 Subject: [PATCH] Fixing permissions for [devicemgt-user] and [devicemgt-admin] roles --- .../jaggeryapps/devicemgt/app/modules/init.js | 16 ++++---- .../cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs | 38 +++++++++---------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js index bc0fa5abb04..4815edd59d0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/init.js @@ -29,13 +29,15 @@ var carbonServer = new carbonModule.server.Server({ application.put("carbonServer", carbonServer); var permissions = { - "/permission/admin/device-mgt/devices/enroll": ["ui.execute"], - "/permission/admin/device-mgt/devices/disenroll": ["ui.execute"], - "/permission/admin/device-mgt/devices/owning-device": ["ui.execute"], - "/permission/admin/device-mgt/groups": ["ui.execute"], - "/permission/admin/device-mgt/notifications": ["ui.execute"], - "/permission/admin/device-mgt/policies": ["ui.execute"], - "/permission/admin/manage/api/subscribe": ["ui.execute"] + "/permission/admin/Login": ["ui.execute"] }; +var adminPermissions = { + "/permission/admin": ["ui.execute"] +}; + +//On Startup, admin user will get both roles: devicemgt-admin and devicemgt-user +//Average user through sign-up will only receive the role: devicemgt-user. +//Admin can setup necessary permissions for the role: devicemgt-user userModule.addRole("internal/devicemgt-user", ["admin"], permissions); +userModule.addRole("internal/devicemgt-admin", ["admin"], adminPermissions); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs index 21687eef226..51d087ca345 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs @@ -45,33 +45,33 @@ {{/if}} -
  • User Management - +
  • + {{/if}} {{#if permissions.LIST_POLICIES}}
  • Policy Management
  • {{/if}} -
  • Configuration Management - +
  • + {{/if}} {{/zone}} {{#zone "navbarCollapsableRightItems"}}