From 9a86d2fe0620c417310d90b0a38d3071b9d350e5 Mon Sep 17 00:00:00 2001 From: Pahansith Date: Tue, 24 Aug 2021 13:12:38 +0530 Subject: [PATCH 1/5] Add missing scope for the device info operation button --- .../src/main/resources/conf/mdm-ui-config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index aa3f169a33d..88d9b47d294 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -183,6 +183,7 @@ perm:metadata:update perm:android:google-account perm:android:update-default-sim + perm:android:info device-mgt From 6393276503235230fa819c3a9c7636aa7498f2c7 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 9 Sep 2021 17:23:40 +0530 Subject: [PATCH 2/5] Fix having UPPER in query of groups retrieval (cherry picked from commit 4681447ba95ec86226a3458b73406b050a1a0243) --- .../carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index f5351385211..7584b5fea7f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -73,10 +73,10 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP " + "WHERE TENANT_ID = ?"; if (StringUtils.isNotBlank(request.getGroupName())) { - sql += " AND UPPER(GROUP_NAME) LIKE ?"; + sql += " AND GROUP_NAME LIKE ?"; } if (StringUtils.isNotBlank(request.getOwner())) { - sql += " AND UPPER(OWNER) LIKE ?"; + sql += " AND OWNER LIKE ?"; } if (StringUtils.isNotBlank(request.getStatus())) { sql += " AND STATUS = ?"; From eb05fb9a3fdb0bb77b575c2b484bace3c6661e5b Mon Sep 17 00:00:00 2001 From: sandaru Date: Mon, 13 Sep 2021 14:18:29 +0530 Subject: [PATCH 3/5] Fix web-clip install issue (cherry picked from commit ebe9842d9a7a3dda8c965c55c55708170bf05682) --- .../device/mgt/core/util/MDMAndroidOperationUtil.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java index 99cacfd9506..a1e52109488 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java @@ -68,7 +68,9 @@ public class MDMAndroidOperationUtil { WebApplication webApplication = new WebApplication(); webApplication.setUrl(application.getLocation()); webApplication.setName(application.getName()); - webApplication.setType(application.getType().toString()); +// webApplication.setType(application.getType().toString()); +// Hard-corded "type" to "webapp". Some agent versions accept only "webapp" as the type. + webApplication.setType("webapp"); webApplication.setProperties(application.getProperties()); operation.setPayLoad(webApplication.toJSON()); break; @@ -111,7 +113,9 @@ public class MDMAndroidOperationUtil { WebApplication webApplication = new WebApplication(); webApplication.setUrl(application.getLocation()); webApplication.setName(application.getName()); - webApplication.setType(application.getType().toString()); +// webApplication.setType(application.getType().toString()); +// Hard-corded "type" to "webapp". Some agent versions accept only "webapp" as the type. + webApplication.setType("webapp"); operation.setPayLoad(webApplication.toJSON()); break; default: From 1434a27cde7f31bba13e6864874b5d5e5678e723 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 23 Sep 2021 18:46:11 +0530 Subject: [PATCH 4/5] Add new device status ASSIGNED (cherry picked from commit 68405ed2295d88d2be945422d19088d10ad64f9a) --- .../java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java index 24c99160662..2e7376ec81e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java @@ -32,7 +32,7 @@ public class EnrolmentInfo implements Serializable { public enum Status { CREATED, ACTIVE, INACTIVE, UNREACHABLE, UNCLAIMED, SUSPENDED, BLOCKED, REMOVED, DISENROLLMENT_REQUESTED, CONFIGURED, READY_TO_CONNECT, RETURN_PENDING, RETURNED, DEFECTIVE, WARRANTY_PENDING, WARRANTY_SENT, - WARRANTY_REPLACED + WARRANTY_REPLACED, ASSIGNED } public enum OwnerShip { From b3a229a0e72d6831e55e832db6da436b8b407548 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Sat, 25 Sep 2021 18:58:23 +0530 Subject: [PATCH 5/5] Update device property table in dm db when updating properties (cherry picked from commit 5f64b0b1ad938f92353f55a97da96a7c7b0e55ba) --- .../type/template/DeviceTypeManager.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java index 2022447e646..7e65a244e91 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java @@ -489,13 +489,14 @@ public class DeviceTypeManager implements DeviceManager { throws DeviceManagementException { boolean status = false; if (propertiesExist) { + Device updatedDevice = new Device(); + updatedDevice.setDeviceIdentifier(deviceId.getId()); + updatedDevice.setProperties(propertyList); try { if (log.isDebugEnabled()) { - log.debug("Getting the details of " + deviceType + " device : '" + deviceId.getId() + "'"); + log.debug("Updating device properties of " + deviceType + " device : '" + + deviceId.getId() + "'"); } - Device updatedDevice = new Device(); - updatedDevice.setDeviceIdentifier(deviceId.getId()); - updatedDevice.setProperties(propertyList); deviceTypePluginDAOManager.getDeviceTypeDAOHandler().beginTransaction(); status = deviceTypePluginDAOManager.getDeviceDAO().updateDevice(updatedDevice); deviceTypePluginDAOManager.getDeviceTypeDAOHandler().commitTransaction(); @@ -506,6 +507,24 @@ public class DeviceTypeManager implements DeviceManager { } finally { deviceTypePluginDAOManager.getDeviceTypeDAOHandler().closeConnection(); } + if (propertyBasedDeviceTypePluginDAOManager != null && status) { + try { + if (log.isDebugEnabled()) { + log.debug("Updating device properties of " + deviceType + " device : '" + + deviceId.getId() + "'"); + } + propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().beginTransaction(); + status = propertyBasedDeviceTypePluginDAOManager.getDeviceDAO().updateDevice(updatedDevice); + propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().commitTransaction(); + } catch (DeviceTypeMgtPluginException e) { + propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().rollbackTransaction(); + String msg = "Error while updating properties for " + deviceType + " device : " + + deviceId.getId(); + throw new DeviceManagementException(msg, e); + } finally { + propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().closeConnection(); + } + } } return status; }