allow user to take ownership of a device

vnext
Paul Schneider 8 years ago
parent a44e277b6d
commit e15c2ffa80
1 changed files with 2 additions and 4 deletions

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

Loading…