From 35d96780750e17b45009f71eebc45be5e1a245df Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Mon, 19 Sep 2016 10:08:26 +0530 Subject: [PATCH] Updating permissions on operation bar for windows and iOS --- .../operation-bar.js | 33 ++++++++++++++++++- .../public/js/operation-mod.js | 19 +++-------- 2 files changed, 37 insertions(+), 15 deletions(-) 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.device.operation-bar/operation-bar.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js index 9d6b19fb50..584b2ce0d9 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js @@ -62,10 +62,41 @@ function onRequest(context) { } // adding ios operations related permission checks + permissions["ios"] = []; + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/lock")) { + permissions["ios"].push("DEVICE_LOCK"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/location")) { + permissions["ios"].push("LOCATION"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/enterprise-wipe")) { + permissions["ios"].push("ENTERPRISE_WIPE"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/notification")) { + permissions["ios"].push("NOTIFICATION"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/ring")) { + permissions["ios"].push("RING"); + } // adding windows operations related permission checks + permissions["windows"] = []; + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lock")) { + permissions["windows"].push("DEVICE_LOCK"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/disenroll/windows")) { + permissions["windows"].push("DISENROLL"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/wipe")) { + permissions["windows"].push("WIPE_DATA"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/ring")) { + permissions["windows"].push("DEVICE_RING"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lockreset")) { + permissions["windows"].push("LOCK_RESET"); + } viewModel["permissions"] = stringify(permissions); - return viewModel; } \ No newline at end of file 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.device.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-mod/public/js/operation-mod.js index 98b3e2ad9f..b0d588f2ee 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-mod/public/js/operation-mod.js @@ -107,7 +107,6 @@ var operationModule = function () { "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", "CALENDAR_SUBSCRIPTION_OPERATION_CODE": "CALENDAR_SUBSCRIPTION", "APN_OPERATION_CODE": "APN", - "DOMAIN_CODE": "DOMAIN", "CELLULAR_OPERATION_CODE": "CELLULAR", "PER_APP_VPN_OPERATION_CODE": "PER_APP_VPN", "APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE": "APP_TO_PER_APP_VPN_MAPPING" @@ -116,20 +115,10 @@ var operationModule = function () { publicMethods.getIOSServiceEndpoint = function (operationCode) { var featureMap = { "DEVICE_LOCK": "lock", - "VPN": "vpn", - "PER_APP_VPN": "per-app-vpn", - "APP_TO_PER_APP_VPN_MAPPING": "app-to-per-app-vpn-mapping", - "RING": "ring", "LOCATION": "location", + "ENTERPRISE_WIPE": "enterprise-wipe", "NOTIFICATION": "notification", - "AIR_PLAY": "airplay", - "RESTRICTION": "restriction", - "CELLULAR": "cellular", - "WIFI": "wifi", - "INSTALL_STORE_APPLICATION": "store-application", - "INSTALL_ENTERPRISE_APPLICATION": "enterprise-application", - "REMOVE_APPLICATION": "remove-application", - "ENTERPRISE_WIPE": "enterprise-wipe" + "RING": "ring" }; return "/api/device-mgt/ios/v1.0/admin/devices/" + featureMap[operationCode]; }; @@ -1187,6 +1176,7 @@ var operationModule = function () { publicMethods.getWindowsServiceEndpoint = function (operationCode) { var featureMap = { "DEVICE_LOCK": "lock-devices", + "DISENROLL": "disenroll", "DEVICE_RING": "ring-devices", "LOCK_RESET": "lock-reset-devices", "WIPE_DATA": "wipe-devices" @@ -1226,6 +1216,7 @@ var operationModule = function () { var featureMap = { "DEVICE_LOCK": "fw-lock", "DEVICE_RING": "fw-dial-up", + "DISENROLL": "fw-delete", "LOCK_RESET": "fw-key", "WIPE_DATA": "fw-clear" }; @@ -1577,7 +1568,7 @@ var operationModule = function () { var payload = publicMethods.generatePayload(platformType, operationCode, null); if(platformType == platformTypeConstants["ANDROID"] && - operationCodes[i] == androidOperationConstants["CAMERA_OPERATION_CODE"]){ + operationCodes[i] == androidOperationConstants["CAMERA_OPERATION_CODE"]){ var operations = payload["operation"]; for (var key in operations){ operationCode = key;