allow user to take ownership of a device
This commit is contained in:
@ -35,10 +35,8 @@ public class GCMController : Controller
|
||||
if (_context.GCMDevices.Any(d => d.DeviceId == declaration.DeviceId))
|
||||
{
|
||||
var alreadyRegisteredDevice = _context.GCMDevices.FirstOrDefault(d => d.DeviceId == declaration.DeviceId);
|
||||
if (alreadyRegisteredDevice.DeviceOwnerId != uid)
|
||||
{
|
||||
return new BadRequestObjectResult(new { error = $"Device owned by someone else {declaration.DeviceId}" });
|
||||
}
|
||||
// Override an exiting owner
|
||||
alreadyRegisteredDevice.DeviceOwnerId = uid;
|
||||
alreadyRegisteredDevice.GCMRegistrationId = declaration.GCMRegistrationId;
|
||||
alreadyRegisteredDevice.Model = declaration.Model;
|
||||
alreadyRegisteredDevice.Platform = declaration.Platform;
|
||||
|
Reference in New Issue
Block a user