Feature: Export device hardware audit information

Allows processor, memory, disk and network adapter information to be included in device exports
This commit is contained in:
Gary Sharp
2020-11-29 16:46:20 +11:00
parent f82b47dd46
commit 486ce17857
4 changed files with 215 additions and 111 deletions
@@ -10,12 +10,18 @@ namespace Disco.Models.Services.Devices.Exporting
public Func<DeviceExportRecord, object> Accessor { get; set; }
public Func<object, string> CsvEncoder { get; set; }
public DeviceExportFieldMetadata(string Name, Type ValueType, Func<DeviceExportRecord, object> Accessor, Func<object, string> CsvEncoder)
public DeviceExportFieldMetadata(string name, Type valueType, Func<DeviceExportRecord, object> accessor, Func<object, string> csvEncoder)
{
this.Name = Name;
this.ValueType = ValueType;
this.Accessor = Accessor;
this.CsvEncoder = CsvEncoder;
Name = name;
ValueType = valueType;
Accessor = accessor;
CsvEncoder = csvEncoder;
}
public DeviceExportFieldMetadata(string name, string columnName, Type valueType, Func<DeviceExportRecord, object> accessor, Func<object, string> csvEncoder)
: this(name, valueType, accessor, csvEncoder)
{
ColumnName = columnName;
}
}
}
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Services.Devices.Exporting
{
@@ -38,18 +33,6 @@ namespace Disco.Models.Services.Devices.Exporting
[Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")]
public bool DeviceDecommissionedReason { get; set; }
// Details
[Display(ShortName = "Details", Name = "LAN MAC Address", Description = "The LAN MAC Address associated with the device")]
public bool DetailLanMacAddress { get; set; }
[Display(ShortName = "Details", Name = "Wireless LAN MAC Address", Description = "The Wireless LAN MAC Address associated with the device")]
public bool DetailWLanMacAddress { get; set; }
[Display(ShortName = "Details", Name = "AC Adapter", Description = "The AC Adapter associated with the device")]
public bool DetailACAdapter { get; set; }
[Display(ShortName = "Details", Name = "Battery", Description = "The Battery associated with the device")]
public bool DetailBattery { get; set; }
[Display(ShortName = "Details", Name = "Keyboard", Description = "The Keyboard associated with the device")]
public bool DetailKeyboard { get; set; }
// Model
[Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")]
public bool ModelId { get; set; }
@@ -117,15 +100,26 @@ namespace Disco.Models.Services.Devices.Exporting
public bool AttachmentsCount { get; set; }
// Certificates
[Display(ShortName = "Certificates", Name = "Name", Description = "The name of the most recently assigned active certificate associated with the device")]
public bool CertificateName { get; set; }
[Display(ShortName = "Certificates", Name = "Allocated Date", Description = "The allocated date of the most recently assigned active certificate associated with the device")]
public bool CertificateAllocatedDate { get; set; }
[Display(ShortName = "Certificates", Name = "Expiration Date", Description = "The expiration date of the most recently assigned active certificate associated with the device")]
public bool CertificateExpirationDate { get; set; }
[Display(ShortName = "Certificates", Name = "Provider Id", Description = "The provider identifier of the most recently assigned active certificate associated with the device")]
public bool CertificateProviderId { get; set; }
[Display(ShortName = "Certificates", Name = "Certificates", Description = "The assigned active certificates associated with the device")]
public bool Certificates { get; set; }
// Details
[Display(ShortName = "Details", Name = "Processors", Description = "The CPU Processors associated with the device")]
public bool DetailProcessors { get; set; }
[Display(ShortName = "Details", Name = "Memory", Description = "The Memory/RAM associated with the device")]
public bool DetailMemory { get; set; }
[Display(ShortName = "Details", Name = "Disk Drives", Description = "The Disk Drives associated with the device")]
public bool DetailDiskDrives { get; set; }
[Display(ShortName = "Details", Name = "LAN Adapters", Description = "The LAN Adapters associated with the device")]
public bool DetailLanAdapters { get; set; }
[Display(ShortName = "Details", Name = "Wireless LAN Adapters", Description = "The Wireless LAN Adapters associated with the device")]
public bool DetailWLanAdapters { get; set; }
[Display(ShortName = "Details", Name = "AC Adapter", Description = "The AC Adapter associated with the device")]
public bool DetailACAdapter { get; set; }
[Display(ShortName = "Details", Name = "Battery", Description = "The Battery associated with the device")]
public bool DetailBattery { get; set; }
[Display(ShortName = "Details", Name = "Keyboard", Description = "The Keyboard associated with the device")]
public bool DetailKeyboard { get; set; }
public static DeviceExportOptions DefaultOptions()
{
@@ -1,4 +1,5 @@
using Disco.Models.Repository;
using Disco.Models.ClientServices.EnrolmentInformation;
using Disco.Models.Repository;
using System;
using System.Collections.Generic;
@@ -9,8 +10,14 @@ namespace Disco.Models.Services.Devices.Exporting
public Device Device { get; set; }
// Details
public IEnumerable<DeviceDetail> DeviceDetails { get; set; }
public IList<DeviceDetail> DeviceDetails { get; set; }
public List<Processor> DeviceDetailProcessors { get; set; }
public List<PhysicalMemory> DeviceDetailPhysicalMemory { get; set; }
public List<DiskDrive> DeviceDetailDiskDrives { get; set; }
public List<NetworkAdapter> DeviceDetailNetworkAdapters { get; set; }
public List<string> DeviceDetailLanMacAddresses { get; set; }
public List<string> DeviceDetailWlanMacAddresses { get; set; }
// Model
public int? ModelId { get; set; }
public string ModelDescription { get; set; }
@@ -46,6 +53,6 @@ namespace Disco.Models.Services.Devices.Exporting
public int AttachmentsCount { get; set; }
// Certificates
public DeviceCertificate DeviceCertificate { get; set; }
public IEnumerable<DeviceCertificate> DeviceCertificates { get; set; }
}
}