Allow device to unlink itself

This commit is contained in:
Fedor Indutny authored and ravi-signal committed 2024-08-15 13:54:07 -05:00
1 parent fd10b9723d
commit 7605462d48
2 files changed
+42 -1

No files matched your search

@@ -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);
}