From 10e7eac929db9460dca63a35b7ef8510441c8698 Mon Sep 17 00:00:00 2001 From: Hasunie Date: Thu, 20 Jul 2017 10:14:46 +0530 Subject: [PATCH 1/4] configuring to windows enrollment to support tenants --- .../api/services/discovery/impl/DiscoveryServiceImpl.java | 3 +-- .../windows-web-agent/app/modules/oauth/token-handler-utils.js | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) 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/discovery/impl/DiscoveryServiceImpl.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/discovery/impl/DiscoveryServiceImpl.java index 93337f0a2..0ca461f73 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/discovery/impl/DiscoveryServiceImpl.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/discovery/impl/DiscoveryServiceImpl.java @@ -49,7 +49,6 @@ public class DiscoveryServiceImpl implements DiscoveryService { public static final String FEDERATED = "Federated"; private static final String DELIMITER = "@"; - private static final int DOMAIN_SEGMENT = 1; private static Log log = LogFactory.getLog( org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.impl.DiscoveryServiceImpl.class); @@ -67,7 +66,7 @@ public class DiscoveryServiceImpl implements DiscoveryService { String emailId = discoveryRequest.getEmailId(); String[] userDomains = emailId.split(DELIMITER); - String domain = userDomains[DOMAIN_SEGMENT]; + String domain = userDomains[(userDomains.length)-1]; DiscoveryResponse discoveryResponse; if (!PluginConstants.WindowsVersionProperties.REQUESTED_WIN81_VERSION.equals(discoveryRequest.getVersion()) diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js index 9f21470cf..5aa1b1120 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js @@ -42,6 +42,8 @@ var utils = function () { }; publicMethods["getDynamicClientAppCredentials"] = function (username, password) { + log.error("username"+ username); + log.error("password"+password); // setting up dynamic client application properties var dcAppProperties = { "applicationName": deviceMgtProps["oauthProvider"]["appRegistration"]["applicationName"], From 5f0c95eb0292e2d5d49803ad6629881272c234fb Mon Sep 17 00:00:00 2001 From: Hasunie Date: Thu, 20 Jul 2017 13:38:14 +0530 Subject: [PATCH 2/4] fixes wso2/product-iots##1201 --- .../public/js/platform-configuration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/public/js/platform-configuration.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/public/js/platform-configuration.js index 52f3dbc00..89f825439 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/public/js/platform-configuration.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/public/js/platform-configuration.js @@ -84,7 +84,7 @@ $(document).ready(function () { toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" }); - var windowsConfigAPI = "/api/device-mgt/windows/v1.0/services/configuration"; + var windowsConfigAPI = "/api/device-mgt/windows/v1.0/configuration"; invokerUtil.get( windowsConfigAPI, From 312e22ea4b3f99f9da3dad9f4a1c6f1b3a74c69f Mon Sep 17 00:00:00 2001 From: Hasunie Date: Thu, 20 Jul 2017 13:42:31 +0530 Subject: [PATCH 3/4] removing logs --- .../windows-web-agent/app/modules/oauth/token-handler-utils.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js index 5aa1b1120..9f21470cf 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/oauth/token-handler-utils.js @@ -42,8 +42,6 @@ var utils = function () { }; publicMethods["getDynamicClientAppCredentials"] = function (username, password) { - log.error("username"+ username); - log.error("password"+password); // setting up dynamic client application properties var dcAppProperties = { "applicationName": deviceMgtProps["oauthProvider"]["appRegistration"]["applicationName"], From a327908fa8cf8693c03507ec348b4feca5b4e191 Mon Sep 17 00:00:00 2001 From: Hasunie Date: Thu, 20 Jul 2017 16:28:57 +0530 Subject: [PATCH 4/4] fixing windows configuration issue --- .../api/services/impl/ConfigurationMgtServiceImpl.java | 3 ++- .../private/config.json | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) 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/impl/ConfigurationMgtServiceImpl.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/impl/ConfigurationMgtServiceImpl.java index f4829183e..214236c9f 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/impl/ConfigurationMgtServiceImpl.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/impl/ConfigurationMgtServiceImpl.java @@ -102,9 +102,10 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService { String message; ConfigurationEntry licenseEntry = null; PlatformConfiguration configuration = new PlatformConfiguration(); + configuration.setConfiguration(windowsPlatformConfiguration.getConfiguration()); try { configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - List configs = configuration.getConfiguration(); + List configs = windowsPlatformConfiguration.getConfiguration(); for (ConfigurationEntry entry : configs) { if (PluginConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { License license = new License(); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/private/config.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/private/config.json index f5d01d0d7..d6f50da06 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/private/config.json +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/private/config.json @@ -10,7 +10,9 @@ "perm:windows:lock-reset", "perm:windows:reboot", "perm:windows:location", - "perm:windows:disenroll" + "perm:windows:disenroll", + "perm:windows:manage-configuration", + "perm:windows:view-configuration" ], "analyticsEnabled": "false", "groupingEnabled": "false",