diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java index 766698c9c7..7d7636d1a4 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java @@ -73,8 +73,12 @@ public class ApplicationOperationsImpl implements ApplicationOperations { getDevicesOfUser(userName); for (org.wso2.carbon.device.mgt.common.Device device : deviceList) { - if(applicationOperationAction.getApp().getPlatform().equalsIgnoreCase(device.getType())){ - deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); + if(MDMAppConstants.WEBAPP.equals(applicationOperationAction.getApp().getPlatform()) || + applicationOperationAction.getApp().getPlatform().equalsIgnoreCase(device.getType())){ + if (MDMAppConstants.ACTIVE.equalsIgnoreCase(device.getEnrolmentInfo(). + getStatus().toString())) { + deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); + } } } } @@ -95,7 +99,9 @@ public class ApplicationOperationsImpl implements ApplicationOperations { getAllDevicesOfRole(userRole); for (org.wso2.carbon.device.mgt.common.Device device : deviceList) { - deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); + if (MDMAppConstants.ACTIVE.equalsIgnoreCase(device.getEnrolmentInfo().getStatus().toString())) { + deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); + } } } } catch (DeviceManagementException devMgtEx) { @@ -176,8 +182,11 @@ public class ApplicationOperationsImpl implements ApplicationOperations { operation = IOSApplicationOperationUtil.createInstallAppOperation(mobileApp); } else { - operation = - IOSApplicationOperationUtil.createAppUninstallOperation(mobileApp); + if (MDMAppConstants.WEBAPP.equals(app.getPlatform())) { + operation = IOSApplicationOperationUtil.createWebClipUninstallOperation(mobileApp); + } else { + operation = IOSApplicationOperationUtil.createAppUninstallOperation(mobileApp); + } } } activity = MDMServiceAPIUtils.getAppManagementService(applicationOperationAction.getTenantId()) @@ -225,11 +234,22 @@ public class ApplicationOperationsImpl implements ApplicationOperations { throws MobileApplicationException { List devices; + List deviceList = null; try { - List deviceList = MDMServiceAPIUtils - .getDeviceManagementService(applicationOperationDevice.getTenantId()). - getDevicesOfUser( - applicationOperationDevice.getCurrentUser().getUsername()); + if(MDMAppConstants.WEBAPP.equals + (applicationOperationDevice.getPlatform())) { + deviceList = MDMServiceAPIUtils + .getDeviceManagementService(applicationOperationDevice.getTenantId()). + getDevicesOfUser( + applicationOperationDevice.getCurrentUser().getUsername()); + } else { + //TODO: Uncomment below when device-mgt core release-2.0.x is merged with master branch. + /*deviceList = MDMServiceAPIUtils + .getDeviceManagementService(applicationOperationDevice.getTenantId()). + getDevicesOfUser( + applicationOperationDevice.getCurrentUser().getUsername(), + applicationOperationDevice.getPlatform());*/ + } devices = new ArrayList<>(deviceList.size()); if(log.isDebugEnabled()){ log.debug("device list got from mdm "+ deviceList.toString()); diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java index 22c7963def..d5ae921705 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java @@ -23,6 +23,15 @@ import java.io.Serializable; public class RemoveApplication implements Serializable { private String bundleId; + private String url; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } public String getBundleId() { return bundleId; diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java index 5b2dec4eb9..6adb9fe09d 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java @@ -111,4 +111,21 @@ public class IOSApplicationOperationUtil { return operation; } + /** + * Create uninstall operations for webclip. + * + * @param application + * @return Uninstall operation + * @throws DeviceApplicationException + */ + public static Operation createWebClipUninstallOperation(MobileApp application) throws + DeviceApplicationException { + ProfileOperation operation = new ProfileOperation(); + operation.setCode(MDMAppConstants.IOSConstants.OPCODE_REMOVE_APPLICATION); + operation.setType(Operation.Type.PROFILE); + RemoveApplication removeApplication = new RemoveApplication(); + removeApplication.setUrl(application.getIdentifier()); + operation.setPayLoad(removeApplication.toJSON()); + return operation; + } } diff --git a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs new file mode 100644 index 0000000000..8cfcbeed35 --- /dev/null +++ b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs @@ -0,0 +1,85 @@ +{{! + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + WSO2 Inc. licenses this file to you under the Apache License, + Version 2.0 (the "License"); you may not use this file except + in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +}} +{{#zone "topCss"}} + +{{/zone}} + +{{#zone "device-thumbnail"}} + +{{/zone}} + +{{#zone "device-opetations"}} +
+ Operations +
+
+ {{unit "iot.unit.device.operation-bar" device=device backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}} +
+{{/zone}} + +{{#zone "device-detail-properties"}} +
+ +
+
+ +
+
Device Statistics
+ {{unit "cdmf.unit.device.type.raspberrypi.realtime.analytics-view" device=device}} +
+
+
Operations Log
+
+ +
+
+ Not available yet +
+
+
+
+
+
+
+
+{{/zone}} 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/impl/DeviceManagementServiceImpl.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/impl/DeviceManagementServiceImpl.java index ddcf2a49d0..4ca9b9b44d 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/impl/DeviceManagementServiceImpl.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/impl/DeviceManagementServiceImpl.java @@ -276,25 +276,52 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @Path("/{id}") @Override public Response modifyEnrollment(@PathParam("id") String id, @Valid AndroidDevice androidDevice) { - Device device = new Device(); - String msg = ""; - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - if(androidDevice.getEnrolmentInfo().getDateOfEnrolment() <= 0){ - msg = "Invalid Enrollment date."; - return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + Device device; + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(id); + deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID); + try { + device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + } catch (DeviceManagementException e) { + String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" + + id + "'"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); } - if(androidDevice.getEnrolmentInfo().getDateOfLastUpdate() <= 0){ - msg = "Invalid Last Updated date."; - return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + + if (androidDevice == null) { + String errorMessage = "The payload of the android device enrollment is incorrect."; + log.error(errorMessage); + throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + if (device == null) { + String errorMessage = "The device to be modified doesn't exist."; + log.error(errorMessage); + throw new org.wso2.carbon.mdm.services.android.exception.NotFoundException( + new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build()); + } + if(androidDevice.getEnrolmentInfo() != null){ + device.setEnrolmentInfo(device.getEnrolmentInfo()); } - device.setEnrolmentInfo(androidDevice.getEnrolmentInfo()); device.getEnrolmentInfo().setOwner(AndroidAPIUtils.getAuthenticatedUser()); - device.setDeviceInfo(androidDevice.getDeviceInfo()); + if(androidDevice.getDeviceInfo() != null) { + device.setDeviceInfo(androidDevice.getDeviceInfo()); + } device.setDeviceIdentifier(androidDevice.getDeviceIdentifier()); - device.setDescription(androidDevice.getDescription()); - device.setName(androidDevice.getName()); - device.setFeatures(androidDevice.getFeatures()); - device.setProperties(androidDevice.getProperties()); + if(androidDevice.getDescription() != null) { + device.setDescription(androidDevice.getDescription()); + } + if(androidDevice.getName() != null) { + device.setName(androidDevice.getName()); + } + if(androidDevice.getFeatures() != null) { + device.setFeatures(androidDevice.getFeatures()); + } + if(androidDevice.getProperties() != null) { + device.setProperties(androidDevice.getProperties()); + } boolean result; try { device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); @@ -313,7 +340,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { return Response.status(Response.Status.NOT_MODIFIED).entity(responseMessage).build(); } } catch (DeviceManagementException e) { - msg = "Error occurred while modifying enrollment of the Android device that carries the id '" + + String msg = "Error occurred while modifying enrollment of the Android device that carries the id '" + id + "'"; log.error(msg, e); throw new UnexpectedServerErrorException( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk new file mode 100755 index 0000000000..62abf46b6d Binary files /dev/null and b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk differ diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.hbs deleted file mode 100644 index ae98640183..0000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.hbs +++ /dev/null @@ -1,32 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. licenses this file to you under the Apache License, - Version 2.0 (the "License"); you may not use this file except - in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -}} - -{{unit "cdmf.unit.device.type.android.date-range-picker"}} - -{{#zone "content"}} -
- {{unit "cdmf.unit.device.type.android.operation-mod"}} -
-{{/zone}} - -{{#zone "bottomJs"}} - - - {{js "js/operation-bar.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.js deleted file mode 100644 index 18541e4a9d..0000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -function onRequest(context) { - var log = new Log("cdmf.unit.device.type.android.operation-bar"); - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var viewModel = {}; - var permissions = {}; - - // adding android operations related permission checks - permissions["android"] = []; - 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-device/operations/android/lock")) { - permissions["android"].push("DEVICE_LOCK"); - } - 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-device/operations/android/location")) { - permissions["android"].push("DEVICE_LOCATION"); - } - 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-device/operations/android/reboot")) { - permissions["android"].push("DEVICE_REBOOT"); - } - 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-device/operations/android/mute")) { - permissions["android"].push("DEVICE_MUTE"); - } - 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-device/operations/android/change-lock-code")) { - permissions["android"].push("CHANGE_LOCK_CODE"); - } - 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-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/lock-reset")) { - permissions["windows"].push("LOCK_RESET"); - } - - viewModel["permissions"] = stringify(permissions); - - viewModel["deviceType"] = context.unit.params.deviceType; - viewModel["ownership"] = context.unit.params.ownership; - - return viewModel; -} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.json deleted file mode 100644 index 688e939808..0000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/js/operation-bar.js deleted file mode 100644 index 90ce9ce4a2..0000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/js/operation-bar.js +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Setting-up global variables. - */ - -var operations = '.wr-operations', - modalPopup = '.modal', - modalPopupContent = modalPopup + ' .modal-content', - navHeight = $('#nav').height(), - headerHeight = $('header').height(), - offset = (headerHeight + navHeight), - deviceSelection = '.device-select', - platformTypeConstants = { - "ANDROID": "android", - "IOS": "ios", - "WINDOWS": "windows" - }, - ownershipTypeConstants = { - "BYOD": "BYOD", - "COPE": "COPE" - }, - operationBarModeConstants = { - "BULK": "BULK_OPERATION_MODE", - "SINGLE": "SINGLE_OPERATION_MODE" - }; - -/* - * Function to get selected devices ID's - */ -function getSelectedDeviceIds() { - var deviceIdentifierList = []; - $(deviceSelection).each(function (index) { - var device = $(this); - var deviceId = device.data('deviceid'); - var deviceType = device.data('type'); - deviceIdentifierList.push({ - "id": deviceId, - "type": deviceType - }); - }); - if (deviceIdentifierList.length == 0) { - var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable(); - thisTable.api().rows().every(function () { - if ($(this.node()).hasClass('DTTT_selected')) { - var deviceId = $(thisTable.api().row(this).node()).data('deviceid'); - var deviceType = $(thisTable.api().row(this).node()).data('devicetype'); - deviceIdentifierList.push({ - "id": deviceId, - "type": deviceType - }); - } - }); - } - - return deviceIdentifierList; -} - -/* - * On operation click function. - * @param selection: Selected operation - */ -function operationSelect(selection) { - var deviceIdList = getSelectedDeviceIds(); - if (deviceIdList == 0) { - $(modalPopupContent).html($("#errorOperations").html()); - } else { - $(modalPopupContent).addClass("operation-data"); - $(modalPopupContent).html($(operations + " .operation[data-operation-code=" + selection + "]").html()); - $(modalPopupContent).data("operation-code", selection); - } - showPopup(); -} - -function getDevicesByTypes(deviceList) { - var deviceTypes = {}; - $.each(deviceList, function (index, item) { - if (!deviceTypes[item.type]) { - deviceTypes[item.type] = []; - } - if (item.type == platformTypeConstants.ANDROID || - item.type == platformTypeConstants.IOS || item.type == platformTypeConstants.WINDOWS) { - deviceTypes[item.type].push(item.id); - } - }); - return deviceTypes; -} - -//function unloadOperationBar() { -// $("#showOperationsBtn").addClass("hidden"); -// $(".wr-operations").html(""); -//} - -function loadOperationBar(deviceType, ownership, mode) { - var operationBar = $("#operations-bar"); - var operationBarSrc = operationBar.attr("src"); - - $.template("operations-bar", operationBarSrc, function (template) { - var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/*/features"; - invokerUtil.get( - serviceURL, - // success callback - function (data) { - var permittedOperations = []; - var i; - var permissionList = $("#operations-mod").data("permissions"); - var totalFeatures = JSON.parse(data); - for (i = 0; i < permissionList[deviceType].length; i++) { - var j; - for (j = 0; j < totalFeatures.length; j++) { - if (permissionList[deviceType][i] == totalFeatures[j]["code"]) { - if (deviceType == platformTypeConstants.ANDROID) { - if (totalFeatures[j]["code"] == "DEVICE_UNLOCK") { - if (ownership == ownershipTypeConstants.COPE) { - permittedOperations.push(totalFeatures[j]); - } - } else if (totalFeatures[j]["code"] == "WIPE_DATA") { - if (mode == operationBarModeConstants.BULK) { - if (ownership == ownershipTypeConstants.COPE) { - permittedOperations.push(totalFeatures[j]); - } - } else { - permittedOperations.push(totalFeatures[j]); - } - } else { - permittedOperations.push(totalFeatures[j]); - } - } else { - permittedOperations.push(totalFeatures[j]); - } - } - } - } - - var viewModel = {}; - permittedOperations = permittedOperations.filter(function (current) { - var iconName; - switch (deviceType) { - case platformTypeConstants.ANDROID: - iconName = operationModule.getAndroidIconForFeature(current.code); - break; - case platformTypeConstants.WINDOWS: - iconName = operationModule.getWindowsIconForFeature(current.code); - break; - case platformTypeConstants.IOS: - iconName = operationModule.getIOSIconForFeature(current.code); - break; - } - - /* adding ownership in addition to device-type - as it's vital in cases where UI for the same feature should change - according to ownership - */ - if (ownership) { - current.ownership = ownership; - } - - if (iconName) { - current.icon = iconName; - } - - return current; - }); - - viewModel.features = permittedOperations; - var content = template(viewModel); - $(".wr-operations").html(content); - }, - // error callback - function (message) { - $(".wr-operations").html(message); - }); - }); -} - -function runOperation(operationName) { - var deviceIdList = getSelectedDeviceIds(); - var list = getDevicesByTypes(deviceIdList); - - var successCallback = function (data) { - if (operationName == "NOTIFICATION") { - $(modalPopupContent).html($("#messageSuccess").html()); - } else { - $(modalPopupContent).html($("#operationSuccess").html()); - } - showPopup(); - }; - var errorCallback = function (data) { - $(modalPopupContent).html($("#errorOperationUnexpected").html()); - showPopup(); - }; - - var payload, serviceEndPoint; - if (list[platformTypeConstants.IOS]) { - payload = - operationModule.generatePayload(platformTypeConstants.IOS, operationName, list[platformTypeConstants.IOS]); - serviceEndPoint = operationModule.getIOSServiceEndpoint(operationName); - } else if (list[platformTypeConstants.ANDROID]) { - payload = operationModule - .generatePayload(platformTypeConstants.ANDROID, operationName, list[platformTypeConstants.ANDROID]); - serviceEndPoint = operationModule.getAndroidServiceEndpoint(operationName); - } else if (list[platformTypeConstants.WINDOWS]) { - payload = operationModule.generatePayload(platformTypeConstants.WINDOWS, operationName, - list[platformTypeConstants.WINDOWS]); - serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName); - } - if (operationName == "NOTIFICATION") { - var errorMsgWrapper = "#notification-error-msg"; - var errorMsg = "#notification-error-msg span"; - var messageTitle = $("#messageTitle").val(); - var messageText = $("#messageText").val(); - if (!(messageTitle && messageText)) { - $(errorMsg).text("Enter a message. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); - $(modalPopupContent).removeData(); - hidePopup(); - } - } else { - invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); - $(modalPopupContent).removeData(); - hidePopup(); - } -} - -/* - * DOM ready functions. - */ -$(document).ready(function () { - $(operations).show(); -}); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-android.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-android.hbs deleted file mode 100644 index b92461ff74..0000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-android.hbs +++ /dev/null @@ -1,286 +0,0 @@ -
- -
- - -
-
- -
-
- -
- Configure -
-
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
- -
- -
- -
- - Configure -
-
-
- - - -
-
- - -
- -
- - - -
- -
- Configure -
- -
- - -
-
- -
- - -
- -
-
- -
- - -
- -
- Install -
-
-
- -
- - -
- -
- - -
- -
- Install -
-
-
- -
- - -
- -
- Uninstall -
-
-
- - - -
-
- -
-
- -
- Configure -
-
-
- -
-
\ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-ios.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-ios.hbs deleted file mode 100644 index 4cb006ef07..0000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-ios.hbs +++ /dev/null @@ -1,366 +0,0 @@ -
- -
- - -
-
- -
- -
- -
- -
- -
- - -
- -
-
- - -
-
- - -
- Install -
- -
-
- -
- -
- -
- -
- -
- - -
- -
-
- - -
-
- - -
- Install -
-
-
- -
- -
- -
- Uninstall -
-
-
- - - -
- - -
- -
- -
- - -
- -
- - -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- Configure -
- - - -
- - -
- -
- - - -
-
- -
-
- Path Prefix -
-
-
- - - -
- -
- - - -
- -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - - -
-
- -
-
- : -
-
-
- - - -
- -
- - - -
- -
- - - -
- -
- -
- - -
-
- - - -
-
- -
-
- -
-
- -
-
- -
-
- -
- Configure -
- - -
- -
- -
- -
- -
AirPlay password -
- -
- Configure -
- -
-
\ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/operations.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/operations.hbs deleted file mode 100644 index 0b94ae0881..0000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/operations.hbs +++ /dev/null @@ -1,249 +0,0 @@ -
- - - -
-
- - - -
-
- - - -
- -
- - - -
-{{#each features}} - - - {{name}} - -
- - - -
-{{/each}} -
\ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs index 3e598fb0a5..7e3708ed9d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs @@ -34,7 +34,7 @@ @@ -62,16 +62,6 @@ - -
- - -

End User License Agreement ( EULA ) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js index a179701e58..ec2af96395 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js @@ -124,8 +124,6 @@ $(document).ready(function () { $("input#android-config-notifier-frequency").val(config.value / 1000); } else if (config.name == configParams["GCM_API_KEY"]) { $("input#android-config-gcm-api-key").val(config.value); - } else if (config.name == configParams["GCM_SENDER_ID"]) { - $("input#android-config-gcm-sender-id").val(config.value); } else if (config.name == configParams["ANDROID_EULA"]) { $("#android-eula").val(config.value); } @@ -159,7 +157,7 @@ $(document).ready(function () { var notifierType = $("#android-config-notifier").find("option:selected").attr("value"); var notifierFrequency = $("input#android-config-notifier-frequency").val(); var gcmAPIKey = $("input#android-config-gcm-api-key").val(); - var gcmSenderId = $("input#android-config-gcm-sender-id").val(); + var gcmSenderId = "sender_id"; var androidLicense = tinyMCE.activeEditor.getContent(); var errorMsgWrapper = "#android-config-error-msg"; var errorMsg = "#android-config-error-msg span"; @@ -170,10 +168,7 @@ $(document).ready(function () { $(errorMsg).text("Provided notifier frequency is invalid. "); $(errorMsgWrapper).removeClass("hidden"); } else if (notifierType == notifierTypeConstants["GCM"] && !gcmAPIKey) { - $(errorMsg).text("GCM API Key is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (notifierType == notifierTypeConstants["GCM"] && !gcmSenderId) { - $(errorMsg).text("GCM Sender ID is a required field. It cannot be empty."); + $(errorMsg).text("FCM API Key is a required field. It cannot be empty."); $(errorMsgWrapper).removeClass("hidden"); } else { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl/AndroidDeviceDAOImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl/AndroidDeviceDAOImpl.java index db7307b2b3..8df98747fb 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl/AndroidDeviceDAOImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl/AndroidDeviceDAOImpl.java @@ -159,7 +159,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ stmt.setString(2, properties.get(AndroidPluginConstants.DEVICE_INFO)); stmt.setString(3, mobileDevice.getSerial()); stmt.setString(4, mobileDevice.getVendor()); - stmt.setString(5, mobileDevice.getMobileDeviceId()); + stmt.setString(5, properties.get(AndroidPluginConstants.MAC_ADDRESS)); stmt.setString(6, properties.get(AndroidPluginConstants.DEVICE_NAME)); stmt.setString(7, mobileDevice.getLatitude()); stmt.setString(8, mobileDevice.getLongitude()); @@ -167,8 +167,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ stmt.setString(10, mobileDevice.getImsi()); stmt.setString(11, mobileDevice.getOsVersion()); stmt.setString(12, mobileDevice.getModel()); - stmt.setString(13, mobileDevice.getMobileDeviceId()); - stmt.setString(14, mobileDevice.getOsBuildDate()); + stmt.setString(13, mobileDevice.getOsBuildDate()); + stmt.setString(14, mobileDevice.getMobileDeviceId()); int rows = stmt.executeUpdate(); if (rows > 0) { status = true; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/gcm/GCMUtil.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/gcm/GCMUtil.java index c896714030..381468bdfb 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/gcm/GCMUtil.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/gcm/GCMUtil.java @@ -51,7 +51,7 @@ public class GCMUtil { private static final Log log = LogFactory.getLog(GCMService.class); - private final static String GCM_ENDPOINT = "https://gcm-http.googleapis.com/gcm/send"; + private final static String GCM_ENDPOINT = "https://fcm.googleapis.com/fcm/send"; private static final String GCM_API_KEY = "gcmAPIKey"; private static final int TIME_TO_LIVE = 60; private static final int HTTP_STATUS_CODE_OK = 200; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/AndroidPluginConstants.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/AndroidPluginConstants.java index 48c30ff09a..3cea5588c7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/AndroidPluginConstants.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/AndroidPluginConstants.java @@ -37,7 +37,7 @@ public final class AndroidPluginConstants { public static final String VENDOR = "VENDOR"; public static final String OS_VERSION = "OS_VERSION"; public static final String OS_BUILD_DATE = "OS_BUILD_DATE"; - public static final String MAC_ADDRESS = "MAC_ADDRESS"; + public static final String MAC_ADDRESS = "MAC"; //Properties related to AD_FEATURE table public static final String ANDROID_FEATURE_ID = "ID"; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java index a0520028bd..8e587bfc0f 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java @@ -51,6 +51,7 @@ import org.xml.sax.SAXException; import javax.annotation.Resource; import javax.jws.WebService; import javax.servlet.ServletContext; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -233,9 +234,8 @@ public class CertificateEnrollmentServiceImpl implements CertificateEnrollmentSe signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded()); DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder; - - builder = domFactory.newDocumentBuilder(); + domFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder builder = domFactory.newDocumentBuilder(); Document document = builder.parse(wapProvisioningFilePath); NodeList wapParm = document.getElementsByTagName(PluginConstants.CertificateEnrolment.PARM); Node caCertificatePosition = wapParm.item(PluginConstants.CertificateEnrolment.CA_CERTIFICATE_POSITION); diff --git a/pom.xml b/pom.xml index f6181f3235..d2b339309f 100644 --- a/pom.xml +++ b/pom.xml @@ -417,11 +417,6 @@ org.wso2.carbon.device.mgt.input.adapter.xmpp ${carbon.devicemgt.plugins.version} - - com.jayway.jsonpath - json-path - ${jsonpath.version} - org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.iot.api @@ -1312,7 +1307,6 @@ 2.4 1.0.8 1.8 - 0.9.1 2.2