Allow other statuses to update the device status

revert-70ac1926
Saad Sahibjan 4 years ago
parent 0137976e59
commit 9998ec3669

@ -2744,11 +2744,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return false; //New status is similar to current return false; //New status is similar to current
} }
int tenantId = this.getTenantId(); int tenantId = this.getTenantId();
switch (newStatus) { if (EnrolmentInfo.Status.REMOVED == newStatus) {
case ACTIVE: isDeviceUpdated = disenrollDevice(deviceIdentifier);
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId); } else {
break;
case INACTIVE:
enrolmentInfo = device.getEnrolmentInfo(); enrolmentInfo = device.getEnrolmentInfo();
if (enrolmentInfo.getStatus() != newStatus) { if (enrolmentInfo.getStatus() != newStatus) {
enrolmentInfo.setStatus(newStatus); enrolmentInfo.setStatus(newStatus);
@ -2756,12 +2754,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} else { } else {
isDeviceUpdated = false; isDeviceUpdated = false;
} }
break;
case REMOVED:
isDeviceUpdated = disenrollDevice(deviceIdentifier);
break;
default:
throw new DeviceManagementException("Invalid status retrieved. Status : " + newStatus);
} }
return isDeviceUpdated; return isDeviceUpdated;
} }

Loading…
Cancel
Save