From 811d225bc3c0295b5aaf610be0ddd4af6e04a78c Mon Sep 17 00:00:00 2001 From: harshanl Date: Thu, 25 Aug 2016 13:58:38 +0530 Subject: [PATCH] Fixed adding operations to invalid devices --- .../device/mgt/core/operation/mgt/OperationManagerImpl.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/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 4cebea71953..04a7d71322a 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 @@ -102,7 +102,7 @@ public class OperationManagerImpl implements OperationManager { DeviceIDHolder deviceIDHolder = DeviceManagerUtil.validateDeviceIdentifiers(deviceIds); List validDeviceIds = deviceIDHolder.getValidDeviceIDList(); if (validDeviceIds.size() > 0) { - List authorizedDeviceList = this.getAuthorizedDevices(operation, deviceIds); + List authorizedDeviceList = this.getAuthorizedDevices(operation, validDeviceIds); if (authorizedDeviceList.size() <= 0) { log.info("User : " + getUser() + " is not authorized to perform operations on given device-list."); return null; @@ -123,7 +123,7 @@ public class OperationManagerImpl implements OperationManager { //TODO have to create a sql to load device details from deviceDAO using single query. String operationCode = operationDto.getCode(); - for (DeviceIdentifier deviceId : deviceIds) { + for (DeviceIdentifier deviceId : authorizedDeviceList) { Device device = getDevice(deviceId); enrolmentId = device.getEnrolmentInfo().getId(); //Do not repeat the task operations