Merge branch 'master' into 'master'

Allow suspended status to update the device status

See merge request entgra/carbon-device-mgt!649
revert-70ac1926
Charitha Goonetilleke 4 years ago
commit 542fea8992

@ -2744,24 +2744,16 @@ 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);
} else {
enrolmentInfo = device.getEnrolmentInfo();
if (enrolmentInfo.getStatus() != newStatus) {
enrolmentInfo.setStatus(newStatus);
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId); isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
break; } else {
case INACTIVE: isDeviceUpdated = false;
enrolmentInfo = device.getEnrolmentInfo(); }
if (enrolmentInfo.getStatus() != newStatus) {
enrolmentInfo.setStatus(newStatus);
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
} else {
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