From ea73040e65d518dfbd1add8c50e8a149b9ae3742 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Fri, 15 Nov 2019 12:29:37 +0530 Subject: [PATCH] Wipe when unenroll --- .../main/resources/jaggeryapps/devicemgt/api/enterprise.jag | 6 ++++++ .../resources/jaggeryapps/devicemgt/app/conf/config.json | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/enterprise.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/enterprise.jag index 1b9262f3355..b131ac6ab36 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/enterprise.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/enterprise.jag @@ -125,6 +125,12 @@ if (!user || accessToken == null) { session.put("externalEndpoint", restAPIRequestDetails["endpoint"]); session.put("externalToken", restAPIRequestDetails["externalToken"]); callBackend(restAPIRequestDetails["endpoint"], session.get("externalToken"), "GET", restAPIRequestDetails); + log.info("Calling unenroll"); + if (response["status"] == 200) { + log.info("Unenroll success, wiping devices."); + var wipeURL = devicemgtProps["httpsURL"] + "/api/device-mgt/android/v1.0/enterprise/wipe-device" + callBackend(wipeURL, accessToken, "GET"); + } } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 55cc5f3dd81..7b754303a13 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -162,7 +162,9 @@ "perm:geo-service:analytics-view", "perm:geo-service:alerts-manage", "perm:devices:permanent-delete", - "appm:read" + "appm:read", + "perm:enterprise:modify", + "perm:enterprise:view" ], "isOAuthEnabled": true, "backendRestEndpoints": {