diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index ac46bbc1f6..30dcb47041 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.mdm.services.android.services; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.mdm.services.android.bean.wrapper.*; @@ -93,7 +92,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new lock operation.") }) - @Permission(name = "Lock Device", permission = "/device-mgt/devices/owning/operations/android/lock") + @Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/android/lock") Response configureDeviceLock( @ApiParam(name = "deviceLockBeanWrapper", value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper); @@ -147,7 +146,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new un-lock operation.") }) - @Permission(name = "Unlock Device", permission = "/device-mgt/devices/owning/operations/android/unlock") + @Permission(name = "Unlock Device", permission = "/device-mgt/devices/owning-device/operations/android/unlock") Response configureDeviceUnlock( @ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation") List deviceIDs); @@ -200,7 +199,7 @@ public interface DeviceManagementAdminService { code = 500, message = "Internal Server Error. \n " + "Server error occurred while adding a new get-location operation.")}) - @Permission(name = "Get Device Location", permission = "/device-mgt/devices/owning/operations/android/location") + @Permission(name = "Get Device Location", permission = "/device-mgt/devices/owning-device/operations/android/location") Response getDeviceLocation( @ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location") List deviceIDs); @@ -253,7 +252,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new clear password operation.") }) - @Permission(name = "Clear Password of Device", permission = "/device-mgt/devices/owning/operations/android/clear-password") + @Permission(name = "Clear Password of Device", permission = "/device-mgt/devices/owning-device/operations/android/clear-password") Response removePassword( @ApiParam(name = "deviceIDs", value = "DeviceIds to be requested to remove password") List deviceIDs); @@ -306,7 +305,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new control camera operation.") }) - @Permission(name = "Manage Camera", permission = "/device-mgt/devices/owning/operations/android/camera") + @Permission(name = "Manage Camera", permission = "/device-mgt/devices/owning-device/operations/android/camera") Response configureCamera( @ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs") CameraBeanWrapper cameraBeanWrapper); @@ -362,7 +361,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device info operation.") }) - @Permission(name = "Get Device Information", permission = "/device-mgt/devices/owning/operations/android/info") + @Permission(name = "Get Device Information", permission = "/device-mgt/devices/owning-device/operations/android/info") Response getDeviceInformation( @ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information") List deviceIDs); @@ -418,7 +417,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device logcat operation.") }) - @Permission(name = "Get Logs", permission = "/device-mgt/devices/owning/operations/android/logcat") + @Permission(name = "Get Logs", permission = "/device-mgt/devices/owning-device/operations/android/logcat") Response getDeviceLogcat( @ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device logcat") List deviceIDs); @@ -472,7 +471,7 @@ public interface DeviceManagementAdminService { code = 500, message = "Internal Server Error. \n " + "Server error occurred while adding a enterprise wipe operation.")}) - @Permission(name = "Enterprise Wipe", permission = "/device-mgt/devices/owning/operations/android/enterprise-wipe") + @Permission(name = "Enterprise Wipe", permission = "/device-mgt/devices/owning-device/operations/android/enterprise-wipe") Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to do enterprise-wipe") List deviceIDs); @@ -524,7 +523,7 @@ public interface DeviceManagementAdminService { code = 500, message = "Internal Server Error. \n " + "Server error occurred while adding a device wipe operation.")}) - @Permission(name = "Factory Reset", permission = "/device-mgt/devices/owning/operations/android/wipe") + @Permission(name = "Factory Reset", permission = "/device-mgt/devices/owning-device/operations/android/wipe") Response wipeData( @ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds needed to do wipe-data") WipeDataBeanWrapper wipeDataBeanWrapper); @@ -581,7 +580,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new get-applications operation.") }) - @Permission(name = "Get Installed Application", permission = "/device-mgt/devices/owning/operations/android/applications") + @Permission(name = "Get Installed Application", permission = "/device-mgt/devices/owning-device/operations/android/applications") Response getApplications( @ApiParam(name = "deviceIDs", value = "Device Ids needed to get applications that are already installed") List deviceIDs); @@ -634,7 +633,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device ring operation.") }) - @Permission(name = "Ring Device", permission = "/device-mgt/devices/owning/operations/android/ring") + @Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/android/ring") Response ringDevice( @ApiParam(name = "deviceIDs", value = "Device Ids needed for ring") List deviceIDs); @@ -687,7 +686,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new device reboot operation.") }) - @Permission(name = "Reboot Device", permission = "/device-mgt/devices/owning/operations/android/reboot") + @Permission(name = "Reboot Device", permission = "/device-mgt/devices/owning-device/operations/android/reboot") Response rebootDevice( @ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.") List deviceIDs); @@ -740,7 +739,7 @@ public interface DeviceManagementAdminService { "Server error occurred while adding a new device mute operation.") }) @Path("/mute") - @Permission(name = "Mute Device", permission = "/device-mgt/devices/owning/operations/android/mute") + @Permission(name = "Mute Device", permission = "/device-mgt/devices/owning-device/operations/android/mute") Response muteDevice( @ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted") List deviceIDs); @@ -796,7 +795,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new install-application operation.") }) - @Permission(name = "Install Applications", permission = "/device-mgt/devices/owning/operations/android/install-app") + @Permission(name = "Install Applications", permission = "/device-mgt/devices/owning-device/operations/android/install-app") Response installApplication( @ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs") ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper); @@ -852,7 +851,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new update-application operation.") }) - @Permission(name = "Update installed applications", permission = "/device-mgt/devices/owning/operations/android/update-app") + @Permission(name = "Update installed applications", permission = "/device-mgt/devices/owning-device/operations/android/update-app") Response updateApplication( @ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs") ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper); @@ -905,7 +904,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new uninstall-application operation.") }) - @Permission(name = "Uninstall Applications", permission = "/device-mgt/devices/owning/operations/android/uninstall-app") + @Permission(name = "Uninstall Applications", permission = "/device-mgt/devices/owning-device/operations/android/uninstall-app") Response uninstallApplication( @ApiParam(name = "applicationUninstallationBeanWrapper", value = "applicationUninstallationConfigs and Device Ids") @@ -960,7 +959,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new blacklist-applications operation.") }) - @Permission(name = "Blacklist Applications", permission = "/device-mgt/devices/owning/operations/android/blacklist-app") + @Permission(name = "Blacklist Applications", permission = "/device-mgt/devices/owning-device/operations/android/blacklist-app") Response blacklistApplications( @ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " + "Configuration and DeviceIds") @@ -1015,7 +1014,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new upgrade firmware operation.") }) - @Permission(name = "Upgrade Firmware", permission = "/device-mgt/devices/owning/operations/android/upgrade") + @Permission(name = "Upgrade Firmware", permission = "/device-mgt/devices/owning-device/operations/android/upgrade") Response upgradeFirmware( @ApiParam(name = "upgradeFirmwareBeanWrapper", value = "Firmware upgrade configuration and DeviceIds") @@ -1070,7 +1069,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new configure VPN operation.") }) - @Permission(name = "Add VPN", permission = "/device-mgt/devices/owning/operations/android/vpn") + @Permission(name = "Add VPN", permission = "/device-mgt/devices/owning-device/operations/android/vpn") Response configureVPN( @ApiParam(name = "vpnBeanWrapper", value = "VPN configuration and DeviceIds") @@ -1124,7 +1123,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new send notification operation.") }) - @Permission(name = "Send Notifications", permission = "/device-mgt/devices/owning/operations/android/notification") + @Permission(name = "Send Notifications", permission = "/device-mgt/devices/owning-device/operations/android/send-notification") Response sendNotification( @ApiParam(name = "notificationBeanWrapper", value = "Notification Configurations and device Ids") @@ -1178,7 +1177,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new configure wifi operation.") }) - @Permission(name = "Add Wifi Configuration", permission = "/device-mgt/devices/owning/operations/android/wifi") + @Permission(name = "Add Wifi Configuration", permission = "/device-mgt/devices/owning-device/operations/android/wifi") Response configureWifi( @ApiParam(name = "wifiBeanWrapper", value = "WifiConfigurations and Device Ids") WifiBeanWrapper wifiBeanWrapper); @@ -1231,7 +1230,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new encrypt storage operation.") }) - @Permission(name = "Encrypt Device", permission = "/device-mgt/devices/owning/operations/android/encrypt") + @Permission(name = "Encrypt Device", permission = "/device-mgt/devices/owning-device/operations/android/encrypt") Response encryptStorage( @ApiParam(name = "encryptionBeanWrapper", value = "Configurations and deviceIds need to be done data encryption") @@ -1285,7 +1284,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new change lock code operation.") }) - @Permission(name = "Change Password of Device", permission = "/device-mgt/devices/owning/operations/android/change-lock") + @Permission(name = "Change Password of Device", permission = "/device-mgt/devices/owning-device/operations/android/change-lock-code") Response changeLockCode( @ApiParam(name = "lockCodeBeanWrapper", value = "Configurations and device Ids need to be done change lock code") @@ -1339,7 +1338,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new set password policy operation.") }) - @Permission(name = "Set Password Policy", permission = "/device-mgt/devices/owning/operations/android/password-policy") + @Permission(name = "Set Password Policy", permission = "/device-mgt/devices/owning-device/operations/android/password-policy") Response setPasswordPolicy( @ApiParam(name = "passwordPolicyBeanWrapper", value = "Password Policy Configurations and Device Ids") @@ -1393,7 +1392,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n " + "Server error occurred while adding a new set webclip operation.") }) - @Permission(name = "Add Webclips", permission = "/device-mgt/devices/owning/operations/android/webclip") + @Permission(name = "Add Webclips", permission = "/device-mgt/devices/owning-device/operations/android/webclip") Response setWebClip( @ApiParam(name = "webClipBeanWrapper", value = "Configurations to need set web clip on device and device Ids") diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java index 5b24c62be3..e5e42f31f3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.mdm.services.android.services; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration; import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; @@ -82,7 +81,7 @@ public interface DeviceTypeConfigurationService { code = 500, message = "Internal Server Error. \n Server error occurred while fetching Android platform configuration.") }) - @Permission(name = "View Configurations", permission = "/device-mgt/configurations/view") + @Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view") Response getConfiguration( @ApiParam( name = "If-Modified-Since", @@ -132,7 +131,7 @@ public interface DeviceTypeConfigurationService { message = "Internal Server Error. \n " + "Server error occurred while modifying Android platform configuration.") }) - @Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage") + @Permission(name = "Manage Configurations", permission = "/device-mgt/platform-configurations/manage") Response updateConfiguration( @ApiParam(name = "configuration", value = "AndroidPlatformConfiguration") 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 2026ed97ad..8439db3781 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,8 +19,8 @@ {{unit "cdmf.unit.lib.qrcode"}} {{unit "mdm.unit.device.qr-modal"}} {{#zone "content"}} +
{{#if permissions.LIST_DEVICES}} -
Devices
@@ -150,8 +150,15 @@
-
{{/if}} + {{# if permissions.PERMITTED_NONE}} +

+ Permitted None +

+
+ You are not authorized to view any of the dashboard listed resources. + {{/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 e1480d31c4..9a7fa6c1a3 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 @@ -16,24 +16,27 @@ * under the License. */ -function onRequest(context) { +function onRequest() { 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 = {}; 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"); - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/ios") | userModule.isAuthorized("/permission/admin/devices/enroll/android") | userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/windows") ){ - permissions.ENROLL_DEVICE = true; - } - viewModel.permissions = permissions; + permissions["LIST_DEVICES"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view"); + permissions["ENROLL_DEVICE"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/ios") || + userModule.isAuthorized("/permission/admin/devices/enroll/android") || + userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/windows"); + permissions["LIST_POLICIES"] = userModule.isAuthorized("/permission/admin/device-mgt/policies/view"); + permissions["ADD_POLICY"] = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage"); + permissions["LIST_USERS"] = userModule.isAuthorized("/permission/admin/device-mgt/users/view"); + permissions["ADD_USER"] = userModule.isAuthorized("/permission/admin/device-mgt/users/manage"); + permissions["LIST_ROLES"] = userModule.isAuthorized("/permission/admin/device-mgt/roles/view"); + permissions["ADD_ROLE"] = userModule.isAuthorized("/permission/admin/device-mgt/roles/manage"); + permissions["PERMITTED_NONE"] = !(permissions["LIST_DEVICES"] || permissions["LIST_POLICIES"] || + permissions["LIST_USERS"] || permissions["LIST_ROLES"]); + + viewModel["permissions"] = permissions; //TODO: Move enrollment URL into app-conf.json - viewModel.enrollmentURL = mdmProps.generalConfig.host + mdmProps.enrollmentDir; + viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"]; 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/pages/mdm.page.device.view/view.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.js index 1f7e9c0881..35c71cbd9f 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.js @@ -22,7 +22,7 @@ function onRequest(context){ // permission checks // [1] checking viewing devices permission - viewModel["isAuthorized"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view"); + viewModel["isAuthorized"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view"); if (viewModel["isAuthorized"]) { context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { 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 b56d066f1c..748d8b9d43 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 @@ -138,20 +138,19 @@ @@ -342,7 +342,7 @@ @@ -398,7 +398,7 @@ Yes - + No @@ -492,7 +492,7 @@ Yes - + No 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 d8e8b84050..b6ac6b5f8c 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 @@ -16,7 +16,7 @@ * under the License. */ -function onRequest(context) { +function onRequest() { // var log = new Log("mdm.unit.device.operation-bar"); var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var viewModel = {}; @@ -24,48 +24,79 @@ function onRequest(context) { // adding android operations related permission checks permissions["android"] = []; - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/ring")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/ring")) { permissions["android"].push("DEVICE_RING"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/lock-devices")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/lock")) { permissions["android"].push("DEVICE_LOCK"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/unlock-devices")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/unlock")) { permissions["android"].push("DEVICE_UNLOCK"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/location")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/location")) { permissions["android"].push("DEVICE_LOCATION"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/clear-password")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/clear-password")) { permissions["android"].push("CLEAR_PASSWORD"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/reboot")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/reboot")) { permissions["android"].push("DEVICE_REBOOT"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/upgrade-firmware")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/upgrade-firmware")) { permissions["android"].push("UPGRADE_FIRMWARE"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/mute")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/mute")) { permissions["android"].push("DEVICE_MUTE"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/send-notification")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/send-notification")) { permissions["android"].push("NOTIFICATION"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/change-lock-code")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/change-lock-code")) { permissions["android"].push("CHANGE_LOCK_CODE"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/enterprise-wipe")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/enterprise-wipe")) { permissions["android"].push("ENTERPRISE_WIPE"); } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/wipe")) { + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/wipe")) { permissions["android"].push("WIPE_DATA"); } // 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-bar/public/templates/operations.hbs 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/public/templates/operations.hbs index 43a6019157..cd32216746 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/public/templates/operations.hbs +++ 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/public/templates/operations.hbs @@ -235,7 +235,7 @@ 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 a7002bb7f7..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]; }; @@ -895,7 +884,7 @@ var operationModule = function () { "ALLOW_PARENT_PROFILE_APP_LINKING" : operationData["disallowParentProfileAppLinking"], "ENSURE_VERIFY_APPS" : operationData["ensureVerifyApps"], "AUTO_TIME" : operationData["enableAutoTime"], - "SET_SCREEN_CAPTURE_DISABLED" : operationData["diableScreenCapture"], + "SET_SCREEN_CAPTURE_DISABLED" : operationData["disableScreenCapture"], "SET_STATUS_BAR_DISABLED" : operationData["disableStatusBar"] } }; @@ -1016,13 +1005,21 @@ var operationModule = function () { break; case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]: operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "type": operationData["cosuSystemUpdateType"], - "startTime": operationData["cosuWindowStartTime"], - "endTime": operationData["cosuWindowEndTime"] - } - }; + if (operationData["cosuSystemUpdatePolicyType"] != "window") { + payload = { + "operation": { + "type": operationData["cosuSystemUpdatePolicyType"] + } + }; + } else { + payload = { + "operation": { + "type": operationData["cosuSystemUpdatePolicyType"], + "startTime": operationData["cosuSystemUpdatePolicyWindowStartTime"], + "endTime": operationData["cosuSystemUpdatePolicyWindowEndTime"] + } + }; + } break; case androidOperationConstants["KIOSK_APPS_CODE"]: operationType = operationTypeConstants["PROFILE"]; @@ -1178,29 +1175,14 @@ var operationModule = function () { publicMethods.getWindowsServiceEndpoint = function (operationCode) { var featureMap = { - "CAMERA": "camera", - "DEVICE_LOCK": "lock", - "DEVICE_LOCATION": "location", - "CLEAR_PASSWORD": "clear-password", - "APPLICATION_LIST": "get-application-list", - "DEVICE_RING": "ring-device", - "DEVICE_REBOOT": "reboot-device", - "UPGRADE_FIRMWARE": "upgrade-firmware", - "DEVICE_MUTE": "mute", - "LOCK_RESET": "lock-reset", - "NOTIFICATION": "notification", - "ENCRYPT_STORAGE": "encrypt", - "CHANGE_LOCK_CODE": "change-lock-code", - "WEBCLIP": "webclip", - "INSTALL_APPLICATION": "install-application", - "UNINSTALL_APPLICATION": "uninstall-application", - "BLACKLIST_APPLICATIONS": "blacklist-applications", - "PASSCODE_POLICY": "password-policy", - "ENTERPRISE_WIPE": "enterprise-wipe", - "WIPE_DATA": "wipe-data", - "DISENROLL": "disenroll" + "DEVICE_LOCK": "lock-devices", + "DISENROLL": "disenroll", + "DEVICE_RING": "ring-devices", + "LOCK_RESET": "lock-reset-devices", + "WIPE_DATA": "wipe-devices" }; - return "/mdm-windows-agent/services/windows/operation/" + featureMap[operationCode]; + //return "/mdm-windows-agent/services/windows/operation/" + featureMap[operationCode]; + return "/api/device-mgt/windows/v1.0/admin/devices/" + featureMap[operationCode]; }; /** * Get the icon for the featureCode @@ -1233,15 +1215,10 @@ var operationModule = function () { publicMethods.getWindowsIconForFeature = function (operationCode) { var featureMap = { "DEVICE_LOCK": "fw-lock", - "DEVICE_LOCATION": "fw-map-location", - "DISENROLL": "fw-delete", - "WIPE_DATA": "fw-clear", "DEVICE_RING": "fw-dial-up", - "DEVICE_REBOOT": "fw-refresh", - "UPGRADE_FIRMWARE": "fw-up-arrow", - "DEVICE_MUTE": "fw-incoming-call", - "NOTIFICATION": "fw-message", - "LOCK_RESET": "fw-key" + "DISENROLL": "fw-delete", + "LOCK_RESET": "fw-key", + "WIPE_DATA": "fw-clear" }; return featureMap[operationCode]; }; @@ -1292,14 +1269,18 @@ var operationModule = function () { var key = operationDataObj.data("key"); var value; if (operationDataObj.is(":text") || operationDataObj.is("textarea") || - operationDataObj.is(":password") || operationDataObj.is(":hidden")) { + operationDataObj.is(":password") || operationDataObj.is("input[type=hidden]")) { value = operationDataObj.val(); + operationData[key] = value; } else if (operationDataObj.is(":checkbox")) { value = operationDataObj.is(":checked"); + operationData[key] = value; } else if (operationDataObj.is(":radio") && operationDataObj.is(":checked")) { - value = operationDataObj.val(); + value = operationDataObj.val(); + operationData[key] = value; } else if (operationDataObj.is("select")) { value = operationDataObj.find("option:selected").attr("value"); + operationData[key] = value; } else if (operationDataObj.hasClass("grouped-array-input")) { value = []; var childInput; @@ -1308,7 +1289,7 @@ var operationModule = function () { $(".child-input", this).each(function () { childInput = $(this); if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is(":hidden")) { + || childInput.is("input[type=hidden]")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -1335,7 +1316,7 @@ var operationModule = function () { $(".child-input", this).each(function () { childInput = $(this); if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is(":hidden")) { + || childInput.is("input[type=hidden]")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -1367,7 +1348,7 @@ var operationModule = function () { childInput = $(this); childInputKey = childInput.data("child-key"); if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is(":hidden")) { + || childInput.is("input[type=hidden]")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -1391,8 +1372,8 @@ var operationModule = function () { } }); } + operationData[key] = value; } - operationData[key] = value; } ); @@ -1443,10 +1424,15 @@ var operationModule = function () { // populating input value according to the type of input if (operationDataObj.is(":text") || operationDataObj.is("textarea") || - operationDataObj.is(":password")) { + operationDataObj.is(":password") || + operationDataObj.is("input[type=hidden]")) { operationDataObj.val(value); } else if (operationDataObj.is(":checkbox")) { operationDataObj.prop("checked", value); + } else if (operationDataObj.is(":radio")) { + if (operationDataObj.val() == uiPayload[key]) { + operationDataObj.attr("checked", true); + } } else if (operationDataObj.is("select")) { operationDataObj.val(value); /* trigger a change of value, so that if slidable panes exist, @@ -1469,9 +1455,9 @@ var operationModule = function () { var childInputValue = value[childInputIndex]; // populating extracted value in the UI according to the input type if (childInput.is(":text") || - childInput.is(":hidden") || childInput.is("textarea") || childInput.is(":password") || + childInput.is("input[type=hidden]") || childInput.is("select")) { childInput.val(childInputValue); } else if (childInput.is(":checkbox")) { @@ -1517,9 +1503,9 @@ var operationModule = function () { } // populating extracted value in the UI according to the input type if (childInput.is(":text") || - childInput.is(":hidden") || childInput.is("textarea") || childInput.is(":password") || + childInput.is("input[type=hidden]") || childInput.is("select")) { childInput.val(childInputValue); } else if (childInput.is(":checkbox")) { @@ -1546,9 +1532,9 @@ var operationModule = function () { var childInputValue = multiColumnKeyValuePair[childInputKey]; // populating extracted value in the UI according to the input type if (childInput.is(":text") || - childInput.is(":hidden") || childInput.is("textarea") || childInput.is(":password") || + childInput.is("input[type=hidden]") || childInput.is("select")) { childInput.val(childInputValue); } else if (childInput.is(":checkbox")) { @@ -1582,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; @@ -1719,7 +1705,7 @@ var operationModule = function () { restrictions["enableAutoTime"] = restriction["enabled"]; continue; } else if (featureCode == androidOperationConstants["SET_SCREEN_CAPTURE_DISABLED"]){ - restrictions["diableScreenCapture"] = restriction["enabled"]; + restrictions["disableScreenCapture"] = restriction["enabled"]; continue; } else if (featureCode == androidOperationConstants["SET_STATUS_BAR_DISABLED"]){ restrictions["disableStatusBar"] = restriction["enabled"]; 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.qr-modal/qr-modal.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.qr-modal/qr-modal.hbs index 5da7c3427e..887bad097c 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.qr-modal/qr-modal.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.qr-modal/qr-modal.hbs @@ -18,25 +18,46 @@ {{#zone "content"}}