From a3e20367f269376d5867612a00d30d5ccdcd1965 Mon Sep 17 00:00:00 2001 From: harshanl Date: Mon, 16 Nov 2015 19:51:59 +0530 Subject: [PATCH] Fixed issue in Policy Task when DeviceAuthorization enabled. --- .../mgt/core/operation/mgt/OperationManagerImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index 7e444c706b..0337a0a079 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -82,8 +82,13 @@ public class OperationManagerImpl implements OperationManager { } } try { - List authorizedDeviceList = DeviceManagementDataHolder.getInstance(). - getDeviceAccessAuthorizationService().isUserAuthorized(deviceIds).getAuthorizedDevices(); + List authorizedDeviceList; + if (operation != null && PolicyOperation.POLICY_OPERATION_CODE.equals(operation.getCode())) { + authorizedDeviceList = deviceIds; + } else { + authorizedDeviceList = DeviceManagementDataHolder.getInstance(). + getDeviceAccessAuthorizationService().isUserAuthorized(deviceIds).getAuthorizedDevices(); + } if (authorizedDeviceList.size() > 0) { try { int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();