Merge pull request #888 from ruwany/master

Correcting wrong logic for retrieving apps in appm
revert-dabc3590
Ruwan 7 years ago committed by GitHub
commit 1226398a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,16 +251,20 @@ 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 {
DeviceManagementProviderService deviceManagementService = MDMServiceAPIUtils
.getDeviceManagementService(applicationOperationDevice.getTenantId());
final String username = applicationOperationDevice.getCurrentUser().getUsername();
if (MDMAppConstants.WEBAPP.equals if (MDMAppConstants.WEBAPP.equals
(applicationOperationDevice.getPlatform())) { (applicationOperationDevice.getPlatform())) {
deviceList = MDMServiceAPIUtils deviceList = deviceManagementService.
.getDeviceManagementService(applicationOperationDevice.getTenantId()). getDevicesOfUser(username);
getDevicesOfUser(applicationOperationDevice.getCurrentUser().getUsername());
} else { } else {
deviceList = MDMServiceAPIUtils deviceList = deviceManagementService.
.getDeviceManagementService(applicationOperationDevice.getTenantId()). getDevicesOfUser(username,
getDevicesOfUser(applicationOperationDevice.getCurrentUser().getUsername(), MDMAppConstants.ANDROID);
applicationOperationDevice.getPlatform()); deviceList.addAll(deviceManagementService.
getDevicesOfUser(username,
MDMAppConstants.IOS));
} }
devices = new ArrayList<>(deviceList.size()); devices = new ArrayList<>(deviceList.size());
if(log.isDebugEnabled()){ if(log.isDebugEnabled()){

Loading…
Cancel
Save