Only allocate a key belonging to the game

This commit is contained in:
Pat Hartl 2023-01-22 22:46:02 -06:00
parent b4d3960dad
commit 470228624d

View file

@ -34,7 +34,8 @@ namespace LANCommander.Controllers.Api
if (existing != null)
await KeyService.Release(existing.Id);
var availableKey = KeyService.Get(k =>
var availableKey = KeyService.Get(k => k.Game.Id == id)
.Where(k =>
(k.AllocationMethod == Data.Models.KeyAllocationMethod.MacAddress && String.IsNullOrWhiteSpace(k.ClaimedByMacAddress))
||
(k.AllocationMethod == Data.Models.KeyAllocationMethod.UserAccount && k.ClaimedByUser == null))