mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Fix policy loading issue when enrolling Android
This commit is contained in:
parent
69874726ba
commit
b9c04a91e3
@ -146,8 +146,7 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
AndroidService androidService = AndroidAPIUtils.getAndroidService();
|
AndroidService androidService = AndroidAPIUtils.getAndroidService();
|
||||||
Response response = androidService.enrollDevice(androidDevice);
|
return androidService.enrollDevice(androidDevice);
|
||||||
return response;
|
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
String msg = "Error occurred while enrolling the android, which carries the id '" +
|
String msg = "Error occurred while enrolling the android, which carries the id '" +
|
||||||
androidDevice.getDeviceIdentifier() + "'";
|
androidDevice.getDeviceIdentifier() + "'";
|
||||||
|
|||||||
@ -79,6 +79,10 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon</groupId>
|
<groupId>org.wso2.carbon</groupId>
|
||||||
<artifactId>org.wso2.carbon.logging</artifactId>
|
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||||
|
|||||||
@ -67,14 +67,19 @@
|
|||||||
javax.naming,
|
javax.naming,
|
||||||
org.wso2.carbon.context,
|
org.wso2.carbon.context,
|
||||||
org.wso2.carbon.utils.*,
|
org.wso2.carbon.utils.*,
|
||||||
|
org.wso2.carbon.device.mgt.mobile.android.common.*,
|
||||||
org.wso2.carbon.device.mgt.common.*,
|
org.wso2.carbon.device.mgt.common.*,
|
||||||
|
org.wso2.carbon.device.mgt.core.*,
|
||||||
org.wso2.carbon.ndatasource.core,
|
org.wso2.carbon.ndatasource.core,
|
||||||
org.wso2.carbon.policy.mgt.common.*,
|
org.wso2.carbon.policy.mgt.common.*,
|
||||||
|
org.wso2.carbon.policy.mgt.core.*,
|
||||||
org.wso2.carbon.registry.core,
|
org.wso2.carbon.registry.core,
|
||||||
org.wso2.carbon.registry.core.session,
|
org.wso2.carbon.registry.core.session,
|
||||||
org.wso2.carbon.registry.core.service,
|
org.wso2.carbon.registry.core.service,
|
||||||
org.wso2.carbon.registry.api,
|
org.wso2.carbon.registry.api,
|
||||||
org.wso2.carbon.device.mgt.extensions.license.mgt.registry,
|
org.wso2.carbon.device.mgt.extensions.license.mgt.registry,
|
||||||
|
org.wso2.carbon.analytics.datasource.commons.*,
|
||||||
|
org.wso2.carbon.base,
|
||||||
com.google.gson.*
|
com.google.gson.*
|
||||||
</Import-Package>
|
</Import-Package>
|
||||||
<Export-Package>
|
<Export-Package>
|
||||||
@ -161,17 +166,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
<artifactId>org.wso2.carbon.device.mgt.mobile.android.common</artifactId>
|
<artifactId>org.wso2.carbon.device.mgt.mobile.android.common</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>org.wso2.carbon.device.application.mgt.common</artifactId>
|
<artifactId>org.wso2.carbon.device.application.mgt.common</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
@ -182,27 +184,22 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
|
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
|
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
|
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testng</groupId>
|
<groupId>org.testng</groupId>
|
||||||
@ -229,10 +226,6 @@
|
|||||||
<artifactId>org.wso2.carbon.queuing</artifactId>
|
<artifactId>org.wso2.carbon.queuing</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.ndatasource.core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-dbcp.wso2</groupId>
|
<groupId>commons-dbcp.wso2</groupId>
|
||||||
<artifactId>commons-dbcp</artifactId>
|
<artifactId>commons-dbcp</artifactId>
|
||||||
|
|||||||
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.mobile.android.core.impl;
|
package org.wso2.carbon.device.mgt.mobile.android.core.impl;
|
||||||
|
|
||||||
import com.google.api.client.http.HttpStatusCodes;
|
|
||||||
import com.google.api.services.androidenterprise.model.ProductsListResponse;
|
import com.google.api.services.androidenterprise.model.ProductsListResponse;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@ -838,9 +837,8 @@ public class AndroidServiceImpl implements AndroidService {
|
|||||||
operation.setCode(AndroidConstants.OperationCodes.REMOTE_APP_CONFIG);
|
operation.setCode(AndroidConstants.OperationCodes.REMOTE_APP_CONFIG);
|
||||||
operation.setType(Operation.Type.PROFILE);
|
operation.setType(Operation.Type.PROFILE);
|
||||||
operation.setPayLoad(applicationRestriction.toJSON());
|
operation.setPayLoad(applicationRestriction.toJSON());
|
||||||
Response response = AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.getDeviceIDs(),
|
return AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.getDeviceIDs(),
|
||||||
operation);
|
operation);
|
||||||
return response;
|
|
||||||
} catch (InvalidDeviceException e) {
|
} catch (InvalidDeviceException e) {
|
||||||
String errorMessage = "Invalid Device Identifiers found.";
|
String errorMessage = "Invalid Device Identifiers found.";
|
||||||
log.error(errorMessage, e);
|
log.error(errorMessage, e);
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import org.wso2.carbon.ndatasource.core.DataSourceService;
|
|||||||
import org.wso2.carbon.registry.core.service.RegistryService;
|
import org.wso2.carbon.registry.core.service.RegistryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @scr.component name="org.wso2.carbon.device.mgt.mobile.android.core.impl.internal.AndroidPluginServiceComponent"
|
* @scr.component name="org.wso2.carbon.device.mgt.mobile.android.impl.internal.AndroidPluginServiceComponent"
|
||||||
* immediate="true"
|
* immediate="true"
|
||||||
* @scr.reference name="org.wso2.carbon.ndatasource"
|
* @scr.reference name="org.wso2.carbon.ndatasource"
|
||||||
* interface="org.wso2.carbon.ndatasource.core.DataSourceService"
|
* interface="org.wso2.carbon.ndatasource.core.DataSourceService"
|
||||||
|
|||||||
@ -25,7 +25,6 @@ import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|||||||
import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService;
|
import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
||||||
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
|
|
||||||
import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException;
|
import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException;
|
||||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
|
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
|
||||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||||
@ -35,7 +34,6 @@ import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderServ
|
|||||||
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
|
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
|
||||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||||
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
|
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
|
||||||
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException;
|
import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException;
|
||||||
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup;
|
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup;
|
||||||
import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService;
|
import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService;
|
||||||
@ -178,7 +176,7 @@ public class AndroidAPIUtils {
|
|||||||
|
|
||||||
public static Response getOperationResponse(List<String> deviceIDs, Operation operation)
|
public static Response getOperationResponse(List<String> deviceIDs, Operation operation)
|
||||||
throws AndroidDeviceMgtPluginException, OperationManagementException, InvalidDeviceException {
|
throws AndroidDeviceMgtPluginException, OperationManagementException, InvalidDeviceException {
|
||||||
if (deviceIDs == null || deviceIDs.size() == 0) {
|
if (deviceIDs == null || deviceIDs.isEmpty()) {
|
||||||
String errorMessage = "Device identifier list is empty";
|
String errorMessage = "Device identifier list is empty";
|
||||||
log.error(errorMessage);
|
log.error(errorMessage);
|
||||||
throw new BadRequestExceptionDup(errorMessage);
|
throw new BadRequestExceptionDup(errorMessage);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user