Allow device to unlink itself

This commit is contained in:
Fedor Indutny
2024-08-15 08:59:13 -07:00
committed by ravi-signal
parent fd10b9723d
commit 7605462d48
2 changed files with 42 additions and 1 deletions

View File

@@ -134,7 +134,8 @@ public class DeviceController {
@Path("/{device_id}")
@ChangesLinkedDevices
public void removeDevice(@Mutable @Auth AuthenticatedDevice auth, @PathParam("device_id") byte deviceId) {
if (auth.getAuthenticatedDevice().getId() != Device.PRIMARY_ID) {
if (auth.getAuthenticatedDevice().getId() != Device.PRIMARY_ID &&
auth.getAuthenticatedDevice().getId() != deviceId) {
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
}