feature: device model/profile decommissioning

This commit is contained in:
Gary Sharp
2025-07-05 13:55:44 +10:00
parent 583552ffdd
commit 6e99b4503b
17 changed files with 714 additions and 23 deletions
@@ -48,6 +48,17 @@ namespace Disco.Services
Database.DeviceModels.Remove(dm);
}
public static bool CanDecommission(this DeviceModel dm, DiscoDataContext database)
{
if (!UserService.CurrentAuthorization.Has(Claims.Device.Actions.Import))
return false;
if (!database.Devices.Any(d => d.DeviceModelId == dm.Id && d.DecommissionedDate == null))
return false;
return true;
}
public static Tuple<DeviceModel, bool> GetOrCreateDeviceModel(this DbSet<DeviceModel> DeviceModelsSet, string Manufacturer, string Model, string ModelType)
{
if (string.IsNullOrWhiteSpace(Manufacturer))