|
|
@ -44,6 +44,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
|
|
|
import org.wso2.carbon.appmgt.mobile.utils.User;
|
|
|
|
import org.wso2.carbon.appmgt.mobile.utils.User;
|
|
|
|
|
|
|
|
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
|
|
|
import org.wso2.carbon.registry.api.Resource;
|
|
|
|
import org.wso2.carbon.registry.api.Resource;
|
|
|
|
import org.wso2.carbon.registry.core.exceptions.RegistryException;
|
|
|
|
import org.wso2.carbon.registry.core.exceptions.RegistryException;
|
|
|
|
import org.wso2.carbon.registry.core.session.UserRegistry;
|
|
|
|
import org.wso2.carbon.registry.core.session.UserRegistry;
|
|
|
@ -250,18 +251,22 @@ public class ApplicationOperationsImpl implements ApplicationOperations {
|
|
|
|
List<Device> devices;
|
|
|
|
List<Device> devices;
|
|
|
|
List<org.wso2.carbon.device.mgt.common.Device> deviceList = null;
|
|
|
|
List<org.wso2.carbon.device.mgt.common.Device> deviceList = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (MDMAppConstants.WEBAPP.equals
|
|
|
|
DeviceManagementProviderService deviceManagementService = MDMServiceAPIUtils
|
|
|
|
(applicationOperationDevice.getPlatform())) {
|
|
|
|
.getDeviceManagementService(applicationOperationDevice.getTenantId());
|
|
|
|
deviceList = MDMServiceAPIUtils
|
|
|
|
final String username = applicationOperationDevice.getCurrentUser().getUsername();
|
|
|
|
.getDeviceManagementService(applicationOperationDevice.getTenantId()).
|
|
|
|
if (MDMAppConstants.WEBAPP.equals
|
|
|
|
getDevicesOfUser(applicationOperationDevice.getCurrentUser().getUsername());
|
|
|
|
(applicationOperationDevice.getPlatform())) {
|
|
|
|
} else {
|
|
|
|
deviceList = deviceManagementService.
|
|
|
|
deviceList = MDMServiceAPIUtils
|
|
|
|
getDevicesOfUser(username);
|
|
|
|
.getDeviceManagementService(applicationOperationDevice.getTenantId()).
|
|
|
|
} else {
|
|
|
|
getDevicesOfUser(applicationOperationDevice.getCurrentUser().getUsername(),
|
|
|
|
deviceList = deviceManagementService.
|
|
|
|
applicationOperationDevice.getPlatform());
|
|
|
|
getDevicesOfUser(username,
|
|
|
|
}
|
|
|
|
MDMAppConstants.ANDROID);
|
|
|
|
devices = new ArrayList<>(deviceList.size());
|
|
|
|
deviceList.addAll(deviceManagementService.
|
|
|
|
|
|
|
|
getDevicesOfUser(username,
|
|
|
|
|
|
|
|
MDMAppConstants.IOS));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
devices = new ArrayList<>(deviceList.size());
|
|
|
|
if(log.isDebugEnabled()){
|
|
|
|
if(log.isDebugEnabled()){
|
|
|
|
log.debug("device list got from mdm "+ deviceList.toString());
|
|
|
|
log.debug("device list got from mdm "+ deviceList.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|