feature: support importing device computer name
This commit is contained in:
@@ -5,6 +5,7 @@ using Disco.Models.UI.Device;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Devices.Exporting;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Plugins.Features.DetailsProvider;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Services.Users;
|
||||
@@ -77,6 +78,16 @@ namespace Disco.Web.Controllers
|
||||
if (!string.IsNullOrEmpty(m.Device.SerialNumber) && Database.Devices.Count(d => d.SerialNumber == m.Device.SerialNumber) > 0)
|
||||
ModelState.AddModelError("Device.SerialNumber", "A Device what this Serial Number already exists");
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(m.Device.DeviceDomainId))
|
||||
m.Device.DeviceDomainId = null;
|
||||
try
|
||||
{
|
||||
m.Device.DeviceDomainId = ActiveDirectory.ParseDomainAccountId(m.Device.DeviceDomainId);
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
ModelState.AddModelError("Device.DeviceDomainId", ex.Message);
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user