47 Commits

Author SHA1 Message Date
Gary Sharp 09f9f2d427 version bump for v2.4 release 2024-09-26 16:33:55 +10:00
Gary Sharp 390857e065 attempt to preserve IIS bindings so future installations can restore them 2024-09-25 18:16:32 +10:00
Gary Sharp e0d620bf67 feature: lodge insurance 2024-09-25 16:21:51 +10:00
Gary Sharp 78b7b059ea feature: expression helpers - basic email sending 2024-05-16 22:11:10 +10:00
Gary Sharp bb846d14c5 feature: job preferences - On Device Ready For Return expression 2024-05-16 22:09:42 +10:00
Gary Sharp 565e1707ce fix: importing new devices fails for domain joined machines with assigned users 2024-04-08 18:11:03 +10:00
Gary Sharp a675e4a6e9 Feature: Provide CurrentDeviceUserAssignments for use by document expressions 2024-03-28 11:30:39 +11:00
Gary Sharp d8eb8fec83 global support license and validation 2024-01-26 16:23:26 +11:00
Gary Sharp f90eda4101 add pending enrollment identifier 2024-01-24 16:38:50 +11:00
Gary Sharp 37e2e5a08c feature: pending device enrollment approval 2024-01-21 14:06:11 +11:00
Gary Sharp 6af83cbdb2 Merge branch 'device-flags' 2024-01-14 19:13:51 +11:00
Gary Sharp 5f4cb20900 #138 display device flags where appropriate in the UI 2024-01-14 19:13:09 +11:00
Gary Sharp aee467cb53 #138 add/remove individual device flags UI 2024-01-14 18:29:58 +11:00
Gary Sharp 6ce6e2cccf #138 device flags configuration API and UI 2024-01-14 17:59:30 +11:00
Gary Sharp cd858c2215 #138 device flag searching 2024-01-14 17:56:20 +11:00
Gary Sharp 7e07c07171 #138 device flag export service 2024-01-14 17:55:20 +11:00
Gary Sharp 15e2806731 #138 device flag services 2024-01-14 17:54:06 +11:00
Gary Sharp 53baf4eb78 #138 device flag authorization claims 2024-01-13 16:56:23 +11:00
Gary Sharp 8c48ab6ecd #138 device flag models 2024-01-13 16:33:03 +11:00
Gary Sharp 8afe4195a9 #107 allow moving of device OU when changing profile 2024-01-12 12:53:50 +11:00
Gary Sharp dcc4fcb984 #107 support moving profiles devices when changing the organisational unit 2024-01-12 12:52:39 +11:00
Gary Sharp 4631903019 refactor: split windows/mac enrolment 2024-01-12 11:13:48 +11:00
Gary Sharp 85d51c0e45 Fix #141 preserve computer names for non-domain joined devices 2024-01-11 16:27:40 +11:00
Gary Sharp 974a07f3bb show a warning when a device profile OU couuld not be found 2023-11-24 12:58:12 +11:00
Gary Sharp b576aec641 feature: computer name template testing 2023-11-24 11:57:26 +11:00
Gary Sharp a2aaa4c913 #140 make additional fontawesome icons available for user flags 2023-11-12 21:25:16 +11:00
Gary Sharp 318a70d9a3 #140 upgrade fontawesome 2023-11-12 21:24:16 +11:00
Gary Sharp 53e57d4017 feature: user flag assignment exporting 2023-11-11 20:04:52 +11:00
Gary Sharp 143dc1b3e6 bug fix: when exporting devices refresh details before extracting records instead of after 2023-11-11 18:59:59 +11:00
Gary Sharp a4f18d1d49 initial refactor of device export so it can be reused for future exporting 2023-11-11 17:52:24 +11:00
Gary Sharp 46222f2a78 hide decommissioned device profiles and batches by default when updating a devices batch or profile 2023-11-09 20:48:16 +11:00
Gary Sharp 2e091383ec fixes #134 - hide decommissioned device profiles by default 2023-11-09 20:05:25 +11:00
Gary Sharp 7ace4d1c7e add padding row to device batch list to maintain alternating row styles 2023-11-09 19:55:22 +11:00
Gary Sharp f901d45d78 support Firefox checkbox inside anchor element when logging warranty 2023-11-09 14:05:48 +11:00
Gary Sharp 028d1ccc64 remove localhost-only requirement for post upgrade maintenance 2023-11-09 13:43:51 +11:00
Gary Sharp 7b6a44921d plugin library: link to configuration instead of disabled "installed" button 2023-11-09 13:43:09 +11:00
Gary Sharp 23406e5e39 include more inner exception data in system logging 2023-11-08 16:51:08 +11:00
Gary Sharp 83557e6f0c include external job references in detailed search 2023-11-08 16:49:19 +11:00
Gary Sharp 1c90c89158 upgrade ssh.net 2023-11-06 11:25:38 +11:00
Gary Sharp 9924153e82 upgrade dotnet framework 4.5 to 4.6 2023-11-06 11:24:58 +11:00
Gary Sharp 3ec2ea7d37 add job log when re-opening 2023-11-03 15:50:01 +11:00
Gary Sharp b6945d9bbd fix #135 avoid failing device import/enrol when unable to set AD description 2023-10-12 17:37:42 +11:00
Gary Sharp 6740a7479a bug: disable image (camera) attachment upload unless over HTTPS
Browser restriction: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#privacy_and_security
2023-10-12 16:34:35 +11:00
Gary Sharp a3fb09440d feature: document template QR Code image extensions 2023-10-12 16:07:14 +11:00
Gary Sharp 7353405b16 use native media devices to capture webcam images 2023-10-08 16:25:32 +11:00
Gary Sharp 6fcb1a1eae fixup Disco -> Disco ICT 2023-07-26 19:01:31 +10:00
Gary Sharp e204ea4d5f version bump for release candidate 2023-06-10 17:18:04 +10:00
453 changed files with 31623 additions and 9156 deletions
+4
View File
@@ -0,0 +1,4 @@
[*.cs]
# VSSpell001: Spell Check
dotnet_diagnostic.VSSpell001.severity = suggestion
@@ -9,7 +9,6 @@ using Disco.Services.Interop.ActiveDirectory;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Entity;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
+21 -7
View File
@@ -1,8 +1,8 @@
using Disco.BI.Extensions; using Disco.BI.Extensions;
using Disco.Data.Repository; using Disco.Data.Repository;
using Disco.Models.BI.Expressions;
using Disco.Models.Repository; using Disco.Models.Repository;
using Disco.Models.Services.Documents; using Disco.Models.Services.Documents;
using Disco.Models.Services.Expressions.Extensions;
using Disco.Services; using Disco.Services;
using Disco.Services.Documents; using Disco.Services.Documents;
using Disco.Services.Expressions; using Disco.Services.Expressions;
@@ -268,16 +268,15 @@ namespace Disco.BI.Interop.Pdf
var pageUniqueIdBytes = pageUniqueId.ToQRCodeBytes(); var pageUniqueIdBytes = pageUniqueId.ToQRCodeBytes();
// Encode to QRCode byte array // Encode to QRCode byte array
var pageUniqueIdWidth = (int)pdfFieldPosition.position.Width; var pageUniqueIdEncoded = QRCodeBinaryEncoder.Encode(pageUniqueIdBytes, out var qrWidth, out var qrHeight);
var pageUniqueIdHeight = (int)pdfFieldPosition.position.Height;
var pageUniqueIdEncoded = QRCodeBinaryEncoder.Encode(pageUniqueIdBytes, pageUniqueIdWidth, pageUniqueIdHeight);
// Encode byte array to Image // Encode byte array to Image
var pageUniqueIdImageData = CCITTG4Encoder.Compress(pageUniqueIdEncoded, pageUniqueIdWidth, pageUniqueIdHeight); var pageUniqueIdImageData = CCITTG4Encoder.Compress(pageUniqueIdEncoded, qrWidth, qrHeight);
var pageUniqueIdImage = iTextSharp.text.Image.GetInstance(pageUniqueIdWidth, pageUniqueIdHeight, false, 256, 1, pageUniqueIdImageData, null); var pageUniqueIdImage = iTextSharp.text.Image.GetInstance(qrWidth, qrHeight, false, 256, 1, pageUniqueIdImageData, null);
// Add to the pdf page // Add to the pdf page
pageUniqueIdImage.SetAbsolutePosition(pdfFieldPosition.position.Left, pdfFieldPosition.position.Bottom); pageUniqueIdImage.SetAbsolutePosition(pdfFieldPosition.position.Left, pdfFieldPosition.position.Bottom);
pageUniqueIdImage.ScaleToFit(pdfFieldPosition.position.Width, pdfFieldPosition.position.Height);
pdfStamper.GetOverContent(pdfFieldPosition.page).AddImage(pageUniqueIdImage); pdfStamper.GetOverContent(pdfFieldPosition.page).AddImage(pageUniqueIdImage);
} }
// Hide Fields // Hide Fields
@@ -315,7 +314,22 @@ namespace Disco.BI.Interop.Pdf
for (int pdfFieldOrdinal = 0; pdfFieldOrdinal < fields.Size; pdfFieldOrdinal++) for (int pdfFieldOrdinal = 0; pdfFieldOrdinal < fields.Size; pdfFieldOrdinal++)
{ {
AcroFields.FieldPosition pdfFieldPosition = pdfFieldPositions[pdfFieldOrdinal]; AcroFields.FieldPosition pdfFieldPosition = pdfFieldPositions[pdfFieldOrdinal];
iTextSharp.text.Image pdfImage = iTextSharp.text.Image.GetInstance(imageResult.GetImage((int)(pdfFieldPosition.position.Width * 1.6), (int)(pdfFieldPosition.position.Height * 1.6)));
iTextSharp.text.Image pdfImage;
var imageWidth = (int)(pdfFieldPosition.position.Width * 1.6);
var imageHeight = (int)(pdfFieldPosition.position.Height * 1.6);
if (imageResult.Format == ImageExpressionFormat.Jpeg || imageResult.Format == ImageExpressionFormat.Png)
{
pdfImage = iTextSharp.text.Image.GetInstance(imageResult.GetImage(imageWidth, imageHeight));
}
else if (imageResult.Format == ImageExpressionFormat.CcittG4)
{
var imageData = imageResult.GetImage(out imageWidth, out imageHeight);
pdfImage = iTextSharp.text.Image.GetInstance(imageWidth, imageHeight, false, 256, 1, imageData.GetBuffer(), null);
}
else
throw new NotSupportedException($"Unexpected image format {imageResult.Format}");
pdfImage.SetAbsolutePosition(pdfFieldPosition.position.Left, pdfFieldPosition.position.Bottom); pdfImage.SetAbsolutePosition(pdfFieldPosition.position.Left, pdfFieldPosition.position.Bottom);
pdfImage.ScaleToFit(pdfFieldPosition.position.Width, pdfFieldPosition.position.Height); pdfImage.ScaleToFit(pdfFieldPosition.position.Width, pdfFieldPosition.position.Height);
pdfStamper.GetOverContent(pdfFieldPosition.page).AddImage(pdfImage); pdfStamper.GetOverContent(pdfFieldPosition.page).AddImage(pdfImage);
+7
View File
@@ -1,5 +1,7 @@
using iTextSharp.text; using iTextSharp.text;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text.pdf.codec;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@@ -7,6 +9,11 @@ namespace Disco.BI.Interop.Pdf
{ {
public static class Utilities public static class Utilities
{ {
public static Func<byte[], int, int, byte[]> GetCCITTG4EncoderCompressDelegate()
{
return CCITTG4Encoder.Compress;
}
public static Stream JoinPdfs(bool InsertBlankPages, List<Stream> Pdfs) public static Stream JoinPdfs(bool InsertBlankPages, List<Stream> Pdfs)
{ {
if (Pdfs.Count == 0) if (Pdfs.Count == 0)
+1 -1
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Disco</RootNamespace> <RootNamespace>Disco</RootNamespace>
<AssemblyName>Disco.BI</AssemblyName> <AssemblyName>Disco.BI</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+3 -3
View File
@@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.16326.0500")] [assembly: AssemblyVersion("2.4.24270.0000")]
[assembly: AssemblyFileVersion("2.2.16326.0500")] [assembly: AssemblyFileVersion("2.4.24270.0000")]
+1 -1
View File
@@ -19,7 +19,7 @@ namespace Disco.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
+22 -22
View File
@@ -1,56 +1,56 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections> </configSections>
<system.serviceModel> <system.serviceModel>
<bindings /> <bindings/>
<client /> <client/>
</system.serviceModel> </system.serviceModel>
<entityFramework> <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters> <parameters>
<parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True" /> <parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True"/>
</parameters> </parameters>
</defaultConnectionFactory> </defaultConnectionFactory>
</entityFramework> </entityFramework>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" /> <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" /> <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" /> <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
@@ -41,6 +41,9 @@ namespace Disco.Client.Extensions
if (!string.IsNullOrEmpty(enrolResponse.ErrorMessage)) if (!string.IsNullOrEmpty(enrolResponse.ErrorMessage))
throw new ClientServiceException("Enrolment", enrolResponse.ErrorMessage); throw new ClientServiceException("Enrolment", enrolResponse.ErrorMessage);
if (enrolResponse.IsPending)
return;
// Offline Domain Join // Offline Domain Join
bool requireReboot = enrolResponse.ApplyOfflineDomainJoin(); bool requireReboot = enrolResponse.ApplyOfflineDomainJoin();
+5 -5
View File
@@ -331,7 +331,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to retrieve BIOS information from WMI", ex); throw new Exception("Disco ICT Client was unable to retrieve BIOS information from WMI", ex);
} }
} }
@@ -394,7 +394,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to retrieve ComputerSystem information from WMI", ex); throw new Exception("Disco ICT Client was unable to retrieve ComputerSystem information from WMI", ex);
} }
} }
@@ -427,7 +427,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to retrieve ComputerSystem information from WMI", ex); throw new Exception("Disco ICT Client was unable to retrieve ComputerSystem information from WMI", ex);
} }
} }
@@ -504,7 +504,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to retrieve BaseBoard information from WMI", ex); throw new Exception("Disco ICT Client was unable to retrieve BaseBoard information from WMI", ex);
} }
} }
@@ -556,7 +556,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to retrieve ComputerSystemProduct information from WMI", ex); throw new Exception("Disco ICT Client was unable to retrieve ComputerSystemProduct information from WMI", ex);
} }
} }
+1 -1
View File
@@ -68,7 +68,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to retrieve NetworkAdapter information from WMI", ex); throw new Exception("Disco ICT Client was unable to retrieve NetworkAdapter information from WMI", ex);
} }
} }
+3 -3
View File
@@ -61,7 +61,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to retrieve Wireless NetworkAdapter information from WlanApi", ex); throw new Exception("Disco ICT Client was unable to retrieve Wireless NetworkAdapter information from WlanApi", ex);
} }
} }
@@ -102,7 +102,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to retrieve Wireless Profiles from WlanApi", ex); throw new Exception("Disco ICT Client was unable to retrieve Wireless Profiles from WlanApi", ex);
} }
} }
@@ -356,7 +356,7 @@ namespace Disco.Client.Interop
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Disco Client was unable to apply Wireless Profile Changes using WlanApi", ex); throw new Exception("Disco ICT Client was unable to apply Wireless Profile Changes using WlanApi", ex);
} }
} }
+30 -7
View File
@@ -122,17 +122,40 @@ namespace Disco.Client
EnrolResponse response = null; EnrolResponse response = null;
// Build Request // Build Request
Presentation.UpdateStatus("Enrolling Device", "Building enrolment request and preparing to send data to the server.", true, -1); Presentation.UpdateStatus("Enrolling Device", "Building enrollment request and preparing to send data to the server.", true, -1);
request = new Enrol(); request = new Enrol();
request.Build(); request.Build();
// Send Request var startTime = DateTimeOffset.Now;
Presentation.UpdateStatus("Enrolling Device", "Sending the enrolment request to the server.", true, -1); do
response = request.Post(Program.IsAuthenticated); {
// Send Request
Presentation.UpdateStatus("Enrolling Device", "Sending the enrollment request to the server.", true, -1);
response = request.Post(Program.IsAuthenticated);
// Process Response // Process Response
Presentation.UpdateStatus("Enrolling Device", "Processing the enrolment response from the server.", true, -1); Presentation.UpdateStatus("Enrolling Device", "Processing the enrollment response from the server.", true, -1);
response.Process(); response.Process();
if (response.IsPending)
{
request.PendingSessionId = response.SessionId;
request.PendingAuthorization = response.PendingAuthorization;
// Session Pending
var totalSeconds = (response.PendingTimeout - startTime).TotalSeconds;
var secondsConsumed = (DateTimeOffset.Now - startTime).TotalSeconds;
var progress = (int)((secondsConsumed / totalSeconds) * 100);
Presentation.UpdateStatus($"Pending Device Enrollment Approval: {response.PendingIdentifier}", $"Waiting for enrollment session '{response.PendingIdentifier}' to be approved.{Environment.NewLine}Reason: {response.PendingReason}", true, progress);
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(10));
}
else
{
// Session Complete
break;
}
} while (true);
// Complete // Complete
return true; return true;
+3 -3
View File
@@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.16326.0500")] [assembly: AssemblyVersion("2.4.24270.0000")]
[assembly: AssemblyFileVersion("2.2.16326.0500")] [assembly: AssemblyFileVersion("2.4.24270.0000")]
+7 -7
View File
@@ -85,12 +85,12 @@ namespace Disco.ClientBootstrapper
// Check for Network Connectivity // Check for Network Connectivity
statusUI.UpdateStatus(null, "Detecting Network", "Checking network connectivity, Please wait...", true, -1); statusUI.UpdateStatus(null, "Detecting Network", "Checking network connectivity, Please wait...", true, -1);
if (!Interop.NetworkInterop.PingDisco(DiscoServerName)) if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
{ {
statusUI.UpdateStatus(null, "Detecting Network", "No network connectivity detected, Diagnosing...", true, -1); statusUI.UpdateStatus(null, "Detecting Network", "No network connectivity detected, Diagnosing...", true, -1);
statusUI_WriteAdapterInfo(); statusUI_WriteAdapterInfo();
if (!Interop.NetworkInterop.PingDisco(DiscoServerName)) if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
{ {
// Check for Wireless // Check for Wireless
var hasWireless = (Interop.NetworkInterop.NetworkAdapters.Count(na => na.IsWireless) > 0); var hasWireless = (Interop.NetworkInterop.NetworkAdapters.Count(na => na.IsWireless) > 0);
@@ -105,17 +105,17 @@ namespace Disco.ClientBootstrapper
statusUI_WriteAdapterInfo(); statusUI_WriteAdapterInfo();
statusUI.UpdateStatus(null, null, null, true, i); statusUI.UpdateStatus(null, null, null, true, i);
Program.SleepThread(500, false); Program.SleepThread(500, false);
if (Interop.NetworkInterop.PingDisco(DiscoServerName)) if (Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
break; break;
} }
if (!Interop.NetworkInterop.PingDisco(DiscoServerName)) if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
{ {
statusUI.UpdateStatus(null, "Wireless Network Failed", "Unable to connect to the wireless network, please connect the network cable...", false); statusUI.UpdateStatus(null, "Wireless Network Failed", "Unable to connect to the wireless network, please connect the network cable...", false);
Program.SleepThread(3000, false); Program.SleepThread(3000, false);
} }
} }
if (!Interop.NetworkInterop.PingDisco(DiscoServerName)) if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
{ {
// Instruct user to connect network cable // Instruct user to connect network cable
statusUI.UpdateStatus(null, "Please connect the network cable", null); statusUI.UpdateStatus(null, "Please connect the network cable", null);
@@ -124,13 +124,13 @@ namespace Disco.ClientBootstrapper
statusUI_WriteAdapterInfo(); statusUI_WriteAdapterInfo();
statusUI.UpdateStatus(null, null, null, true, i); statusUI.UpdateStatus(null, null, null, true, i);
Program.SleepThread(500, false); Program.SleepThread(500, false);
if (Interop.NetworkInterop.PingDisco(DiscoServerName)) if (Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
break; break;
} }
} }
} }
if (!Interop.NetworkInterop.PingDisco(DiscoServerName)) if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
{ {
// Client Failed // Client Failed
if (this.mLoopCompleteCallback != null) if (this.mLoopCompleteCallback != null)
@@ -8,4 +8,4 @@ BootstrapperLocation = Mid(WScript.ScriptFullName, 1, InStrRev(WScript.ScriptFul
Call objShell.Run("""" & BootstrapperLocation & """ /Install", , True) Call objShell.Run("""" & BootstrapperLocation & """ /Install", , True)
WScript.Echo "Disco Client Bootstrapper Installed" WScript.Echo "Disco ICT Client Bootstrapper Installed"
+2 -2
View File
@@ -85,7 +85,7 @@
this.labelVersion.Name = "labelVersion"; this.labelVersion.Name = "labelVersion";
this.labelVersion.Size = new System.Drawing.Size(167, 20); this.labelVersion.Size = new System.Drawing.Size(167, 20);
this.labelVersion.TabIndex = 0; this.labelVersion.TabIndex = 0;
this.labelVersion.Text = "Disco Bootstrapper v"; this.labelVersion.Text = "Disco ICT Bootstrapper v";
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight; this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
// //
// FormStatus // FormStatus
@@ -106,7 +106,7 @@
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Disco - Client Bootstrapper"; this.Text = "Disco ICT - Client Bootstrapper";
this.TopMost = true; this.TopMost = true;
this.TransparencyKey = System.Drawing.Color.Magenta; this.TransparencyKey = System.Drawing.Color.Magenta;
this.ResumeLayout(false); this.ResumeLayout(false);
+1 -1
View File
@@ -61,7 +61,7 @@ namespace Disco.ClientBootstrapper
this.progressBar.Visible = true; this.progressBar.Visible = true;
if (Progress.HasValue) if (Progress.HasValue)
{ {
if (Progress.Value > 0) if (Progress.Value >= 0)
{ {
this.progressBar.Value = Math.Min(Progress.Value, 100); this.progressBar.Value = Math.Min(Progress.Value, 100);
this.progressBar.Style = ProgressBarStyle.Continuous; this.progressBar.Style = ProgressBarStyle.Continuous;
@@ -165,7 +165,7 @@ namespace Disco.ClientBootstrapper.Interop
} }
} }
public static bool PingDisco(string ServerName) public static bool PingDiscoIct(string ServerName)
{ {
using (Ping p = new Ping()) using (Ping p = new Ping())
{ {
@@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.16326.0500")] [assembly: AssemblyVersion("2.4.24270.0000")]
[assembly: AssemblyFileVersion("2.2.16326.0500")] [assembly: AssemblyFileVersion("2.4.24270.0000")]
+1 -1
View File
@@ -15,6 +15,6 @@
</defaultConnectionFactory> </defaultConnectionFactory>
</entityFramework> </entityFramework>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup> </startup>
</configuration> </configuration>
@@ -1,4 +1,5 @@
using Disco.Data.Repository; using Disco.Data.Repository;
using System;
namespace Disco.Data.Configuration.Modules namespace Disco.Data.Configuration.Modules
{ {
@@ -6,33 +7,24 @@ namespace Disco.Data.Configuration.Modules
{ {
public BootstrapperConfiguration(DiscoDataContext Database) : base(Database) { } public BootstrapperConfiguration(DiscoDataContext Database) : base(Database) { }
public override string Scope public override string Scope { get; } = "Bootstrapper";
{
get { return "Bootstrapper"; }
}
public string MacSshUsername public string MacSshUsername
{ {
get get => Get("root");
{ set => Set(value);
return this.Get("root");
}
set
{
this.Set(value);
}
} }
public string MacSshPassword public string MacSshPassword
{ {
get get => GetDeobsfucated(string.Empty);
{ set => SetObsfucated(value);
return this.GetDeobsfucated(string.Empty); }
}
set public TimeSpan PendingTimeout
{ {
this.SetObsfucated(value); get => TimeSpan.FromSeconds(Get(30 * 60)); // 30 minutes default
} set => Set((int)value.TotalSeconds);
} }
} }
} }
@@ -75,6 +75,12 @@ namespace Disco.Data.Configuration.Modules
set { Set(value); } set { Set(value); }
} }
public string OnDeviceReadyForReturnExpression
{
get { return Get<string>(null); }
set { Set(value); }
}
public string OnCloseExpression public string OnCloseExpression
{ {
get { return Get<string>(null); } get { return Get<string>(null); }
+20 -25
View File
@@ -319,20 +319,27 @@ namespace Disco.Data.Configuration
#endregion #endregion
#region UpdateCheck #region UpdateCheck
public string DeploymentId public bool IsLicensed
{ {
get get => LicenseKey != null && LicenseExpiresOn != null && LicenseExpiresOn > DateTime.UtcNow && LicenseError == null;
{
return Get<string>(null);
}
} }
public string DeploymentSecret public string LicenseKey
{ {
get get => Get<string>(null);
{ set => Set(value);
return Get<string>(null);
}
} }
public DateTime? LicenseExpiresOn
{
get => Get<DateTime?>(null);
set => Set(value);
}
public string LicenseError
{
get => Get<string>(null);
set => Set(value);
}
public string DeploymentId => Get<string>(null);
public string DeploymentSecret => Get<string>(null);
public short DeploymentChecksum public short DeploymentChecksum
{ {
get get
@@ -351,22 +358,10 @@ namespace Disco.Data.Configuration
} }
public UpdateResponseV2 UpdateLastCheckResponse public UpdateResponseV2 UpdateLastCheckResponse
{ {
get get => Get<UpdateResponseV2>(null);
{ set => Set(value);
return Get<UpdateResponseV2>(null);
}
set
{
Set(value);
}
}
public bool UpdateBetaDeployment
{
get
{
return Get(false);
}
} }
public bool UpdateBetaDeployment => Get(false);
public Version InstalledDatabaseVersion public Version InstalledDatabaseVersion
{ {
get get
+15 -1
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Disco.Data</RootNamespace> <RootNamespace>Disco.Data</RootNamespace>
<AssemblyName>Disco.Data</AssemblyName> <AssemblyName>Disco.Data</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
@@ -175,6 +175,14 @@
<Compile Include="Migrations\202304150715559_DBv22.Designer.cs"> <Compile Include="Migrations\202304150715559_DBv22.Designer.cs">
<DependentUpon>202304150715559_DBv22.cs</DependentUpon> <DependentUpon>202304150715559_DBv22.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Migrations\202401130531317_DBv23.cs" />
<Compile Include="Migrations\202401130531317_DBv23.Designer.cs">
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202403030134280_DBv24.cs" />
<Compile Include="Migrations\202403030134280_DBv24.Designer.cs">
<DependentUpon>202403030134280_DBv24.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" /> <Compile Include="Migrations\Configuration.cs" />
<Compile Include="Migrations\DiscoDataMigrator.cs" /> <Compile Include="Migrations\DiscoDataMigrator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@@ -256,6 +264,12 @@
<EmbeddedResource Include="Migrations\202304150715559_DBv22.resx"> <EmbeddedResource Include="Migrations\202304150715559_DBv22.resx">
<DependentUpon>202304150715559_DBv22.cs</DependentUpon> <DependentUpon>202304150715559_DBv22.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Migrations\202401130531317_DBv23.resx">
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202403030134280_DBv24.resx">
<DependentUpon>202403030134280_DBv24.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+27
View File
@@ -0,0 +1,27 @@
// <auto-generated />
namespace Disco.Data.Migrations
{
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
public sealed partial class DBv23 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv23));
string IMigrationMetadata.Id
{
get { return "202401130531317_DBv23"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,67 @@
namespace Disco.Data.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class DBv23 : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.DeviceFlagAssignments",
c => new
{
Id = c.Int(nullable: false, identity: true),
DeviceFlagId = c.Int(nullable: false),
DeviceSerialNumber = c.String(nullable: false, maxLength: 60),
AddedDate = c.DateTime(nullable: false),
AddedUserId = c.String(nullable: false, maxLength: 50),
RemovedDate = c.DateTime(),
RemovedUserId = c.String(maxLength: 50),
Comments = c.String(),
OnAssignmentExpressionResult = c.String(),
OnUnassignmentExpressionResult = c.String(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.DeviceFlags", t => t.DeviceFlagId)
.ForeignKey("dbo.Devices", t => t.DeviceSerialNumber)
.ForeignKey("dbo.Users", t => t.AddedUserId)
.ForeignKey("dbo.Users", t => t.RemovedUserId)
.Index(t => t.DeviceFlagId)
.Index(t => t.DeviceSerialNumber)
.Index(t => t.AddedUserId)
.Index(t => t.RemovedUserId);
CreateTable(
"dbo.DeviceFlags",
c => new
{
Id = c.Int(nullable: false, identity: true),
Name = c.String(nullable: false, maxLength: 100),
Description = c.String(maxLength: 500),
Icon = c.String(nullable: false, maxLength: 25),
IconColour = c.String(nullable: false, maxLength: 10),
DevicesLinkedGroup = c.String(),
DeviceUsersLinkedGroup = c.String(),
OnAssignmentExpression = c.String(),
OnUnassignmentExpression = c.String(),
})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropIndex("dbo.DeviceFlagAssignments", new[] { "RemovedUserId" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "AddedUserId" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceSerialNumber" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceFlagId" });
DropForeignKey("dbo.DeviceFlagAssignments", "RemovedUserId", "dbo.Users");
DropForeignKey("dbo.DeviceFlagAssignments", "AddedUserId", "dbo.Users");
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceSerialNumber", "dbo.Devices");
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceFlagId", "dbo.DeviceFlags");
DropTable("dbo.DeviceFlags");
DropTable("dbo.DeviceFlagAssignments");
}
}
}
File diff suppressed because one or more lines are too long
+27
View File
@@ -0,0 +1,27 @@
// <auto-generated />
namespace Disco.Data.Migrations
{
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
public sealed partial class DBv24 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv24));
string IMigrationMetadata.Id
{
get { return "202403030134280_DBv24"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,20 @@
namespace Disco.Data.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class DBv24 : DbMigration
{
public override void Up()
{
AddColumn("dbo.JobMetaInsurances", "Insurer", c => c.String(maxLength: 200));
AddColumn("dbo.JobMetaInsurances", "InsurerReference", c => c.String(maxLength: 200));
}
public override void Down()
{
DropColumn("dbo.JobMetaInsurances", "InsurerReference");
DropColumn("dbo.JobMetaInsurances", "Insurer");
}
}
}
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.16326.0500")] [assembly: AssemblyVersion("2.4.24270.0000")]
[assembly: AssemblyFileVersion("2.2.16326.0500")] [assembly: AssemblyFileVersion("2.4.24270.0000")]
+2 -2
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.17929 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -19,7 +19,7 @@ namespace Disco.Data.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
+4 -5
View File
@@ -1,9 +1,6 @@
using System; using Disco.Models.Repository;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.Data.Entity; using System.Data.Entity;
using Disco.Models.Repository;
using System.Data.Entity.ModelConfiguration.Conventions; using System.Data.Entity.ModelConfiguration.Conventions;
namespace Disco.Data.Repository namespace Disco.Data.Repository
@@ -38,6 +35,8 @@ namespace Disco.Data.Repository
public virtual DbSet<DeviceBatchAttachment> DeviceBatchAttachments { get; set; } public virtual DbSet<DeviceBatchAttachment> DeviceBatchAttachments { get; set; }
public virtual DbSet<DeviceComponent> DeviceComponents { get; set; } public virtual DbSet<DeviceComponent> DeviceComponents { get; set; }
public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; } public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; }
public virtual DbSet<DeviceFlag> DeviceFlags { get; set; }
public virtual DbSet<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; } public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; }
+12 -14
View File
@@ -1,11 +1,9 @@
using System; using Disco.Models.Repository;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using Disco.Models.Repository;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.DirectoryServices.ActiveDirectory;
using System.DirectoryServices; using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
using System.Linq;
namespace Disco.Data.Repository namespace Disco.Data.Repository
{ {
@@ -370,7 +368,7 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
string defaultNamingContext; string defaultNamingContext;
using (Domain d = Domain.GetComputerDomain()) using (Domain d = Domain.GetComputerDomain())
{ {
string ldapPath = string.Format("LDAP://{0}/", d.Name); string ldapPath = $"LDAP://{d.Name}/";
string configurationNamingContext; string configurationNamingContext;
using (var adRootDSE = new DirectoryEntry(ldapPath + "RootDSE")) using (var adRootDSE = new DirectoryEntry(ldapPath + "RootDSE"))
@@ -381,7 +379,7 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
using (var configSearchRoot = new DirectoryEntry(ldapPath + "CN=Partitions," + configurationNamingContext)) using (var configSearchRoot = new DirectoryEntry(ldapPath + "CN=Partitions," + configurationNamingContext))
{ {
var configSearchFilter = string.Format("(&(objectcategory=Crossref)(dnsRoot={0})(netBIOSName=*))", d.Name); var configSearchFilter = $"(&(objectcategory=Crossref)(dnsRoot={d.Name})(netBIOSName=*))";
var configSearchLoadProperites = new string[] { "NetBIOSName" }; var configSearchLoadProperites = new string[] { "NetBIOSName" };
using (var configSearcher = new DirectorySearcher(configSearchRoot, configSearchFilter, configSearchLoadProperites, SearchScope.OneLevel)) using (var configSearcher = new DirectorySearcher(configSearchRoot, configSearchFilter, configSearchLoadProperites, SearchScope.OneLevel))
@@ -403,14 +401,14 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
// Authorization Roles // Authorization Roles
foreach (var authRole in Database.AuthorizationRoles.Where(ar => ar.SubjectIds != null).ToList()) foreach (var authRole in Database.AuthorizationRoles.Where(ar => ar.SubjectIds != null).ToList())
{ {
var ids = string.Join(",", authRole.SubjectIds.Split(',').Select(id => id.Contains('\\') ? id : string.Format("{0}\\{1}", netBiosName, id))); var ids = string.Join(",", authRole.SubjectIds.Split(',').Select(id => id.Contains('\\') ? id : $@"{netBiosName}\{id}"));
if (ids != authRole.SubjectIds) if (ids != authRole.SubjectIds)
authRole.SubjectIds = ids; authRole.SubjectIds = ids;
} }
// Job Queues // Job Queues
foreach (var jobQueue in Database.JobQueues.Where(jq => jq.SubjectIds != null).ToList()) foreach (var jobQueue in Database.JobQueues.Where(jq => jq.SubjectIds != null).ToList())
{ {
var ids = string.Join(",", jobQueue.SubjectIds.Split(',').Select(id => id.Contains('\\') ? id : string.Format("{0}\\{1}", netBiosName, id))); var ids = string.Join(",", jobQueue.SubjectIds.Split(',').Select(id => id.Contains('\\') ? id : $@"{netBiosName}\{id}"));
if (ids != jobQueue.SubjectIds) if (ids != jobQueue.SubjectIds)
jobQueue.SubjectIds = ids; jobQueue.SubjectIds = ids;
} }
@@ -418,9 +416,9 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
foreach (var deviceProfile in Database.DeviceProfiles.Where(dp => dp.OrganisationalUnit == null || !dp.OrganisationalUnit.Contains(@"DC=")).ToList()) foreach (var deviceProfile in Database.DeviceProfiles.Where(dp => dp.OrganisationalUnit == null || !dp.OrganisationalUnit.Contains(@"DC=")).ToList())
{ {
if (string.IsNullOrWhiteSpace(deviceProfile.OrganisationalUnit)) if (string.IsNullOrWhiteSpace(deviceProfile.OrganisationalUnit))
deviceProfile.OrganisationalUnit = string.Format("CN=Computers,{0}", defaultNamingContext); deviceProfile.OrganisationalUnit = $"CN=Computers,{defaultNamingContext}";
else else
deviceProfile.OrganisationalUnit = string.Format("{0},{1}", deviceProfile.OrganisationalUnit, defaultNamingContext); deviceProfile.OrganisationalUnit = $"{deviceProfile.OrganisationalUnit},{defaultNamingContext}";
} }
Database.SaveChanges(); Database.SaveChanges();
@@ -451,7 +449,7 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
// MIGRATE DEVICES // MIGRATE DEVICES
foreach (var device in Database.Devices.Where(d => d.DeviceDomainId != null && !d.DeviceDomainId.Contains(@"\")).ToList()) foreach (var device in Database.Devices.Where(d => d.DeviceDomainId != null && !d.DeviceDomainId.Contains(@"\")).ToList())
{ {
device.DeviceDomainId = string.Format("{0}\\{1}", netBiosName, device.DeviceDomainId); device.DeviceDomainId = $@"{netBiosName}\{device.DeviceDomainId}";
} }
Database.SaveChanges(); Database.SaveChanges();
@@ -462,7 +460,7 @@ DELETE [Users] WHERE [Id]=@IdExisting;";
idExisting.Value = user.UserId; idExisting.Value = user.UserId;
SqlParameter idNew = new SqlParameter("@IdNew", System.Data.SqlDbType.NVarChar, 50); SqlParameter idNew = new SqlParameter("@IdNew", System.Data.SqlDbType.NVarChar, 50);
idNew.Value = string.Format("{0}\\{1}", netBiosName, user.UserId); idNew.Value = $@"{netBiosName}\{user.UserId}";
Database.Database.ExecuteSqlCommand(MigratePreDomainUsers_Sql, idExisting, idNew); Database.Database.ExecuteSqlCommand(MigratePreDomainUsers_Sql, idExisting, idNew);
} }
@@ -71,7 +71,7 @@ namespace Disco.Data.Repository
var connectionString = DiscoDataContextConnectionString; var connectionString = DiscoDataContextConnectionString;
if (connectionString == null) if (connectionString == null)
{ {
throw new InvalidOperationException("The Disco DataContext Connection String has not been configured"); throw new InvalidOperationException("The Disco ICT DataContext Connection String has not been configured");
} }
// Build DiscoDataContext - Use Default Connection Factory (SQLClient) // Build DiscoDataContext - Use Default Connection Factory (SQLClient)
+1 -1
View File
@@ -12,6 +12,6 @@
</defaultConnectionFactory> </defaultConnectionFactory>
</entityFramework> </entityFramework>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup> </startup>
</configuration> </configuration>
+3
View File
@@ -25,5 +25,8 @@ namespace Disco.Models.ClientServices
public List<Certificate> Certificates { get; set; } public List<Certificate> Certificates { get; set; }
public List<WirelessProfile> WirelessProfiles { get; set; } public List<WirelessProfile> WirelessProfiles { get; set; }
public string PendingSessionId { get; set; }
public string PendingAuthorization { get; set; }
} }
} }
@@ -1,4 +1,5 @@
using Disco.Models.ClientServices.EnrolmentInformation; using Disco.Models.ClientServices.EnrolmentInformation;
using System;
namespace Disco.Models.ClientServices namespace Disco.Models.ClientServices
{ {
@@ -26,5 +27,11 @@ namespace Disco.Models.ClientServices
public bool RequireReboot { get; set; } public bool RequireReboot { get; set; }
public string ErrorMessage { get; set; } public string ErrorMessage { get; set; }
public bool IsPending { get; set; }
public string PendingAuthorization { get; set; }
public string PendingReason { get; set; }
public DateTimeOffset PendingTimeout { get; set; }
public string PendingIdentifier { get; set; }
} }
} }
+19 -4
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Disco.Models</RootNamespace> <RootNamespace>Disco.Models</RootNamespace>
<AssemblyName>Disco.Models</AssemblyName> <AssemblyName>Disco.Models</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
@@ -49,6 +49,14 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BI\Config\OrganisationAddress.cs" /> <Compile Include="BI\Config\OrganisationAddress.cs" />
<Compile Include="Exporting\ExportFieldMetadata.cs" />
<Compile Include="Exporting\ExportFormat.cs" />
<Compile Include="Exporting\IExportRecord.cs" />
<Compile Include="Repository\Device\Flag\DeviceFlag.cs" />
<Compile Include="Repository\Device\Flag\DeviceFlagAssignment.cs" />
<Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportOptions.cs" />
<Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportRecord.cs" />
<Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" />
<Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" /> <Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" />
<Compile Include="ClientServices\EnrolmentInformation\Battery.cs" /> <Compile Include="ClientServices\EnrolmentInformation\Battery.cs" />
<Compile Include="ClientServices\EnrolmentInformation\Bios.cs" /> <Compile Include="ClientServices\EnrolmentInformation\Bios.cs" />
@@ -65,13 +73,13 @@
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileStore.cs" /> <Compile Include="ClientServices\EnrolmentInformation\WirelessProfileStore.cs" />
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileTransformation.cs" /> <Compile Include="ClientServices\EnrolmentInformation\WirelessProfileTransformation.cs" />
<Compile Include="Repository\Device\DeviceBatchAttachment.cs" /> <Compile Include="Repository\Device\DeviceBatchAttachment.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportFieldMetadata.cs" />
<Compile Include="Services\Devices\Importing\IDeviceImportColumn.cs" /> <Compile Include="Services\Devices\Importing\IDeviceImportColumn.cs" />
<Compile Include="Services\Devices\Importing\IDeviceImportDataReader.cs" /> <Compile Include="Services\Devices\Importing\IDeviceImportDataReader.cs" />
<Compile Include="Services\Documents\DocumentField.cs" /> <Compile Include="Services\Documents\DocumentField.cs" />
<Compile Include="Services\Documents\DocumentFieldType.cs" /> <Compile Include="Services\Documents\DocumentFieldType.cs" />
<Compile Include="Services\Documents\DocumentTemplatePackage.cs" /> <Compile Include="Services\Documents\DocumentTemplatePackage.cs" />
<Compile Include="Services\Documents\OnImportUserFlagRule.cs" /> <Compile Include="Services\Documents\OnImportUserFlagRule.cs" />
<Compile Include="Exporting\IExportOptions.cs" />
<Compile Include="Services\Jobs\LocationModes.cs" /> <Compile Include="Services\Jobs\LocationModes.cs" />
<Compile Include="ClientServices\EnrolmentInformation\Certificate.cs" /> <Compile Include="ClientServices\EnrolmentInformation\Certificate.cs" />
<Compile Include="ClientServices\Register.cs" /> <Compile Include="ClientServices\Register.cs" />
@@ -86,7 +94,7 @@
<Compile Include="Services\Authorization\IClaimNavigatorItem.cs" /> <Compile Include="Services\Authorization\IClaimNavigatorItem.cs" />
<Compile Include="Services\Authorization\IRoleToken.cs" /> <Compile Include="Services\Authorization\IRoleToken.cs" />
<Compile Include="Services\Documents\DocumentState.cs" /> <Compile Include="Services\Documents\DocumentState.cs" />
<Compile Include="BI\Expressions\IImageExpressionResult.cs" /> <Compile Include="Services\Expressions\Extensions\IImageExpressionResult.cs" />
<Compile Include="Services\Jobs\Statistics\DailyOpenedClosedItem.cs" /> <Compile Include="Services\Jobs\Statistics\DailyOpenedClosedItem.cs" />
<Compile Include="ClientServices\EnrolResponse.cs" /> <Compile Include="ClientServices\EnrolResponse.cs" />
<Compile Include="ClientServices\MacEnrol.cs" /> <Compile Include="ClientServices\MacEnrol.cs" />
@@ -125,7 +133,7 @@
<Compile Include="Repository\User\UserDetail.cs" /> <Compile Include="Repository\User\UserDetail.cs" />
<Compile Include="Repository\User\AuthorizationRole.cs" /> <Compile Include="Repository\User\AuthorizationRole.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportRecord.cs" /> <Compile Include="Services\Devices\Exporting\DeviceExportRecord.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportResult.cs" /> <Compile Include="Exporting\ExportResult.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportTypes.cs" /> <Compile Include="Services\Devices\Exporting\DeviceExportTypes.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportOptions.cs" /> <Compile Include="Services\Devices\Exporting\DeviceExportOptions.cs" />
<Compile Include="Services\Devices\Importing\DeviceImportFieldTypes.cs" /> <Compile Include="Services\Devices\Importing\DeviceImportFieldTypes.cs" />
@@ -154,6 +162,8 @@
<Compile Include="Services\Searching\ISearchResultItem.cs" /> <Compile Include="Services\Searching\ISearchResultItem.cs" />
<Compile Include="Services\Searching\JobSearchResultItem.cs" /> <Compile Include="Services\Searching\JobSearchResultItem.cs" />
<Compile Include="Services\Searching\UserSearchResultItem.cs" /> <Compile Include="Services\Searching\UserSearchResultItem.cs" />
<Compile Include="Services\Users\UserFlags\UserFlagExportOptions.cs" />
<Compile Include="Services\Users\UserFlags\UserFlagExportRecord.cs" />
<Compile Include="UI\BaseUIModel.cs" /> <Compile Include="UI\BaseUIModel.cs" />
<Compile Include="UI\Config\AuthorizationRole\ConfigAuthorizationRoleCreateModel.cs" /> <Compile Include="UI\Config\AuthorizationRole\ConfigAuthorizationRoleCreateModel.cs" />
<Compile Include="UI\Config\AuthorizationRole\ConfigAuthorizationRoleIndexModel.cs" /> <Compile Include="UI\Config\AuthorizationRole\ConfigAuthorizationRoleIndexModel.cs" />
@@ -192,9 +202,14 @@
<Compile Include="UI\Config\Shared\ConfigSharedDeviceGroupDocumentTemplateBulkGenerate.cs" /> <Compile Include="UI\Config\Shared\ConfigSharedDeviceGroupDocumentTemplateBulkGenerate.cs" />
<Compile Include="UI\Config\Shared\ConfigSharedTaskStatusModel.cs" /> <Compile Include="UI\Config\Shared\ConfigSharedTaskStatusModel.cs" />
<Compile Include="UI\Config\Organisation\ConfigOrganisationIndexModel.cs" /> <Compile Include="UI\Config\Organisation\ConfigOrganisationIndexModel.cs" />
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagCreateModel.cs" />
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagExportModel.cs" />
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagIndexModel.cs" />
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagShowModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagCreateModel.cs" /> <Compile Include="UI\Config\UserFlag\ConfigUserFlagCreateModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagIndexModel.cs" /> <Compile Include="UI\Config\UserFlag\ConfigUserFlagIndexModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagShowModel.cs" /> <Compile Include="UI\Config\UserFlag\ConfigUserFlagShowModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagExportModel.cs" />
<Compile Include="UI\Device\DeviceAddOfflineModel.cs" /> <Compile Include="UI\Device\DeviceAddOfflineModel.cs" />
<Compile Include="UI\Device\DeviceExportModel.cs" /> <Compile Include="UI\Device\DeviceExportModel.cs" />
<Compile Include="UI\Device\DeviceImportHeadersModel.cs" /> <Compile Include="UI\Device\DeviceImportHeadersModel.cs" />
@@ -1,16 +1,16 @@
using System; using System;
namespace Disco.Models.Services.Devices.Exporting namespace Disco.Models.Exporting
{ {
public class DeviceExportFieldMetadata public class ExportFieldMetadata<T> where T : IExportRecord
{ {
public string Name { get; set; } public string Name { get; set; }
public string ColumnName { get; set; } public string ColumnName { get; set; }
public Type ValueType { get; set; } public Type ValueType { get; set; }
public Func<DeviceExportRecord, object> Accessor { get; set; } public Func<T, object> Accessor { get; set; }
public Func<object, string> CsvEncoder { get; set; } public Func<object, string> CsvEncoder { get; set; }
public DeviceExportFieldMetadata(string name, Type valueType, Func<DeviceExportRecord, object> accessor, Func<object, string> csvEncoder) public ExportFieldMetadata(string name, Type valueType, Func<T, object> accessor, Func<object, string> csvEncoder)
{ {
Name = name; Name = name;
ValueType = valueType; ValueType = valueType;
@@ -18,7 +18,7 @@ namespace Disco.Models.Services.Devices.Exporting
CsvEncoder = csvEncoder; CsvEncoder = csvEncoder;
} }
public DeviceExportFieldMetadata(string name, string columnName, Type valueType, Func<DeviceExportRecord, object> accessor, Func<object, string> csvEncoder) public ExportFieldMetadata(string name, string columnName, Type valueType, Func<T, object> accessor, Func<object, string> csvEncoder)
: this(name, valueType, accessor, csvEncoder) : this(name, valueType, accessor, csvEncoder)
{ {
ColumnName = columnName; ColumnName = columnName;
+8
View File
@@ -0,0 +1,8 @@
namespace Disco.Models.Exporting
{
public enum ExportFormat
{
Csv,
Xlsx,
}
}
+12
View File
@@ -0,0 +1,12 @@
using System.IO;
namespace Disco.Models.Services.Exporting
{
public class ExportResult
{
public MemoryStream Result { get; set; }
public string Filename { get; set; }
public string MimeType { get; set; }
public int RecordCount { get; set; }
}
}
+12
View File
@@ -0,0 +1,12 @@
using Disco.Models.Exporting;
namespace Disco.Models.Services.Exporting
{
public interface IExportOptions
{
ExportFormat Format { get; }
string FilenamePrefix { get; }
string ExcelWorksheetName { get; }
string ExcelTableName { get; }
}
}
+6
View File
@@ -0,0 +1,6 @@
namespace Disco.Models.Exporting
{
public interface IExportRecord
{
}
}
+3 -3
View File
@@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.16326.0500")] [assembly: AssemblyVersion("2.4.24270.0000")]
[assembly: AssemblyFileVersion("2.2.16326.0500")] [assembly: AssemblyFileVersion("2.4.24270.0000")]
+16
View File
@@ -51,6 +51,22 @@ namespace Disco.Models.Repository
[InverseProperty("DeviceSerialNumber")] [InverseProperty("DeviceSerialNumber")]
public virtual IList<Job> Jobs { get; set; } public virtual IList<Job> Jobs { get; set; }
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
/// <summary>
/// A list of the current device assignments, ordered by the most recent assignment date.
/// </summary>
[NotMapped]
public IList<DeviceUserAssignment> CurrentDeviceUserAssignments
{
get
{
return DeviceUserAssignments?
.Where(dua => dua.UnassignedDate is null)
.OrderByDescending(dua => dua.AssignedDate)
.ToList();
}
}
public override string ToString() public override string ToString()
{ {
@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Repository
{
public class DeviceFlag
{
[Key]
public int Id { get; set; }
[Required, StringLength(100)]
public string Name { get; set; }
[StringLength(500), DataType(DataType.MultilineText)]
public string Description { get; set; }
[Required, StringLength(25)]
public string Icon { get; set; }
[Required, StringLength(10)]
public string IconColour { get; set; }
public string DevicesLinkedGroup { get; set; }
public string DeviceUsersLinkedGroup { get; set; }
[DataType(DataType.MultilineText)]
public string OnAssignmentExpression { get; set; }
[DataType(DataType.MultilineText)]
public string OnUnassignmentExpression { get; set; }
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
public override string ToString()
{
return Name;
}
}
}
@@ -0,0 +1,44 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class DeviceFlagAssignment
{
[Key]
public int Id { get; set; }
[Required]
public int DeviceFlagId { get; set; }
[Required]
public string DeviceSerialNumber { get; set; }
[Required]
public DateTime AddedDate { get; set; }
[Required]
public string AddedUserId { get; set; }
public DateTime? RemovedDate { get; set; }
public string RemovedUserId { get; set; }
public string Comments { get; set; }
public string OnAssignmentExpressionResult { get; set; }
public string OnUnassignmentExpressionResult { get; set; }
[ForeignKey(nameof(DeviceFlagId)), InverseProperty("DeviceFlagAssignments")]
public virtual DeviceFlag DeviceFlag { get; set; }
[ForeignKey(nameof(DeviceSerialNumber)), InverseProperty("DeviceFlagAssignments")]
public virtual Device Device { get; set; }
[ForeignKey("AddedUserId")]
public virtual User AddedUser { get; set; }
[ForeignKey("RemovedUserId")]
public virtual User RemovedUser { get; set; }
public override string ToString()
{
return $"Device Flag Id: {DeviceFlagId}; Device Serial Number: {DeviceSerialNumber}; Added: {AddedDate:s}";
}
}
}
@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
@@ -58,6 +55,10 @@ namespace Disco.Models.Repository
[DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)] [DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd hh:mm tt}", HtmlEncode = false)]
public DateTime? ClaimFormSentDate { get; set; } public DateTime? ClaimFormSentDate { get; set; }
public string ClaimFormSentUserId { get; set; } public string ClaimFormSentUserId { get; set; }
[StringLength(200)]
public string Insurer { get; set; }
[StringLength(200)]
public string InsurerReference { get; set; }
[Required, ForeignKey("JobId")] [Required, ForeignKey("JobId")]
public virtual Job Job { get; set; } public virtual Job Job { get; set; }
@@ -0,0 +1,192 @@
using Disco.Models.Exporting;
using Disco.Models.Services.Exporting;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Services.Devices.DeviceFlag
{
public class DeviceFlagExportOptions : IExportOptions
{
public ExportFormat Format { get; set; }
public string FilenamePrefix { get; } = "DiscoDeviceFlagExport";
public string ExcelWorksheetName { get; } = "DeviceFlagExport";
public string ExcelTableName { get; } = "DeviceFlags";
[Required]
public List<int> DeviceFlagIds { get; set; } = new List<int>();
[Display(Name = "Current Only")]
public bool CurrentOnly { get; set; }
// Device Flag
[Display(ShortName = "Device Flag", Name = "Identifier", Description = "The identifier of the device flag")]
public bool Id { get; set; }
[Display(ShortName = "Device Flag", Name = "Name", Description = "The name of the device flag")]
public bool Name { get; set; }
[Display(ShortName = "Device Flag", Name = "Description", Description = "The description of the device flag")]
public bool Description { get; set; }
[Display(ShortName = "Device Flag", Name = "Icon", Description = "The icon assigned to the device flag")]
public bool Icon { get; set; }
[Display(ShortName = "Device Flag", Name = "Icon Colour", Description = "The icon colour assigned to the device flag")]
public bool IconColour { get; set; }
[Display(ShortName = "Device Flag", Name = "Assignment Identifier", Description = "The identifier of the device flag assignment")]
public bool AssignmentId { get; set; }
[Display(ShortName = "Device Flag", Name = "Added Date", Description = "The date the device flag was assigned to the user")]
public bool AddedDate { get; set; }
[Display(ShortName = "Device Flag", Name = "Added User Identifier", Description = "The identifier of the user who assigned the device flag")]
public bool AddedUserId { get; set; }
[Display(ShortName = "Device Flag", Name = "Removed Date", Description = "The date the device flag was unassigned from the user")]
public bool RemovedDate { get; set; }
[Display(ShortName = "Device Flag", Name = "Removed User Identifier", Description = "The identifier of the user who unassigned the device flag")]
public bool RemovedUserId { get; set; }
[Display(ShortName = "Device Flag", Name = "Comments", Description = "The comments associated with the device flag assignment")]
public bool Comments { get; set; }
// Device
[Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")]
public bool DeviceSerialNumber { get; set; }
[Display(ShortName = "Device", Name = "Asset Number", Description = "The device asset number")]
public bool DeviceAssetNumber { get; set; }
[Display(ShortName = "Device", Name = "Location", Description = "The device location")]
public bool DeviceLocation { get; set; }
[Display(ShortName = "Device", Name = "Computer Name", Description = "The device computer name")]
public bool DeviceComputerName { get; set; }
[Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")]
public bool DeviceLastNetworkLogon { get; set; }
[Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")]
public bool DeviceCreatedDate { get; set; }
[Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")]
public bool DeviceFirstEnrolledDate { get; set; }
[Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")]
public bool DeviceLastEnrolledDate { get; set; }
[Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")]
public bool DeviceAllowUnauthenticatedEnrol { get; set; }
[Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")]
public bool DeviceDecommissionedDate { get; set; }
[Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")]
public bool DeviceDecommissionedReason { get; set; }
public bool HasDeviceOptions()
{
return DeviceSerialNumber ||
DeviceAssetNumber ||
DeviceLocation ||
DeviceComputerName ||
DeviceLastNetworkLogon ||
DeviceCreatedDate ||
DeviceFirstEnrolledDate ||
DeviceLastEnrolledDate ||
DeviceAllowUnauthenticatedEnrol ||
DeviceDecommissionedDate ||
DeviceDecommissionedReason;
}
// Model
[Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")]
public bool ModelId { get; set; }
[Display(ShortName = "Model", Name = "Description", Description = "The description of the device model associated with the device")]
public bool ModelDescription { get; set; }
[Display(ShortName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")]
public bool ModelManufacturer { get; set; }
[Display(ShortName = "Model", Name = "Model", Description = "The model of the device model associated with the device")]
public bool ModelModel { get; set; }
[Display(ShortName = "Model", Name = "Type", Description = "The type of device model associated with the device")]
public bool ModelType { get; set; }
public bool HasDeviceModelOptions()
{
return ModelId ||
ModelDescription ||
ModelManufacturer ||
ModelModel ||
ModelType;
}
// Batch
[Display(ShortName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")]
public bool BatchId { get; set; }
[Display(ShortName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")]
public bool BatchName { get; set; }
[Display(ShortName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")]
public bool BatchPurchaseDate { get; set; }
[Display(ShortName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")]
public bool BatchSupplier { get; set; }
[Display(ShortName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")]
public bool BatchUnitCost { get; set; }
[Display(ShortName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")]
public bool BatchWarrantyValidUntilDate { get; set; }
[Display(ShortName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")]
public bool BatchInsuredDate { get; set; }
[Display(ShortName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")]
public bool BatchInsuranceSupplier { get; set; }
[Display(ShortName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")]
public bool BatchInsuredUntilDate { get; set; }
public bool HasDeviceBatchOptions()
{
return BatchId ||
BatchName ||
BatchPurchaseDate ||
BatchSupplier ||
BatchUnitCost ||
BatchWarrantyValidUntilDate ||
BatchInsuredDate ||
BatchInsuranceSupplier ||
BatchInsuredUntilDate;
}
// Profile
[Display(ShortName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")]
public bool ProfileId { get; set; }
[Display(ShortName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")]
public bool ProfileName { get; set; }
[Display(ShortName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")]
public bool ProfileShortName { get; set; }
public bool HasDeviceProfileOptions()
{
return ProfileId ||
ProfileName ||
ProfileShortName;
}
// Assigned User
[Display(ShortName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned to the device flag")]
public bool AssignedUserId { get; set; }
[Display(ShortName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned to the device flag")]
public bool AssignedUserDisplayName { get; set; }
[Display(ShortName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned to the device flag")]
public bool AssignedUserSurname { get; set; }
[Display(ShortName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned to the device flag")]
public bool AssignedUserGivenName { get; set; }
[Display(ShortName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned to the device flag")]
public bool AssignedUserPhoneNumber { get; set; }
[Display(ShortName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device flag")]
public bool AssignedUserEmailAddress { get; set; }
[Display(ShortName = "Assigned User", Name = "Custom Details", Description = "The custom details provided by plugins for the user assigned to the device flag")]
public bool AssignedUserDetailCustom { get; set; }
public bool HasAssignedUserOptions()
{
return AssignedUserId ||
AssignedUserDisplayName ||
AssignedUserSurname ||
AssignedUserGivenName ||
AssignedUserPhoneNumber ||
AssignedUserEmailAddress;
}
public static DeviceFlagExportOptions DefaultOptions()
{
return new DeviceFlagExportOptions()
{
Format = ExportFormat.Xlsx,
CurrentOnly = true,
Name = true,
AddedDate = true,
DeviceSerialNumber = true,
ModelDescription = true,
ProfileName = true,
AssignedUserId = true,
AssignedUserDisplayName = true,
Comments = true,
};
}
}
}
@@ -0,0 +1,12 @@
using Disco.Models.Exporting;
using Disco.Models.Repository;
using System.Collections.Generic;
namespace Disco.Models.Services.Devices.DeviceFlag
{
public class DeviceFlagExportRecord : IExportRecord
{
public DeviceFlagAssignment Assignment { get; set; }
public Dictionary<string, string> AssignedUserCustomDetails { get; set; }
}
}
@@ -1,13 +1,18 @@
using System.ComponentModel.DataAnnotations; using Disco.Models.Exporting;
using Disco.Models.Services.Exporting;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Services.Devices.Exporting namespace Disco.Models.Services.Devices.Exporting
{ {
public class DeviceExportOptions public class DeviceExportOptions : IExportOptions
{ {
public DeviceExportTypes ExportType { get; set; } public DeviceExportTypes ExportType { get; set; }
public int? ExportTypeTargetId { get; set; } public int? ExportTypeTargetId { get; set; }
public bool ExcelFormat { get; set; } public ExportFormat Format { get; set; }
public string FilenamePrefix { get; } = "DiscoDeviceExport";
public string ExcelWorksheetName { get; } = "DeviceExport";
public string ExcelTableName { get; } = "Devices";
// Device // Device
[Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")] [Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")]
@@ -20,15 +25,15 @@ namespace Disco.Models.Services.Devices.Exporting
public bool DeviceComputerName { get; set; } public bool DeviceComputerName { get; set; }
[Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")] [Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")]
public bool DeviceLastNetworkLogon { get; set; } public bool DeviceLastNetworkLogon { get; set; }
[Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco")] [Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")]
public bool DeviceCreatedDate { get; set; } public bool DeviceCreatedDate { get; set; }
[Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco")] [Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")]
public bool DeviceFirstEnrolledDate { get; set; } public bool DeviceFirstEnrolledDate { get; set; }
[Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco")] [Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")]
public bool DeviceLastEnrolledDate { get; set; } public bool DeviceLastEnrolledDate { get; set; }
[Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")] [Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")]
public bool DeviceAllowUnauthenticatedEnrol { get; set; } public bool DeviceAllowUnauthenticatedEnrol { get; set; }
[Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco")] [Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")]
public bool DeviceDecommissionedDate { get; set; } public bool DeviceDecommissionedDate { get; set; }
[Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")] [Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")]
public bool DeviceDecommissionedReason { get; set; } public bool DeviceDecommissionedReason { get; set; }
@@ -136,7 +141,7 @@ namespace Disco.Models.Services.Devices.Exporting
return new DeviceExportOptions() return new DeviceExportOptions()
{ {
ExportType = DeviceExportTypes.All, ExportType = DeviceExportTypes.All,
ExcelFormat = true, Format = ExportFormat.Xlsx,
DeviceSerialNumber = true, DeviceSerialNumber = true,
ModelId = true, ModelId = true,
ProfileId = true, ProfileId = true,
@@ -1,11 +1,12 @@
using Disco.Models.ClientServices.EnrolmentInformation; using Disco.Models.ClientServices.EnrolmentInformation;
using Disco.Models.Exporting;
using Disco.Models.Repository; using Disco.Models.Repository;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Disco.Models.Services.Devices.Exporting namespace Disco.Models.Services.Devices.Exporting
{ {
public class DeviceExportRecord public class DeviceExportRecord : IExportRecord
{ {
public Device Device { get; set; } public Device Device { get; set; }
@@ -1,10 +0,0 @@
using System.IO;
namespace Disco.Models.Services.Devices.Exporting
{
public class DeviceExportResult
{
public MemoryStream Result { get; set; }
public int RecordCount { get; set; }
}
}
@@ -1,10 +1,4 @@
using System; namespace Disco.Models.Services.Devices.Exporting
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.Services.Devices.Exporting
{ {
public enum DeviceExportTypes public enum DeviceExportTypes
{ {
@@ -14,7 +14,7 @@ namespace Disco.Models.Services.Devices.Importing
DeviceLocation, DeviceLocation,
[Display(Name = "Device Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")] [Display(Name = "Device Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")]
DeviceAllowUnauthenticatedEnrol, DeviceAllowUnauthenticatedEnrol,
[Display(Name = "Device Decommissioned Date", Description = "The date the device was decommissioned in Disco")] [Display(Name = "Device Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")]
DeviceDecommissionedDate, DeviceDecommissionedDate,
[Display(Name = "Device Decommissioned Reason", Description = "The reason the device was decommissioned")] [Display(Name = "Device Decommissioned Reason", Description = "The reason the device was decommissioned")]
DeviceDecommissionedReason, DeviceDecommissionedReason,
@@ -1,13 +1,13 @@
using System.IO; using System.IO;
namespace Disco.Models.BI.Expressions namespace Disco.Models.Services.Expressions.Extensions
{ {
public interface IImageExpressionResult public interface IImageExpressionResult
{ {
Stream GetImage(int Width, int Height); MemoryStream GetImage(int width, int height);
Stream GetImage(); MemoryStream GetImage(out int width, out int height);
byte Quality { get; set; } byte Quality { get; set; }
bool LosslessFormat { get; set; } ImageExpressionFormat Format { get; set; }
bool ShowField { get; set; } bool ShowField { get; set; }
string BackgroundColour { get; set; } string BackgroundColour { get; set; }
bool BackgroundPreferTransparent { get; set; } bool BackgroundPreferTransparent { get; set; }
@@ -0,0 +1,9 @@
namespace Disco.Models.Services.Expressions.Extensions
{
public enum ImageExpressionFormat
{
Jpeg,
Png,
CcittG4,
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ namespace Disco.Models.Services.Messaging
public Email(string to, string subject, string body) public Email(string to, string subject, string body)
: this() : this()
{ {
To.Add(to); To.AddRange(ParseEmailAddresses(to));
Subject = subject; Subject = subject;
Body = body; Body = body;
} }
@@ -4,5 +4,6 @@
{ {
public string Name { get; set; } public string Name { get; set; }
public byte[] Data { get; set; } public byte[] Data { get; set; }
public string MediaType { get; set; }
} }
} }
@@ -1,4 +1,5 @@
using System; using Disco.Models.Repository;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -44,6 +45,7 @@ namespace Disco.Models.Services.Searching
public string DeviceBatchName { get; set; } public string DeviceBatchName { get; set; }
public int JobCount { get; set; } public int JobCount { get; set; }
public DateTime? DecommissionedDate { get; set; } public DateTime? DecommissionedDate { get; set; }
public IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
private string[] BuildScoreValues() private string[] BuildScoreValues()
{ {
@@ -19,6 +19,10 @@ namespace Disco.Models.Services.Users.Contact
User = user; User = user;
ContactType = contactType; ContactType = contactType;
Source = source; Source = source;
if (name != null && name.IndexOf(',') >= 0)
name = name.Replace(',', ' ');
Name = name; Name = name;
} }
@@ -0,0 +1,76 @@
using Disco.Models.Exporting;
using Disco.Models.Services.Exporting;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Services.Users.UserFlags
{
public class UserFlagExportOptions : IExportOptions
{
public ExportFormat Format { get; set; }
public string FilenamePrefix { get; } = "DiscoUserFlagExport";
public string ExcelWorksheetName { get; } = "UserFlagExport";
public string ExcelTableName { get; } = "UserFlags";
[Required]
public List<int> UserFlagIds { get; set; } = new List<int>();
[Display(Name = "Current Only")]
public bool CurrentOnly { get; set; }
// User Flag
[Display(ShortName = "User Flag", Name = "Identifier", Description = "The identifier of the user flag")]
public bool Id { get; set; }
[Display(ShortName = "User Flag", Name = "Name", Description = "The name of the user flag")]
public bool Name { get; set; }
[Display(ShortName = "User Flag", Name = "Description", Description = "The description of the user flag")]
public bool Description { get; set; }
[Display(ShortName = "User Flag", Name = "Icon", Description = "The icon assigned to the user flag")]
public bool Icon { get; set; }
[Display(ShortName = "User Flag", Name = "Icon Colour", Description = "The icon colour assigned to the user flag")]
public bool IconColour { get; set; }
[Display(ShortName = "User Flag", Name = "Assignment Identifier", Description = "The identifier of the user flag assignment")]
public bool AssignmentId { get; set; }
[Display(ShortName = "User Flag", Name = "Added Date", Description = "The date the user flag was assigned to the user")]
public bool AddedDate { get; set; }
[Display(ShortName = "User Flag", Name = "Added User Identifier", Description = "The identifier of the user who assigned the user flag")]
public bool AddedUserId { get; set; }
[Display(ShortName = "User Flag", Name = "Removed Date", Description = "The date the user flag was unassigned from the user")]
public bool RemovedDate { get; set; }
[Display(ShortName = "User Flag", Name = "Removed User Identifier", Description = "The identifier of the user who unassigned the user flag")]
public bool RemovedUserId { get; set; }
[Display(ShortName = "User Flag", Name = "Comments", Description = "The comments associated with the user flag assignment")]
public bool Comments { get; set; }
// User
[Display(ShortName = "User", Name = "Identifier", Description = "The identifier of the user assigned to the user flag")]
public bool UserId { get; set; }
[Display(ShortName = "User", Name = "Display Name", Description = "The display name of the user assigned to the user flag")]
public bool UserDisplayName { get; set; }
[Display(ShortName = "User", Name = "Surname", Description = "The surname of the user assigned to the user flag")]
public bool UserSurname { get; set; }
[Display(ShortName = "User", Name = "Given Name", Description = "The given name of the user assigned to the user flag")]
public bool UserGivenName { get; set; }
[Display(ShortName = "User", Name = "Phone Number", Description = "The phone number of the user assigned to the user flag")]
public bool UserPhoneNumber { get; set; }
[Display(ShortName = "User", Name = "Email Address", Description = "The email address of the user assigned to the user flag")]
public bool UserEmailAddress { get; set; }
[Display(ShortName = "User", Name = "Custom Details", Description = "The custom details provided by plugins for the user assigned to the user flag")]
public bool UserDetailCustom { get; set; }
public static UserFlagExportOptions DefaultOptions()
{
return new UserFlagExportOptions()
{
Format = ExportFormat.Xlsx,
CurrentOnly = true,
Name = true,
AddedDate = true,
UserId = true,
UserDisplayName = true,
Comments = true,
};
}
}
}
@@ -0,0 +1,12 @@
using Disco.Models.Exporting;
using Disco.Models.Repository;
using System.Collections.Generic;
namespace Disco.Models.Services.Users.UserFlags
{
public class UserFlagExportRecord : IExportRecord
{
public UserFlagAssignment Assignment { get; set; }
public Dictionary<string, string> UserCustomDetails { get; set; }
}
}
@@ -0,0 +1,7 @@
namespace Disco.Models.UI.Config.DeviceFlag
{
public interface ConfigDeviceFlagCreateModel : BaseUIModel
{
Repository.DeviceFlag DeviceFlag { get; set; }
}
}
@@ -0,0 +1,17 @@
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Models.Services.Exporting;
using Disco.Models.UI;
using System.Collections.Generic;
namespace Disco.Models.Areas.Config.UI.DeviceFlag
{
public interface ConfigDeviceFlagExportModel : BaseUIModel
{
DeviceFlagExportOptions Options { get; set; }
string ExportSessionId { get; set; }
ExportResult ExportSessionResult { get; set; }
List<Repository.DeviceFlag> DeviceFlags { get; set; }
}
}
@@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace Disco.Models.UI.Config.DeviceFlag
{
public interface ConfigDeviceFlagIndexModel : BaseUIModel
{
Dictionary<Repository.DeviceFlag, int> DeviceFlags { get; set; }
}
}
@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace Disco.Models.UI.Config.DeviceFlag
{
public interface ConfigDeviceFlagShowModel : BaseUIModel
{
Repository.DeviceFlag DeviceFlag { get; set; }
int CurrentAssignmentCount { get; set; }
int TotalAssignmentCount { get; set; }
IEnumerable<KeyValuePair<string, string>> Icons { get; set; }
IEnumerable<KeyValuePair<string, string>> ThemeColours { get; set; }
}
}
@@ -8,9 +8,11 @@ namespace Disco.Models.UI.Config.DeviceProfile
{ {
Repository.DeviceProfile DeviceProfile { get; set; } Repository.DeviceProfile DeviceProfile { get; set; }
OrganisationAddress DefaultOrganisationAddress { get; set; } OrganisationAddress DefaultOrganisationAddress { get; set; }
List<OrganisationAddress> OrganisationAddresses { get; set; } List<OrganisationAddress> OrganisationAddresses { get; set; }
string FriendlyOrganisationalUnitName { get; }
bool OrganisationalUnitExists { get; set; }
int DeviceCount { get; set; } int DeviceCount { get; set; }
int DeviceDecommissionedCount { get; set; } int DeviceDecommissionedCount { get; set; }
@@ -1,13 +1,8 @@
using System; namespace Disco.Models.UI.Config.Enrolment
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.UI.Config.Enrolment
{ {
public interface ConfigEnrolmentIndexModel : BaseUIModel public interface ConfigEnrolmentIndexModel : BaseUIModel
{ {
string MacSshUsername { get; set; } string MacSshUsername { get; set; }
int PendingTimeoutMinutes { get; set; }
} }
} }
@@ -0,0 +1,17 @@
using Disco.Models.Services.Exporting;
using Disco.Models.Services.Users.UserFlags;
using Disco.Models.UI;
using System.Collections.Generic;
namespace Disco.Models.Areas.Config.UI.UserFlag
{
public interface ConfigUserFlagExportModel : BaseUIModel
{
UserFlagExportOptions Options { get; set; }
string ExportSessionId { get; set; }
ExportResult ExportSessionResult { get; set; }
List<Repository.UserFlag> UserFlags { get; set; }
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
using Disco.Models.Services.Devices.Exporting; using Disco.Models.Services.Devices.Exporting;
using Disco.Models.Services.Exporting;
using System.Collections.Generic; using System.Collections.Generic;
namespace Disco.Models.UI.Device namespace Disco.Models.UI.Device
@@ -8,7 +9,7 @@ namespace Disco.Models.UI.Device
DeviceExportOptions Options { get; set; } DeviceExportOptions Options { get; set; }
string ExportSessionId { get; set; } string ExportSessionId { get; set; }
DeviceExportResult ExportSessionResult { get; set; } ExportResult ExportSessionResult { get; set; }
IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; } IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; }
IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; } IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; }
@@ -1,4 +1,5 @@
using Disco.Models.BI.Config; using Disco.Models.BI.Config;
using Disco.Models.Repository;
using Disco.Models.Services.Documents; using Disco.Models.Services.Documents;
using Disco.Models.Services.Jobs.JobLists; using Disco.Models.Services.Jobs.JobLists;
using System.Collections.Generic; using System.Collections.Generic;
@@ -10,9 +11,11 @@ namespace Disco.Models.UI.Device
Repository.Device Device { get; set; } Repository.Device Device { get; set; }
List<Repository.DeviceProfile> DeviceProfiles { get; set; } List<Repository.DeviceProfile> DeviceProfiles { get; set; }
HashSet<int> DecommissionedDeviceProfileIds { get; set; }
OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; } OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; }
List<Repository.DeviceBatch> DeviceBatches { get; set; } List<Repository.DeviceBatch> DeviceBatches { get; set; }
HashSet<int> DecommissionedDeviceBatchIds { get; set; }
JobTableModel Jobs { get; set; } JobTableModel Jobs { get; set; }
@@ -20,6 +23,9 @@ namespace Disco.Models.UI.Device
List<Repository.DocumentTemplate> DocumentTemplates { get; set; } List<Repository.DocumentTemplate> DocumentTemplates { get; set; }
List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; } List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; }
List<DeviceFlag> AvailableDeviceFlags { get; set; }
Dictionary<string, string> AssignedUserDetails { get; set; } Dictionary<string, string> AssignedUserDetails { get; set; }
bool HasAssignedUserPhoto { get; set; } bool HasAssignedUserPhoto { get; set; }
} }
+4 -1
View File
@@ -1,4 +1,6 @@
using Disco.Models.Services.Jobs.JobLists; using Disco.Models.ClientServices;
using Disco.Models.Services.Jobs.JobLists;
using System.Collections.Generic;
namespace Disco.Models.UI.Job namespace Disco.Models.UI.Job
{ {
@@ -6,5 +8,6 @@ namespace Disco.Models.UI.Job
{ {
JobTableModel MyJobs { get; set; } JobTableModel MyJobs { get; set; }
JobTableModel StaleJobs { get; set; } JobTableModel StaleJobs { get; set; }
List<EnrolResponse> PendingEnrollments { get; set; }
} }
} }
@@ -1,37 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" /> <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" /> <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" /> <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Microsoft.AspNet.SignalR.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="Microsoft.AspNet.SignalR.Core" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0" /> <bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
@@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Disco.Services.Plugins.ManifestGenerator</RootNamespace> <RootNamespace>Disco.Services.Plugins.ManifestGenerator</RootNamespace>
<AssemblyName>Disco.Services.Plugins.ManifestGenerator</AssemblyName> <AssemblyName>Disco.Services.Plugins.ManifestGenerator</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -25,7 +25,7 @@ namespace Disco.Services.Plugins.ManifestGenerator
throw new ArgumentException($"File not found at: {assemblyFileInfo.FullName}"); throw new ArgumentException($"File not found at: {assemblyFileInfo.FullName}");
} }
Console.WriteLine("Disco Plugin: Generating Manifest"); Console.WriteLine("Disco ICT Plugin: Generating Manifest");
AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad; AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad;
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
@@ -55,7 +55,7 @@ namespace Disco.Services.Plugins.ManifestGenerator
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"Disco Plugin: Warning: Unable to load reference '{referenceAssembly.FullName}'; {ex.Message}"); Console.WriteLine($"Disco ICT Plugin: Warning: Unable to load reference '{referenceAssembly.FullName}'; {ex.Message}");
} }
} }
} }
@@ -68,9 +68,9 @@ namespace Disco.Services.Plugins.ManifestGenerator
File.WriteAllText(manifestFilePath, manifest.ToManifestFile()); File.WriteAllText(manifestFilePath, manifest.ToManifestFile());
Console.WriteLine("Disco Plugin: Manifest Created"); Console.WriteLine("Disco ICT Plugin: Manifest Created");
Console.WriteLine("Disco Plugin: Building Package"); Console.WriteLine("Disco ICT Plugin: Building Package");
var packageFileName = $"{manifest.Id}-{manifest.Version}.discoPlugin"; var packageFileName = $"{manifest.Id}-{manifest.Version}.discoPlugin";
var packageFilePath = Path.Combine(assemblyFileInfo.DirectoryName, packageFileName); var packageFilePath = Path.Combine(assemblyFileInfo.DirectoryName, packageFileName);
@@ -81,7 +81,7 @@ namespace Disco.Services.Plugins.ManifestGenerator
existingPackages.Delete(); existingPackages.Delete();
} }
// Exclude Disco Provided Assemblies // Exclude Disco ICT Provided Assemblies
List<string> excludedFiles = PluginManifest.PluginExcludedAssemblies.ToList(); List<string> excludedFiles = PluginManifest.PluginExcludedAssemblies.ToList();
// Exclude the Package File // Exclude the Package File
@@ -95,7 +95,7 @@ namespace Disco.Services.Plugins.ManifestGenerator
} }
} }
Console.WriteLine($"Disco Plugin: Package Build: '{packageFileName}'"); Console.WriteLine($"Disco ICT Plugin: Package Build: '{packageFileName}'");
} }
@@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.16326.0500")] [assembly: AssemblyVersion("2.4.24270.0000")]
[assembly: AssemblyFileVersion("2.0.16326.0500")] [assembly: AssemblyFileVersion("2.4.24270.0000")]
+1 -1
View File
@@ -12,7 +12,7 @@
</defaultConnectionFactory> </defaultConnectionFactory>
</entityFramework> </entityFramework>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -19,7 +19,7 @@ namespace Disco.Services.Authorization
{ {
if (message == null) if (message == null)
{ {
return "Your account does not have the required permission to access this Disco feature."; return "Your account does not have the required permission to access this Disco ICT feature.";
} }
else else
{ {
@@ -44,7 +44,7 @@ namespace Disco.Services.Authorization
#region Token Accessors #region Token Accessors
internal const string RequireAuthenticationMessage = "This feature requires authentication."; internal const string RequireAuthenticationMessage = "This feature requires authentication.";
internal const string RequireDiscoAuthorizationMessage = "Your account does not have the required permission to access this feature. This feature requires your account to be included in at least one Disco Authorization Role."; internal const string RequireDiscoAuthorizationMessage = "Your account does not have the required permission to access this feature. This feature requires your account to be included in at least one Disco ICT Authorization Role.";
internal const string RequireMessageTemplate = "Your account does not have the required permission to access this feature.\r\n"; internal const string RequireMessageTemplate = "Your account does not have the required permission to access this feature.\r\n";
internal const string RequireMessageSingleTemplate = RequireMessageTemplate + "This feature requires the following permission:\r\n- {0}"; internal const string RequireMessageSingleTemplate = RequireMessageTemplate + "This feature requires the following permission:\r\n- {0}";
internal const string RequireAllMessageTemplate = RequireMessageTemplate + "This feature requires permission for:\r\n- {0}"; internal const string RequireAllMessageTemplate = RequireMessageTemplate + "This feature requires permission for:\r\n- {0}";
+104 -10
View File
@@ -1,7 +1,4 @@
 // <auto-generated />
// <auto-generated />
// This file was generated by a T4 template. // This file was generated by a T4 template.
// Don't change it directly as your change would get overwritten. Instead, make changes // Don't change it directly as your change would get overwritten. Instead, make changes
// to the .tt file (i.e. the T4 template) and save it to regenerate this file. // to the .tt file (i.e. the T4 template) and save it to regenerate this file.
@@ -34,6 +31,11 @@ namespace Disco.Services.Authorization
{ "Config.DeviceBatch.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.Delete, (c, v) => c.Config.DeviceBatch.Delete = v, "Delete Device Batches", "Can delete device batches", false) }, { "Config.DeviceBatch.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.Delete, (c, v) => c.Config.DeviceBatch.Delete = v, "Delete Device Batches", "Can delete device batches", false) },
{ "Config.DeviceBatch.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.Show, (c, v) => c.Config.DeviceBatch.Show = v, "Show Device Batches", "Can show device batches", false) }, { "Config.DeviceBatch.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.Show, (c, v) => c.Config.DeviceBatch.Show = v, "Show Device Batches", "Can show device batches", false) },
{ "Config.DeviceBatch.ShowTimeline", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.ShowTimeline, (c, v) => c.Config.DeviceBatch.ShowTimeline = v, "Show Timeline", "Can show device batch timeline", false) }, { "Config.DeviceBatch.ShowTimeline", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.ShowTimeline, (c, v) => c.Config.DeviceBatch.ShowTimeline = v, "Show Timeline", "Can show device batch timeline", false) },
{ "Config.DeviceFlag.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Configure, (c, v) => c.Config.DeviceFlag.Configure = v, "Configure Device Flags", "Can configure device flags", false) },
{ "Config.DeviceFlag.Create", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Create, (c, v) => c.Config.DeviceFlag.Create = v, "Create Device Flags", "Can create device flags", false) },
{ "Config.DeviceFlag.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Delete, (c, v) => c.Config.DeviceFlag.Delete = v, "Delete Device Flags", "Can delete device flags", false) },
{ "Config.DeviceFlag.Export", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Export, (c, v) => c.Config.DeviceFlag.Export = v, "Export Device Flag Assignments", "Can export user device assignments", false) },
{ "Config.DeviceFlag.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Show, (c, v) => c.Config.DeviceFlag.Show = v, "Show Device Flags", "Can show device flags", false) },
{ "Config.DeviceModel.ConfigureComponents", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.ConfigureComponents, (c, v) => c.Config.DeviceModel.ConfigureComponents = v, "Configure Device Model Components", "Can configure device model components", false) }, { "Config.DeviceModel.ConfigureComponents", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.ConfigureComponents, (c, v) => c.Config.DeviceModel.ConfigureComponents = v, "Configure Device Model Components", "Can configure device model components", false) },
{ "Config.DeviceModel.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.Configure, (c, v) => c.Config.DeviceModel.Configure = v, "Configure Device Models", "Can configure device models", false) }, { "Config.DeviceModel.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.Configure, (c, v) => c.Config.DeviceModel.Configure = v, "Configure Device Models", "Can configure device models", false) },
{ "Config.DeviceModel.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.Delete, (c, v) => c.Config.DeviceModel.Delete = v, "Delete Device Models", "Can delete device models", false) }, { "Config.DeviceModel.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.Delete, (c, v) => c.Config.DeviceModel.Delete = v, "Delete Device Models", "Can delete device models", false) },
@@ -77,6 +79,7 @@ namespace Disco.Services.Authorization
{ "Config.UserFlag.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Configure, (c, v) => c.Config.UserFlag.Configure = v, "Configure User Flags", "Can configure user flags", false) }, { "Config.UserFlag.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Configure, (c, v) => c.Config.UserFlag.Configure = v, "Configure User Flags", "Can configure user flags", false) },
{ "Config.UserFlag.Create", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Create, (c, v) => c.Config.UserFlag.Create = v, "Create User Flags", "Can create user flags", false) }, { "Config.UserFlag.Create", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Create, (c, v) => c.Config.UserFlag.Create = v, "Create User Flags", "Can create user flags", false) },
{ "Config.UserFlag.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Delete, (c, v) => c.Config.UserFlag.Delete = v, "Delete User Flags", "Can delete user flags", false) }, { "Config.UserFlag.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Delete, (c, v) => c.Config.UserFlag.Delete = v, "Delete User Flags", "Can delete user flags", false) },
{ "Config.UserFlag.Export", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Export, (c, v) => c.Config.UserFlag.Export = v, "Export User Flag Assignments", "Can export user flag assignments", false) },
{ "Config.UserFlag.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Show, (c, v) => c.Config.UserFlag.Show = v, "Show User Flags", "Can show user flags", false) }, { "Config.UserFlag.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.UserFlag.Show, (c, v) => c.Config.UserFlag.Show = v, "Show User Flags", "Can show user flags", false) },
{ "Config.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.Show, (c, v) => c.Config.Show = v, "Show Configuration", "Can show the configuration menu", false) }, { "Config.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.Show, (c, v) => c.Config.Show = v, "Show Configuration", "Can show the configuration menu", false) },
{ "Job.Lists.AllOpen", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Lists.AllOpen, (c, v) => c.Job.Lists.AllOpen = v, "All Open List", "Can show list", false) }, { "Job.Lists.AllOpen", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Lists.AllOpen, (c, v) => c.Job.Lists.AllOpen = v, "All Open List", "Can show list", false) },
@@ -106,6 +109,7 @@ namespace Disco.Services.Authorization
{ "Job.Actions.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.Delete, (c, v) => c.Job.Actions.Delete = v, "Delete Jobs", "Can delete jobs", false) }, { "Job.Actions.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.Delete, (c, v) => c.Job.Actions.Delete = v, "Delete Jobs", "Can delete jobs", false) },
{ "Job.Actions.ForceClose", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.ForceClose, (c, v) => c.Job.Actions.ForceClose = v, "Force Close Jobs", "Can force close jobs", false) }, { "Job.Actions.ForceClose", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.ForceClose, (c, v) => c.Job.Actions.ForceClose = v, "Force Close Jobs", "Can force close jobs", false) },
{ "Job.Actions.GenerateDocuments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.GenerateDocuments, (c, v) => c.Job.Actions.GenerateDocuments = v, "Generate Documents", "Can generate documents for jobs", false) }, { "Job.Actions.GenerateDocuments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.GenerateDocuments, (c, v) => c.Job.Actions.GenerateDocuments = v, "Generate Documents", "Can generate documents for jobs", false) },
{ "Job.Actions.LogInsurance", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.LogInsurance, (c, v) => c.Job.Actions.LogInsurance = v, "Log Insurance", "Can log insurance for non-warranty jobs", false) },
{ "Job.Actions.LogRepair", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.LogRepair, (c, v) => c.Job.Actions.LogRepair = v, "Log Repair", "Can log repair for non-warranty jobs", false) }, { "Job.Actions.LogRepair", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.LogRepair, (c, v) => c.Job.Actions.LogRepair = v, "Log Repair", "Can log repair for non-warranty jobs", false) },
{ "Job.Actions.LogWarranty", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.LogWarranty, (c, v) => c.Job.Actions.LogWarranty = v, "Log Warranty", "Can log warranty for jobs", false) }, { "Job.Actions.LogWarranty", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.LogWarranty, (c, v) => c.Job.Actions.LogWarranty = v, "Log Warranty", "Can log warranty for jobs", false) },
{ "Job.Actions.RemoveAnyAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.RemoveAnyAttachments, (c, v) => c.Job.Actions.RemoveAnyAttachments = v, "Remove Any Attachments", "Can remove any attachments from jobs", false) }, { "Job.Actions.RemoveAnyAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Actions.RemoveAnyAttachments, (c, v) => c.Job.Actions.RemoveAnyAttachments = v, "Remove Any Attachments", "Can remove any attachments from jobs", false) },
@@ -130,7 +134,7 @@ namespace Disco.Services.Authorization
{ "Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent, (c, v) => c.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent = v, "Insurance Claim Form Sent Property", "Can update property", false) }, { "Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent, (c, v) => c.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent = v, "Insurance Claim Form Sent Property", "Can update property", false) },
{ "Job.Properties.NonWarrantyProperties.InsuranceDetails", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.InsuranceDetails, (c, v) => c.Job.Properties.NonWarrantyProperties.InsuranceDetails = v, "Insurance Detail Properties", "Can update insurance detail properties", false) }, { "Job.Properties.NonWarrantyProperties.InsuranceDetails", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.InsuranceDetails, (c, v) => c.Job.Properties.NonWarrantyProperties.InsuranceDetails = v, "Insurance Detail Properties", "Can update insurance detail properties", false) },
{ "Job.Properties.NonWarrantyProperties.InvoiceReceived", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.InvoiceReceived, (c, v) => c.Job.Properties.NonWarrantyProperties.InvoiceReceived = v, "Invoice Received Property", "Can update property", false) }, { "Job.Properties.NonWarrantyProperties.InvoiceReceived", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.InvoiceReceived, (c, v) => c.Job.Properties.NonWarrantyProperties.InvoiceReceived = v, "Invoice Received Property", "Can update property", false) },
{ "Job.Properties.NonWarrantyProperties.IsInsuranceClaim", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.IsInsuranceClaim, (c, v) => c.Job.Properties.NonWarrantyProperties.IsInsuranceClaim = v, "Is Insurance Claim Property", "Can update property", false) }, { "Job.Properties.NonWarrantyProperties.IsInsuranceClaim", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.IsInsuranceClaim, (c, v) => c.Job.Properties.NonWarrantyProperties.IsInsuranceClaim = v, "Is Insurance Claim Property", "Can update property", false) },
{ "Job.Properties.NonWarrantyProperties.PurchaseOrderRaised", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised, (c, v) => c.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised = v, "Purchase Order Raised Property", "Can update property", false) }, { "Job.Properties.NonWarrantyProperties.PurchaseOrderRaised", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised, (c, v) => c.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised = v, "Purchase Order Raised Property", "Can update property", false) },
{ "Job.Properties.NonWarrantyProperties.PurchaseOrderReference", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.PurchaseOrderReference, (c, v) => c.Job.Properties.NonWarrantyProperties.PurchaseOrderReference = v, "Purchase Order Reference Property", "Can update property", false) }, { "Job.Properties.NonWarrantyProperties.PurchaseOrderReference", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.PurchaseOrderReference, (c, v) => c.Job.Properties.NonWarrantyProperties.PurchaseOrderReference = v, "Purchase Order Reference Property", "Can update property", false) },
{ "Job.Properties.NonWarrantyProperties.PurchaseOrderSent", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.PurchaseOrderSent, (c, v) => c.Job.Properties.NonWarrantyProperties.PurchaseOrderSent = v, "Purchase Order Sent Property", "Can update property", false) }, { "Job.Properties.NonWarrantyProperties.PurchaseOrderSent", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.PurchaseOrderSent, (c, v) => c.Job.Properties.NonWarrantyProperties.PurchaseOrderSent = v, "Purchase Order Sent Property", "Can update property", false) },
@@ -185,22 +189,26 @@ namespace Disco.Services.Authorization
{ "Device.Properties.DeviceProfile", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Properties.DeviceProfile, (c, v) => c.Device.Properties.DeviceProfile = v, "Device Profile Property", "Can update property", false) }, { "Device.Properties.DeviceProfile", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Properties.DeviceProfile, (c, v) => c.Device.Properties.DeviceProfile = v, "Device Profile Property", "Can update property", false) },
{ "Device.Properties.Location", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Properties.Location, (c, v) => c.Device.Properties.Location = v, "Location Property", "Can update property", false) }, { "Device.Properties.Location", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Properties.Location, (c, v) => c.Device.Properties.Location = v, "Location Property", "Can update property", false) },
{ "Device.Actions.AddAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AddAttachments, (c, v) => c.Device.Actions.AddAttachments = v, "Add Attachments", "Can add attachments to devices", false) }, { "Device.Actions.AddAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AddAttachments, (c, v) => c.Device.Actions.AddAttachments = v, "Add Attachments", "Can add attachments to devices", false) },
{ "Device.Actions.AddFlags", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AddFlags, (c, v) => c.Device.Actions.AddFlags = v, "Add Device Flags", "Can add device flags", false) },
{ "Device.Actions.AllowUnauthenticatedEnrol", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AllowUnauthenticatedEnrol, (c, v) => c.Device.Actions.AllowUnauthenticatedEnrol = v, "Allow Unauthenticated Enrol", "Can allow devices to enrol without authentication", false) }, { "Device.Actions.AllowUnauthenticatedEnrol", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AllowUnauthenticatedEnrol, (c, v) => c.Device.Actions.AllowUnauthenticatedEnrol = v, "Allow Unauthenticated Enrol", "Can allow devices to enrol without authentication", false) },
{ "Device.Actions.AssignUser", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AssignUser, (c, v) => c.Device.Actions.AssignUser = v, "Assign User", "Can update the user assignment of devices", false) }, { "Device.Actions.AssignUser", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AssignUser, (c, v) => c.Device.Actions.AssignUser = v, "Assign User", "Can update the user assignment of devices", false) },
{ "Device.Actions.Decommission", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Decommission, (c, v) => c.Device.Actions.Decommission = v, "Decommission", "Can decommission devices", false) }, { "Device.Actions.Decommission", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Decommission, (c, v) => c.Device.Actions.Decommission = v, "Decommission", "Can decommission devices", false) },
{ "Device.Actions.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Delete, (c, v) => c.Device.Actions.Delete = v, "Delete", "Can delete devices", false) }, { "Device.Actions.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Delete, (c, v) => c.Device.Actions.Delete = v, "Delete", "Can delete devices", false) },
{ "Device.Actions.EditFlags", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.EditFlags, (c, v) => c.Device.Actions.EditFlags = v, "Edit Device Flags", "Can edit device flags", false) },
{ "Device.Actions.EnrolDevices", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.EnrolDevices, (c, v) => c.Device.Actions.EnrolDevices = v, "Enrol Devices", "Can add devices offline and enrol devices with the Bootstrapper", false) }, { "Device.Actions.EnrolDevices", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.EnrolDevices, (c, v) => c.Device.Actions.EnrolDevices = v, "Enrol Devices", "Can add devices offline and enrol devices with the Bootstrapper", false) },
{ "Device.Actions.Export", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Export, (c, v) => c.Device.Actions.Export = v, "Export Devices", "Can export devices in a bulk format", false) }, { "Device.Actions.Export", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Export, (c, v) => c.Device.Actions.Export = v, "Export Devices", "Can export devices in a bulk format", false) },
{ "Device.Actions.GenerateDocuments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.GenerateDocuments, (c, v) => c.Device.Actions.GenerateDocuments = v, "Generate Documents", "Can generate documents for jobs", false) }, { "Device.Actions.GenerateDocuments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.GenerateDocuments, (c, v) => c.Device.Actions.GenerateDocuments = v, "Generate Documents", "Can generate documents for jobs", false) },
{ "Device.Actions.Import", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Import, (c, v) => c.Device.Actions.Import = v, "Import Devices", "Can bulk import devices", false) }, { "Device.Actions.Import", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Import, (c, v) => c.Device.Actions.Import = v, "Import Devices", "Can bulk import devices", false) },
{ "Device.Actions.Recommission", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Recommission, (c, v) => c.Device.Actions.Recommission = v, "Recommission", "Can recommission devices", false) }, { "Device.Actions.Recommission", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Recommission, (c, v) => c.Device.Actions.Recommission = v, "Recommission", "Can recommission devices", false) },
{ "Device.Actions.RemoveAnyAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.RemoveAnyAttachments, (c, v) => c.Device.Actions.RemoveAnyAttachments = v, "Remove Any Attachments", "Can remove any attachments from devices", false) }, { "Device.Actions.RemoveAnyAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.RemoveAnyAttachments, (c, v) => c.Device.Actions.RemoveAnyAttachments = v, "Remove Any Attachments", "Can remove any attachments from devices", false) },
{ "Device.Actions.RemoveFlags", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.RemoveFlags, (c, v) => c.Device.Actions.RemoveFlags = v, "Remove Device Flags", "Can remove device flags", false) },
{ "Device.Actions.RemoveOwnAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.RemoveOwnAttachments, (c, v) => c.Device.Actions.RemoveOwnAttachments = v, "Remove Own Attachments", "Can remove own attachments from devices", false) }, { "Device.Actions.RemoveOwnAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.RemoveOwnAttachments, (c, v) => c.Device.Actions.RemoveOwnAttachments = v, "Remove Own Attachments", "Can remove own attachments from devices", false) },
{ "Device.Search", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Search, (c, v) => c.Device.Search = v, "Search Devices", "Can search devices", false) }, { "Device.Search", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Search, (c, v) => c.Device.Search = v, "Search Devices", "Can search devices", false) },
{ "Device.ShowAssignmentHistory", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowAssignmentHistory, (c, v) => c.Device.ShowAssignmentHistory = v, "Show Assignment History", "Can show the assignment history for devices", false) }, { "Device.ShowAssignmentHistory", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowAssignmentHistory, (c, v) => c.Device.ShowAssignmentHistory = v, "Show Assignment History", "Can show the assignment history for devices", false) },
{ "Device.ShowAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowAttachments, (c, v) => c.Device.ShowAttachments = v, "Show Attachments", "Can show device attachments", false) }, { "Device.ShowAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowAttachments, (c, v) => c.Device.ShowAttachments = v, "Show Attachments", "Can show device attachments", false) },
{ "Device.ShowCertificates", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowCertificates, (c, v) => c.Device.ShowCertificates = v, "Show Certificates", "Can show certificates associated with devices", false) }, { "Device.ShowCertificates", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowCertificates, (c, v) => c.Device.ShowCertificates = v, "Show Certificates", "Can show certificates associated with devices", false) },
{ "Device.ShowDetails", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowDetails, (c, v) => c.Device.ShowDetails = v, "Show Details", "Can show details associated with devices", false) }, { "Device.ShowDetails", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowDetails, (c, v) => c.Device.ShowDetails = v, "Show Details", "Can show details associated with devices", false) },
{ "Device.ShowFlagAssignments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowFlagAssignments, (c, v) => c.Device.ShowFlagAssignments = v, "Show Device Flag Assignments", "Can show flags associated with devices", false) },
{ "Device.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Show, (c, v) => c.Device.Show = v, "Show Devices", "Can show devices", false) }, { "Device.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Show, (c, v) => c.Device.Show = v, "Show Devices", "Can show devices", false) },
{ "Device.ShowJobs", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowJobs, (c, v) => c.Device.ShowJobs = v, "Show Devices Jobs", "Can show jobs associated with devices", false) }, { "Device.ShowJobs", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowJobs, (c, v) => c.Device.ShowJobs = v, "Show Devices Jobs", "Can show jobs associated with devices", false) },
{ "User.Actions.AddAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.User.Actions.AddAttachments, (c, v) => c.User.Actions.AddAttachments = v, "Add Attachments", "Can add attachments to users", false) }, { "User.Actions.AddAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.User.Actions.AddAttachments, (c, v) => c.User.Actions.AddAttachments = v, "Add Attachments", "Can add attachments to users", false) },
@@ -220,14 +228,14 @@ namespace Disco.Services.Authorization
{ "User.ShowFlagAssignments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.User.ShowFlagAssignments, (c, v) => c.User.ShowFlagAssignments = v, "Show Users Flag Assignments", "Can show flags associated with users", false) }, { "User.ShowFlagAssignments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.User.ShowFlagAssignments, (c, v) => c.User.ShowFlagAssignments = v, "Show Users Flag Assignments", "Can show flags associated with users", false) },
{ "User.ShowJobs", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.User.ShowJobs, (c, v) => c.User.ShowJobs = v, "Show Users Jobs", "Can show jobs associated with users", false) }, { "User.ShowJobs", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.User.ShowJobs, (c, v) => c.User.ShowJobs = v, "Show Users Jobs", "Can show jobs associated with users", false) },
{ "ComputerAccount", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.ComputerAccount, (c, v) => c.ComputerAccount = v, "Computer Account", "Represents a computer account", true) }, { "ComputerAccount", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.ComputerAccount, (c, v) => c.ComputerAccount = v, "Computer Account", "Represents a computer account", true) },
{ "DiscoAdminAccount", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.DiscoAdminAccount, (c, v) => c.DiscoAdminAccount = v, "Disco Administrator Account", "Represents a Disco Administrator account", true) } { "DiscoAdminAccount", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.DiscoAdminAccount, (c, v) => c.DiscoAdminAccount = v, "Disco Administrator Account", "Represents a Disco ICT Administrator account", true) }
}; };
#endregion #endregion
#region Role Claim Navigator #region Role Claim Navigator
_claimNavigator = _claimNavigator =
new ClaimNavigatorItem("Claims", "Permissions", "Top-level node for all permissions", false, new List<IClaimNavigatorItem>() { new ClaimNavigatorItem("Claims", "Permissions", "Top-level node for all permissions", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config", "Configuration", "Permissions related to Disco Configuration", false, new List<IClaimNavigatorItem>() { new ClaimNavigatorItem("Config", "Configuration", "Permissions related to Disco ICT Configuration", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.DeviceBatch", "Device Batches", "Permissions related to Device Batches", false, new List<IClaimNavigatorItem>() { new ClaimNavigatorItem("Config.DeviceBatch", "Device Batches", "Permissions related to Device Batches", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.DeviceBatch.Configure", false), new ClaimNavigatorItem("Config.DeviceBatch.Configure", false),
new ClaimNavigatorItem("Config.DeviceBatch.Create", false), new ClaimNavigatorItem("Config.DeviceBatch.Create", false),
@@ -238,6 +246,13 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Config.DeviceCertificate", "Device Certificates", "Permissions related to Device Certificates", false, new List<IClaimNavigatorItem>() { new ClaimNavigatorItem("Config.DeviceCertificate", "Device Certificates", "Permissions related to Device Certificates", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.DeviceCertificate.DownloadCertificates", false) new ClaimNavigatorItem("Config.DeviceCertificate.DownloadCertificates", false)
}), }),
new ClaimNavigatorItem("Config.DeviceFlag", "Device Flags", "Permissions related to Device Flags", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.DeviceFlag.Configure", false),
new ClaimNavigatorItem("Config.DeviceFlag.Create", false),
new ClaimNavigatorItem("Config.DeviceFlag.Delete", false),
new ClaimNavigatorItem("Config.DeviceFlag.Export", false),
new ClaimNavigatorItem("Config.DeviceFlag.Show", false)
}),
new ClaimNavigatorItem("Config.DeviceModel", "Device Models", "Permissions related to Device Models", false, new List<IClaimNavigatorItem>() { new ClaimNavigatorItem("Config.DeviceModel", "Device Models", "Permissions related to Device Models", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.DeviceModel.ConfigureComponents", false), new ClaimNavigatorItem("Config.DeviceModel.ConfigureComponents", false),
new ClaimNavigatorItem("Config.DeviceModel.Configure", false), new ClaimNavigatorItem("Config.DeviceModel.Configure", false),
@@ -306,6 +321,7 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Config.UserFlag.Configure", false), new ClaimNavigatorItem("Config.UserFlag.Configure", false),
new ClaimNavigatorItem("Config.UserFlag.Create", false), new ClaimNavigatorItem("Config.UserFlag.Create", false),
new ClaimNavigatorItem("Config.UserFlag.Delete", false), new ClaimNavigatorItem("Config.UserFlag.Delete", false),
new ClaimNavigatorItem("Config.UserFlag.Export", false),
new ClaimNavigatorItem("Config.UserFlag.Show", false) new ClaimNavigatorItem("Config.UserFlag.Show", false)
}), }),
new ClaimNavigatorItem("Config.Show", false) new ClaimNavigatorItem("Config.Show", false)
@@ -322,6 +338,7 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Job.Actions.Delete", false), new ClaimNavigatorItem("Job.Actions.Delete", false),
new ClaimNavigatorItem("Job.Actions.ForceClose", false), new ClaimNavigatorItem("Job.Actions.ForceClose", false),
new ClaimNavigatorItem("Job.Actions.GenerateDocuments", false), new ClaimNavigatorItem("Job.Actions.GenerateDocuments", false),
new ClaimNavigatorItem("Job.Actions.LogInsurance", false),
new ClaimNavigatorItem("Job.Actions.LogRepair", false), new ClaimNavigatorItem("Job.Actions.LogRepair", false),
new ClaimNavigatorItem("Job.Actions.LogWarranty", false), new ClaimNavigatorItem("Job.Actions.LogWarranty", false),
new ClaimNavigatorItem("Job.Actions.RemoveAnyAttachments", false), new ClaimNavigatorItem("Job.Actions.RemoveAnyAttachments", false),
@@ -429,16 +446,19 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Device", "Device", "Permissions related to Devices", false, new List<IClaimNavigatorItem>() { new ClaimNavigatorItem("Device", "Device", "Permissions related to Devices", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Device.Actions", "Actions", "Permissions related to Device Actions", false, new List<IClaimNavigatorItem>() { new ClaimNavigatorItem("Device.Actions", "Actions", "Permissions related to Device Actions", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Device.Actions.AddAttachments", false), new ClaimNavigatorItem("Device.Actions.AddAttachments", false),
new ClaimNavigatorItem("Device.Actions.AddFlags", false),
new ClaimNavigatorItem("Device.Actions.AllowUnauthenticatedEnrol", false), new ClaimNavigatorItem("Device.Actions.AllowUnauthenticatedEnrol", false),
new ClaimNavigatorItem("Device.Actions.AssignUser", false), new ClaimNavigatorItem("Device.Actions.AssignUser", false),
new ClaimNavigatorItem("Device.Actions.Decommission", false), new ClaimNavigatorItem("Device.Actions.Decommission", false),
new ClaimNavigatorItem("Device.Actions.Delete", false), new ClaimNavigatorItem("Device.Actions.Delete", false),
new ClaimNavigatorItem("Device.Actions.EditFlags", false),
new ClaimNavigatorItem("Device.Actions.EnrolDevices", false), new ClaimNavigatorItem("Device.Actions.EnrolDevices", false),
new ClaimNavigatorItem("Device.Actions.Export", false), new ClaimNavigatorItem("Device.Actions.Export", false),
new ClaimNavigatorItem("Device.Actions.GenerateDocuments", false), new ClaimNavigatorItem("Device.Actions.GenerateDocuments", false),
new ClaimNavigatorItem("Device.Actions.Import", false), new ClaimNavigatorItem("Device.Actions.Import", false),
new ClaimNavigatorItem("Device.Actions.Recommission", false), new ClaimNavigatorItem("Device.Actions.Recommission", false),
new ClaimNavigatorItem("Device.Actions.RemoveAnyAttachments", false), new ClaimNavigatorItem("Device.Actions.RemoveAnyAttachments", false),
new ClaimNavigatorItem("Device.Actions.RemoveFlags", false),
new ClaimNavigatorItem("Device.Actions.RemoveOwnAttachments", false) new ClaimNavigatorItem("Device.Actions.RemoveOwnAttachments", false)
}), }),
new ClaimNavigatorItem("Device.Properties", "Device Properties", "Permissions related to Device Properties", false, new List<IClaimNavigatorItem>() { new ClaimNavigatorItem("Device.Properties", "Device Properties", "Permissions related to Device Properties", false, new List<IClaimNavigatorItem>() {
@@ -453,6 +473,7 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Device.ShowAttachments", false), new ClaimNavigatorItem("Device.ShowAttachments", false),
new ClaimNavigatorItem("Device.ShowCertificates", false), new ClaimNavigatorItem("Device.ShowCertificates", false),
new ClaimNavigatorItem("Device.ShowDetails", false), new ClaimNavigatorItem("Device.ShowDetails", false),
new ClaimNavigatorItem("Device.ShowFlagAssignments", false),
new ClaimNavigatorItem("Device.Show", false), new ClaimNavigatorItem("Device.Show", false),
new ClaimNavigatorItem("Device.ShowJobs", false) new ClaimNavigatorItem("Device.ShowJobs", false)
}), }),
@@ -550,6 +571,11 @@ namespace Disco.Services.Authorization
c.Config.DeviceBatch.Delete = true; c.Config.DeviceBatch.Delete = true;
c.Config.DeviceBatch.Show = true; c.Config.DeviceBatch.Show = true;
c.Config.DeviceBatch.ShowTimeline = true; c.Config.DeviceBatch.ShowTimeline = true;
c.Config.DeviceFlag.Configure = true;
c.Config.DeviceFlag.Create = true;
c.Config.DeviceFlag.Delete = true;
c.Config.DeviceFlag.Export = true;
c.Config.DeviceFlag.Show = true;
c.Config.DeviceModel.ConfigureComponents = true; c.Config.DeviceModel.ConfigureComponents = true;
c.Config.DeviceModel.Configure = true; c.Config.DeviceModel.Configure = true;
c.Config.DeviceModel.Delete = true; c.Config.DeviceModel.Delete = true;
@@ -593,6 +619,7 @@ namespace Disco.Services.Authorization
c.Config.UserFlag.Configure = true; c.Config.UserFlag.Configure = true;
c.Config.UserFlag.Create = true; c.Config.UserFlag.Create = true;
c.Config.UserFlag.Delete = true; c.Config.UserFlag.Delete = true;
c.Config.UserFlag.Export = true;
c.Config.UserFlag.Show = true; c.Config.UserFlag.Show = true;
c.Config.Show = true; c.Config.Show = true;
c.Job.Lists.AllOpen = true; c.Job.Lists.AllOpen = true;
@@ -622,6 +649,7 @@ namespace Disco.Services.Authorization
c.Job.Actions.Delete = true; c.Job.Actions.Delete = true;
c.Job.Actions.ForceClose = true; c.Job.Actions.ForceClose = true;
c.Job.Actions.GenerateDocuments = true; c.Job.Actions.GenerateDocuments = true;
c.Job.Actions.LogInsurance = true;
c.Job.Actions.LogRepair = true; c.Job.Actions.LogRepair = true;
c.Job.Actions.LogWarranty = true; c.Job.Actions.LogWarranty = true;
c.Job.Actions.RemoveAnyAttachments = true; c.Job.Actions.RemoveAnyAttachments = true;
@@ -701,22 +729,26 @@ namespace Disco.Services.Authorization
c.Device.Properties.DeviceProfile = true; c.Device.Properties.DeviceProfile = true;
c.Device.Properties.Location = true; c.Device.Properties.Location = true;
c.Device.Actions.AddAttachments = true; c.Device.Actions.AddAttachments = true;
c.Device.Actions.AddFlags = true;
c.Device.Actions.AllowUnauthenticatedEnrol = true; c.Device.Actions.AllowUnauthenticatedEnrol = true;
c.Device.Actions.AssignUser = true; c.Device.Actions.AssignUser = true;
c.Device.Actions.Decommission = true; c.Device.Actions.Decommission = true;
c.Device.Actions.Delete = true; c.Device.Actions.Delete = true;
c.Device.Actions.EditFlags = true;
c.Device.Actions.EnrolDevices = true; c.Device.Actions.EnrolDevices = true;
c.Device.Actions.Export = true; c.Device.Actions.Export = true;
c.Device.Actions.GenerateDocuments = true; c.Device.Actions.GenerateDocuments = true;
c.Device.Actions.Import = true; c.Device.Actions.Import = true;
c.Device.Actions.Recommission = true; c.Device.Actions.Recommission = true;
c.Device.Actions.RemoveAnyAttachments = true; c.Device.Actions.RemoveAnyAttachments = true;
c.Device.Actions.RemoveFlags = true;
c.Device.Actions.RemoveOwnAttachments = true; c.Device.Actions.RemoveOwnAttachments = true;
c.Device.Search = true; c.Device.Search = true;
c.Device.ShowAssignmentHistory = true; c.Device.ShowAssignmentHistory = true;
c.Device.ShowAttachments = true; c.Device.ShowAttachments = true;
c.Device.ShowCertificates = true; c.Device.ShowCertificates = true;
c.Device.ShowDetails = true; c.Device.ShowDetails = true;
c.Device.ShowFlagAssignments = true;
c.Device.Show = true; c.Device.Show = true;
c.Device.ShowJobs = true; c.Device.ShowJobs = true;
c.User.Actions.AddAttachments = true; c.User.Actions.AddAttachments = true;
@@ -749,7 +781,7 @@ namespace Disco.Services.Authorization
#region Role Claim Constants #region Role Claim Constants
/// <summary>Configuration /// <summary>Configuration
/// <para>Permissions related to Disco Configuration</para> /// <para>Permissions related to Disco ICT Configuration</para>
/// </summary> /// </summary>
public static class Config public static class Config
{ {
@@ -825,6 +857,38 @@ namespace Disco.Services.Authorization
public const string ShowTimeline = "Config.DeviceBatch.ShowTimeline"; public const string ShowTimeline = "Config.DeviceBatch.ShowTimeline";
} }
/// <summary>Device Flags
/// <para>Permissions related to Device Flags</para>
/// </summary>
public static class DeviceFlag
{
/// <summary>Configure Device Flags
/// <para>Can configure device flags</para>
/// </summary>
public const string Configure = "Config.DeviceFlag.Configure";
/// <summary>Create Device Flags
/// <para>Can create device flags</para>
/// </summary>
public const string Create = "Config.DeviceFlag.Create";
/// <summary>Delete Device Flags
/// <para>Can delete device flags</para>
/// </summary>
public const string Delete = "Config.DeviceFlag.Delete";
/// <summary>Export Device Flag Assignments
/// <para>Can export user device assignments</para>
/// </summary>
public const string Export = "Config.DeviceFlag.Export";
/// <summary>Show Device Flags
/// <para>Can show device flags</para>
/// </summary>
public const string Show = "Config.DeviceFlag.Show";
}
/// <summary>Device Models /// <summary>Device Models
/// <para>Permissions related to Device Models</para> /// <para>Permissions related to Device Models</para>
/// </summary> /// </summary>
@@ -1109,6 +1173,11 @@ namespace Disco.Services.Authorization
/// </summary> /// </summary>
public const string Delete = "Config.UserFlag.Delete"; public const string Delete = "Config.UserFlag.Delete";
/// <summary>Export User Flag Assignments
/// <para>Can export user flag assignments</para>
/// </summary>
public const string Export = "Config.UserFlag.Export";
/// <summary>Show User Flags /// <summary>Show User Flags
/// <para>Can show user flags</para> /// <para>Can show user flags</para>
/// </summary> /// </summary>
@@ -1275,6 +1344,11 @@ namespace Disco.Services.Authorization
/// </summary> /// </summary>
public const string GenerateDocuments = "Job.Actions.GenerateDocuments"; public const string GenerateDocuments = "Job.Actions.GenerateDocuments";
/// <summary>Log Insurance
/// <para>Can log insurance for non-warranty jobs</para>
/// </summary>
public const string LogInsurance = "Job.Actions.LogInsurance";
/// <summary>Log Repair /// <summary>Log Repair
/// <para>Can log repair for non-warranty jobs</para> /// <para>Can log repair for non-warranty jobs</para>
/// </summary> /// </summary>
@@ -1415,7 +1489,7 @@ namespace Disco.Services.Authorization
/// </summary> /// </summary>
public const string InvoiceReceived = "Job.Properties.NonWarrantyProperties.InvoiceReceived"; public const string InvoiceReceived = "Job.Properties.NonWarrantyProperties.InvoiceReceived";
/// <summary>Is Insurance Claim Property /// <summary>Is Insurance Claim Property
/// <para>Can update property</para> /// <para>Can update property</para>
/// </summary> /// </summary>
public const string IsInsuranceClaim = "Job.Properties.NonWarrantyProperties.IsInsuranceClaim"; public const string IsInsuranceClaim = "Job.Properties.NonWarrantyProperties.IsInsuranceClaim";
@@ -1726,6 +1800,11 @@ namespace Disco.Services.Authorization
/// </summary> /// </summary>
public const string AddAttachments = "Device.Actions.AddAttachments"; public const string AddAttachments = "Device.Actions.AddAttachments";
/// <summary>Add Device Flags
/// <para>Can add device flags</para>
/// </summary>
public const string AddFlags = "Device.Actions.AddFlags";
/// <summary>Allow Unauthenticated Enrol /// <summary>Allow Unauthenticated Enrol
/// <para>Can allow devices to enrol without authentication</para> /// <para>Can allow devices to enrol without authentication</para>
/// </summary> /// </summary>
@@ -1746,6 +1825,11 @@ namespace Disco.Services.Authorization
/// </summary> /// </summary>
public const string Delete = "Device.Actions.Delete"; public const string Delete = "Device.Actions.Delete";
/// <summary>Edit Device Flags
/// <para>Can edit device flags</para>
/// </summary>
public const string EditFlags = "Device.Actions.EditFlags";
/// <summary>Enrol Devices /// <summary>Enrol Devices
/// <para>Can add devices offline and enrol devices with the Bootstrapper</para> /// <para>Can add devices offline and enrol devices with the Bootstrapper</para>
/// </summary> /// </summary>
@@ -1776,6 +1860,11 @@ namespace Disco.Services.Authorization
/// </summary> /// </summary>
public const string RemoveAnyAttachments = "Device.Actions.RemoveAnyAttachments"; public const string RemoveAnyAttachments = "Device.Actions.RemoveAnyAttachments";
/// <summary>Remove Device Flags
/// <para>Can remove device flags</para>
/// </summary>
public const string RemoveFlags = "Device.Actions.RemoveFlags";
/// <summary>Remove Own Attachments /// <summary>Remove Own Attachments
/// <para>Can remove own attachments from devices</para> /// <para>Can remove own attachments from devices</para>
/// </summary> /// </summary>
@@ -1807,6 +1896,11 @@ namespace Disco.Services.Authorization
/// </summary> /// </summary>
public const string ShowDetails = "Device.ShowDetails"; public const string ShowDetails = "Device.ShowDetails";
/// <summary>Show Device Flag Assignments
/// <para>Can show flags associated with devices</para>
/// </summary>
public const string ShowFlagAssignments = "Device.ShowFlagAssignments";
/// <summary>Show Devices /// <summary>Show Devices
/// <para>Can show devices</para> /// <para>Can show devices</para>
/// </summary> /// </summary>
@@ -1918,7 +2012,7 @@ namespace Disco.Services.Authorization
public const string ComputerAccount = "ComputerAccount"; public const string ComputerAccount = "ComputerAccount";
/// <summary>Disco Administrator Account /// <summary>Disco Administrator Account
/// <para>Represents a Disco Administrator account</para> /// <para>Represents a Disco ICT Administrator account</para>
/// </summary> /// </summary>
public const string DiscoAdminAccount = "DiscoAdminAccount"; public const string DiscoAdminAccount = "DiscoAdminAccount";
#endregion #endregion
-3
View File
@@ -20,9 +20,6 @@
<#@ import namespace="System.Runtime.InteropServices.CustomMarshalers" #> <#@ import namespace="System.Runtime.InteropServices.CustomMarshalers" #>
<#@ import namespace="System.Runtime.InteropServices" #> <#@ import namespace="System.Runtime.InteropServices" #>
<#@ import namespace="System.Reflection" #> <#@ import namespace="System.Reflection" #>
<# <#
// Get the DTE service from the host // Get the DTE service from the host
EnvDTE.DTE Dte = null; EnvDTE.DTE Dte = null;
@@ -14,7 +14,7 @@ using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.UserFlag;
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
{ {
[ClaimDetails("Configuration", "Permissions related to Disco Configuration")] [ClaimDetails("Configuration", "Permissions related to Disco ICT Configuration")]
public class ConfigClaims : BaseRoleClaimGroup public class ConfigClaims : BaseRoleClaimGroup
{ {
public ConfigClaims() public ConfigClaims()
@@ -22,6 +22,7 @@ namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
DeviceCertificate = new DeviceCertificateClaims(); DeviceCertificate = new DeviceCertificateClaims();
Enrolment = new EnrolmentClaims(); Enrolment = new EnrolmentClaims();
DeviceBatch = new DeviceBatchClaims(); DeviceBatch = new DeviceBatchClaims();
DeviceFlag = new DeviceFlagClaims();
DeviceModel = new DeviceModelClaims(); DeviceModel = new DeviceModelClaims();
DeviceProfile = new DeviceProfileClaims(); DeviceProfile = new DeviceProfileClaims();
DocumentTemplate = new DocumentTemplateClaims(); DocumentTemplate = new DocumentTemplateClaims();
@@ -43,6 +44,8 @@ namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
public DeviceBatchClaims DeviceBatch { get; set; } public DeviceBatchClaims DeviceBatch { get; set; }
public DeviceFlagClaims DeviceFlag { get; set; }
public DeviceModelClaims DeviceModel { get; set; } public DeviceModelClaims DeviceModel { get; set; }
public DeviceProfileClaims DeviceProfile { get; set; } public DeviceProfileClaims DeviceProfile { get; set; }
@@ -0,0 +1,20 @@
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.UserFlag
{
[ClaimDetails("Device Flags", "Permissions related to Device Flags")]
public class DeviceFlagClaims : BaseRoleClaimGroup
{
[ClaimDetails("Configure Device Flags", "Can configure device flags")]
public bool Configure { get; set; }
[ClaimDetails("Create Device Flags", "Can create device flags")]
public bool Create { get; set; }
[ClaimDetails("Delete Device Flags", "Can delete device flags")]
public bool Delete { get; set; }
[ClaimDetails("Export Device Flag Assignments", "Can export user device assignments")]
public bool Export { get; set; }
[ClaimDetails("Show Device Flags", "Can show device flags")]
public bool Show { get; set; }
}
}
@@ -11,6 +11,8 @@
[ClaimDetails("Delete User Flags", "Can delete user flags")] [ClaimDetails("Delete User Flags", "Can delete user flags")]
public bool Delete { get; set; } public bool Delete { get; set; }
[ClaimDetails("Export User Flag Assignments", "Can export user flag assignments")]
public bool Export { get; set; }
[ClaimDetails("Show User Flags", "Can show user flags")] [ClaimDetails("Show User Flags", "Can show user flags")]
public bool Show { get; set; } public bool Show { get; set; }
@@ -25,6 +25,12 @@
[ClaimDetails("Generate Documents", "Can generate documents for jobs")] [ClaimDetails("Generate Documents", "Can generate documents for jobs")]
public bool GenerateDocuments { get; set; } public bool GenerateDocuments { get; set; }
[ClaimDetails("Add Device Flags", "Can add device flags")]
public bool AddFlags { get; set; }
[ClaimDetails("Remove Device Flags", "Can remove device flags")]
public bool RemoveFlags { get; set; }
[ClaimDetails("Edit Device Flags", "Can edit device flags")]
public bool EditFlags { get; set; }
[ClaimDetails("Enrol Devices", "Can add devices offline and enrol devices with the Bootstrapper")] [ClaimDetails("Enrol Devices", "Can add devices offline and enrol devices with the Bootstrapper")]
public bool EnrolDevices { get; set; } public bool EnrolDevices { get; set; }
@@ -25,7 +25,8 @@
public bool ShowJobs { get; set; } public bool ShowJobs { get; set; }
[ClaimDetails("Show Assignment History", "Can show the assignment history for devices")] [ClaimDetails("Show Assignment History", "Can show the assignment history for devices")]
public bool ShowAssignmentHistory { get; set; } public bool ShowAssignmentHistory { get; set; }
[ClaimDetails("Show Device Flag Assignments", "Can show flags associated with devices")]
public bool ShowFlagAssignments { get; set; }
public DevicePropertiesClaims Properties { get; set; } public DevicePropertiesClaims Properties { get; set; }
@@ -23,10 +23,12 @@
[ClaimDetails("Remove from Any Queues", "Can remove from any job queues")] [ClaimDetails("Remove from Any Queues", "Can remove from any job queues")]
public bool RemoveAnyQueues { get; set; } public bool RemoveAnyQueues { get; set; }
[ClaimDetails("Log Warranty", "Can log warranty for jobs")] [ClaimDetails("Lodge Warranty", "Can lodge warranty for jobs")]
public bool LogWarranty { get; set; } public bool LogWarranty { get; set; }
[ClaimDetails("Log Repair", "Can log repair for non-warranty jobs")] [ClaimDetails("Lodge Repair", "Can lodge repair for non-warranty jobs")]
public bool LogRepair { get; set; } public bool LogRepair { get; set; }
[ClaimDetails("Lodge Insurance", "Can lodge insurance for non-warranty jobs")]
public bool LogInsurance { get; set; }
[ClaimDetails("Convert HWar Jobs To HNWar", "Can convert warranty jobs to non-warranty jobs")] [ClaimDetails("Convert HWar Jobs To HNWar", "Can convert warranty jobs to non-warranty jobs")]
public bool ConvertHWarToHNWar { get; set; } public bool ConvertHWarToHNWar { get; set; }
@@ -8,7 +8,7 @@
[ClaimDetails("Edit Components", "Can edit and remove job components")] [ClaimDetails("Edit Components", "Can edit and remove job components")]
public bool EditComponents { get; set; } public bool EditComponents { get; set; }
[ClaimDetails("Is Insurance Claim Property", "Can update property")] [ClaimDetails("Is Insurance Claim Property", "Can update property")]
public bool IsInsuranceClaim { get; set; } public bool IsInsuranceClaim { get; set; }
[ClaimDetails("Insurance Claim Form Sent Property", "Can update property")] [ClaimDetails("Insurance Claim Form Sent Property", "Can update property")]
@@ -149,7 +149,7 @@ namespace Disco.Services.Authorization.Roles
} }
/// <summary> /// <summary>
/// Migrates authorization role claims to conform with changes to Disco since the last release. /// Migrates authorization role claims to conform with changes to Disco ICT since the last release.
/// Claims are only added when the meaning of an existing claim has changed (or expanded/contracted) to improve the migration experience. /// Claims are only added when the meaning of an existing claim has changed (or expanded/contracted) to improve the migration experience.
/// </summary> /// </summary>
private static void MigrateAuthorizationRoles(DiscoDataContext Database) private static void MigrateAuthorizationRoles(DiscoDataContext Database)
@@ -19,7 +19,7 @@ namespace Disco.Services.Authorization.Roles
[ClaimDetails("Computer Account", "Represents a computer account", true)] [ClaimDetails("Computer Account", "Represents a computer account", true)]
public bool ComputerAccount { get; set; } public bool ComputerAccount { get; set; }
[ClaimDetails("Disco Administrator Account", "Represents a Disco Administrator account", true)] [ClaimDetails("Disco Administrator Account", "Represents a Disco ICT Administrator account", true)]
public bool DiscoAdminAccount { get; set; } public bool DiscoAdminAccount { get; set; }
public ConfigClaims Config { get; set; } public ConfigClaims Config { get; set; }
@@ -22,7 +22,7 @@ namespace Disco.Services
using (DiscoDataContext database = new DiscoDataContext()) using (DiscoDataContext database = new DiscoDataContext())
{ {
EnrolResponse response = DeviceEnrolment.Enrol(database, username, request); EnrolResponse response = WindowsDeviceEnrolment.Enrol(database, username, request);
database.SaveChanges(); database.SaveChanges();
return response; return response;
} }
@@ -61,7 +61,7 @@ namespace Disco.Services
using (DiscoDataContext database = new DiscoDataContext()) using (DiscoDataContext database = new DiscoDataContext())
{ {
MacEnrolResponse response = DeviceEnrolment.MacEnrol(database, request, false); MacEnrolResponse response = MacDeviceEnrolment.Enrol(database, request, false);
database.SaveChanges(); database.SaveChanges();
return response; return response;
} }
+11 -1
View File
@@ -5,6 +5,7 @@ using Disco.Services.Authorization;
using Disco.Services.Documents; using Disco.Services.Documents;
using Disco.Services.Expressions; using Disco.Services.Expressions;
using Disco.Services.Interop.ActiveDirectory; using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Logging;
using Disco.Services.Users; using Disco.Services.Users;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -189,7 +190,16 @@ namespace Disco.Services
{ {
var adMachineAccount = ActiveDirectory.RetrieveADMachineAccount(d.DeviceDomainId); var adMachineAccount = ActiveDirectory.RetrieveADMachineAccount(d.DeviceDomainId);
if (adMachineAccount != null) if (adMachineAccount != null)
adMachineAccount.SetDescription(d); {
try
{
adMachineAccount.SetDescription(d);
}
catch (Exception ex)
{
SystemLog.LogWarning($"Unable to update AD Machine Account Description for {d.DeviceDomainId}: {ex.Message}");
}
}
} }
return newDua; return newDua;
@@ -0,0 +1,61 @@
using Disco.Data.Repository;
using Disco.Models.Repository;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
internal class Cache
{
private ConcurrentDictionary<int, DeviceFlag> _Cache;
public Cache(DiscoDataContext Database)
{
Initialize(Database);
}
public void ReInitialize(DiscoDataContext Database)
{
Initialize(Database);
}
private void Initialize(DiscoDataContext Database)
{
// Queues from Database
var flags = Database.DeviceFlags.ToList();
// Add Queues to In-Memory Cache
_Cache = new ConcurrentDictionary<int, DeviceFlag>(flags.Select(f => new KeyValuePair<int, DeviceFlag>(f.Id, f)));
}
public DeviceFlag GetDeviceFlag(int deviceFlagId)
{
if (_Cache.TryGetValue(deviceFlagId, out var item))
return item;
else
return null;
}
public List<DeviceFlag> GetDeviceFlags()
{
return _Cache.Values.ToList();
}
public void AddOrUpdate(DeviceFlag flag)
{
_Cache.AddOrUpdate(flag.Id, flag, (key, existingItem) => flag);
}
public DeviceFlag Remove(int deviceFlagId)
{
if (_Cache.TryRemove(deviceFlagId, out var item))
return item;
else
return null;
}
public DeviceFlag Remove(DeviceFlag deviceFlag)
{
return Remove(deviceFlag.Id);
}
}
}
@@ -0,0 +1,184 @@
using Disco.Data.Repository;
using Disco.Data.Repository.Monitor;
using Disco.Models.Repository;
using Disco.Models.Services.Interop.ActiveDirectory;
using Disco.Services.Interop.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
public class DeviceFlagDeviceAssignedUsersManagedGroup : ADManagedGroup
{
private const string KeyFormat = "DeviceFlag_{0}_DeviceAssignedUsers";
private const string DescriptionFormat = "User associated with devices which have the {0} Flag will be added to this Active Directory group.";
private const string CategoryDescriptionFormat = "Device Assigned Users Linked Group";
private const string GroupDescriptionFormat = "{0} [Device Flag Device Assigned Users]";
private IDisposable repositorySubscription;
private int deviceFlagId;
private string deviceFlagName;
public override string Description { get { return string.Format(DescriptionFormat, deviceFlagName); } }
public override string CategoryDescription { get { return CategoryDescriptionFormat; } }
public override string GroupDescription { get { return string.Format(GroupDescriptionFormat, deviceFlagName); } }
public override bool IncludeFilterBeginDate { get { return true; } }
private DeviceFlagDeviceAssignedUsersManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DeviceFlag deviceFlag)
: base(Key, Configuration)
{
deviceFlagId = deviceFlag.Id;
deviceFlagName = deviceFlag.Name;
}
public override void Initialize()
{
// Subscribe to changes
repositorySubscription = DeviceFlagService.DeviceFlagAssignmentRepositoryEvents.Value
.Where(e =>
(((DeviceFlagAssignment)e.Entity).DeviceFlagId == deviceFlagId))
.Subscribe(ProcessRepositoryEvent);
}
public static string GetKey(DeviceFlag deviceFlag)
{
return string.Format(KeyFormat, deviceFlag.Id);
}
public static string GetDescription(DeviceFlag deviceFlag)
{
return string.Format(DescriptionFormat, deviceFlag.Name);
}
public static string GetCategoryDescription(DeviceFlag deviceFlag)
{
return CategoryDescriptionFormat;
}
public static bool TryGetManagedGroup(DeviceFlag deviceFlag, out DeviceFlagDeviceAssignedUsersManagedGroup managedGroup)
{
return ActiveDirectory.Context.ManagedGroups.TryGetValue(GetKey(deviceFlag), out managedGroup);
}
public static DeviceFlagDeviceAssignedUsersManagedGroup Initialize(DeviceFlag deviceFlag)
{
if (deviceFlag.Id > 0)
{
var key = GetKey(deviceFlag);
if (!string.IsNullOrEmpty(deviceFlag.DeviceUsersLinkedGroup))
{
var config = ConfigurationFromJson(deviceFlag.DeviceUsersLinkedGroup);
if (config != null && !string.IsNullOrWhiteSpace(config.GroupId))
{
var group = new DeviceFlagDeviceAssignedUsersManagedGroup(
key,
config,
deviceFlag);
// Add to AD Context
ActiveDirectory.Context.ManagedGroups.AddOrUpdate(group);
return group;
}
}
// Remove from AD Context
ActiveDirectory.Context.ManagedGroups.Remove(key);
}
return null;
}
public override IEnumerable<string> DetermineMembers(DiscoDataContext Database)
{
var query = (IQueryable<User>)Database.Users;
if (Configuration.FilterBeginDate.HasValue)
{
query = query
.Where(u => u.DeviceUserAssignments.Any(a =>
a.UnassignedDate == null &&
a.Device.DeviceFlagAssignments.Any(fa =>
fa.DeviceFlagId == deviceFlagId &&
!fa.RemovedDate.HasValue &&
fa.AddedDate >= Configuration.FilterBeginDate)));
}
else
{
query = query
.Where(u => u.DeviceUserAssignments.Any(a =>
a.UnassignedDate == null &&
a.Device.DeviceFlagAssignments.Any(fa =>
fa.DeviceFlagId == deviceFlagId &&
!fa.RemovedDate.HasValue)));
}
return query.Select(u => u.UserId)
.Distinct()
.ToList()
.Where(ActiveDirectory.IsValidDomainAccountId)
.ToList();
}
private void ProcessRepositoryEvent(RepositoryMonitorEvent Event)
{
var assignment = (DeviceFlagAssignment)Event.Entity;
string userId = assignment.Device?.AssignedUserId;
if (!ActiveDirectory.IsValidDomainAccountId(userId))
return;
switch (Event.EventType)
{
case RepositoryMonitorEventType.Added:
if (Configuration.FilterBeginDate.HasValue)
{
if (!assignment.RemovedDate.HasValue && assignment.AddedDate >= Configuration.FilterBeginDate)
{
AddMember(userId);
}
}
else
{
if (!assignment.RemovedDate.HasValue)
{
AddMember(userId);
}
}
break;
case RepositoryMonitorEventType.Modified:
if (!Configuration.FilterBeginDate.HasValue || assignment.AddedDate >= Configuration.FilterBeginDate)
{
if (assignment.RemovedDate.HasValue)
RemoveMember(userId, (database) =>
{
if (database.Users.Any(u => u.DeviceUserAssignments.Any(a =>
a.UnassignedDate == null &&
a.Device.DeviceFlagAssignments.Any(fa =>
fa.DeviceFlagId == deviceFlagId &&
!fa.RemovedDate.HasValue))))
{
return null;
}
else
{
return new[] { userId };
}
}
);
else
AddMember(userId);
}
break;
}
}
public override void Dispose()
{
if (repositorySubscription != null)
repositorySubscription.Dispose();
}
}
}
@@ -0,0 +1,202 @@
using Disco.Data.Repository;
using Disco.Data.Repository.Monitor;
using Disco.Models.Repository;
using Disco.Models.Services.Interop.ActiveDirectory;
using Disco.Services.Interop.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
public class DeviceFlagDevicesManagedGroup : ADManagedGroup
{
private const string KeyFormat = "DeviceFlag_{0}_Devices";
private const string DescriptionFormat = "Devices associated with the {0} Flag will be added to this Active Directory group.";
private const string CategoryDescriptionFormat = "Assigned Devices Linked Group";
private const string GroupDescriptionFormat = "{0} [Device Flag Devices]";
private IDisposable repositorySubscription;
private int deviceFlagId;
private string deviceFlagName;
public override string Description { get { return string.Format(DescriptionFormat, deviceFlagName); } }
public override string CategoryDescription { get { return CategoryDescriptionFormat; } }
public override string GroupDescription { get { return string.Format(GroupDescriptionFormat, deviceFlagName); } }
public override bool IncludeFilterBeginDate { get { return true; } }
private DeviceFlagDevicesManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DeviceFlag DeviceFlag)
: base(Key, Configuration)
{
deviceFlagId = DeviceFlag.Id;
deviceFlagName = DeviceFlag.Name;
}
public override void Initialize()
{
// Subscribe to changes
repositorySubscription = DeviceFlagService.DeviceFlagAssignmentRepositoryEvents.Value
.Where(e =>
((DeviceFlagAssignment)e.Entity).DeviceFlagId == deviceFlagId)
.Subscribe(ProcessRepositoryEvent);
}
public static string GetKey(DeviceFlag deviceFlag)
{
return string.Format(KeyFormat, deviceFlag.Id);
}
public static string GetDescription(DeviceFlag deviceFlag)
{
return string.Format(DescriptionFormat, deviceFlag.Name);
}
public static string GetCategoryDescription(DeviceFlag deviceFlag)
{
return CategoryDescriptionFormat;
}
public static bool TryGetManagedGroup(DeviceFlag deviceFlag, out DeviceFlagDevicesManagedGroup managedGroup)
{
return ActiveDirectory.Context.ManagedGroups.TryGetValue(GetKey(deviceFlag), out managedGroup);
}
public static DeviceFlagDevicesManagedGroup Initialize(DeviceFlag deviceFlag)
{
if (deviceFlag.Id > 0)
{
var key = GetKey(deviceFlag);
if (!string.IsNullOrEmpty(deviceFlag.DevicesLinkedGroup))
{
var config = ConfigurationFromJson(deviceFlag.DevicesLinkedGroup);
if (config != null && !string.IsNullOrWhiteSpace(config.GroupId))
{
var group = new DeviceFlagDevicesManagedGroup(
key,
config,
deviceFlag);
// Add to AD Context
ActiveDirectory.Context.ManagedGroups.AddOrUpdate(group);
return group;
}
}
// Remove from AD Context
ActiveDirectory.Context.ManagedGroups.Remove(key);
}
return null;
}
public override IEnumerable<string> DetermineMembers(DiscoDataContext Database)
{
var query = Database.DeviceFlagAssignments
.Where(a => a.DeviceFlagId == deviceFlagId && !a.RemovedDate.HasValue && a.Device.DeviceDomainId != null);
if (Configuration.FilterBeginDate.HasValue)
query = query.Where(a => a.AddedDate >= Configuration.FilterBeginDate);
return query
.Select(a => a.Device.DeviceDomainId)
.ToList()
.Where(ActiveDirectory.IsValidDomainAccountId)
.Select(id => id + "$");
}
private void ProcessRepositoryEvent(RepositoryMonitorEvent Event)
{
var assignment = (DeviceFlagAssignment)Event.Entity;
var domainId = assignment.Device?.DeviceDomainId;
if (!ActiveDirectory.IsValidDomainAccountId(domainId))
return;
domainId += "$";
switch (Event.EventType)
{
case RepositoryMonitorEventType.Added:
if (Configuration.FilterBeginDate.HasValue)
{
if (!assignment.RemovedDate.HasValue && assignment.AddedDate >= Configuration.FilterBeginDate)
{
AddMember(domainId);
}
}
else
{
if (!assignment.RemovedDate.HasValue)
{
AddMember(domainId);
}
}
break;
case RepositoryMonitorEventType.Modified:
if (Configuration.FilterBeginDate.HasValue)
{
if (assignment.AddedDate >= Configuration.FilterBeginDate)
{
if (assignment.RemovedDate.HasValue)
{
RemoveMember(domainId);
}
else
{
AddMember(domainId);
}
}
}
else
{
if (assignment.RemovedDate.HasValue)
{
RemoveMember(domainId);
}
else
{
AddMember(domainId);
}
}
break;
case RepositoryMonitorEventType.Deleted:
// Remove the device if no other (non-removed) assignments exist.
var serialNumber = assignment.DeviceSerialNumber;
RemoveMember(domainId, (database) =>
{
if (Configuration.FilterBeginDate.HasValue)
{
if (database.DeviceFlagAssignments.Any(a => a.DeviceFlagId == deviceFlagId && a.DeviceSerialNumber == serialNumber && !a.RemovedDate.HasValue && a.AddedDate >= Configuration.FilterBeginDate))
{
return null;
}
else
{
return new string[] { domainId };
}
}
else
{
if (database.DeviceFlagAssignments.Any(a => a.DeviceFlagId == deviceFlagId && a.DeviceSerialNumber == serialNumber && !a.RemovedDate.HasValue))
{
return null;
}
else
{
return new string[] { domainId };
}
}
});
break;
}
}
public override void Dispose()
{
if (repositorySubscription != null)
repositorySubscription.Dispose();
}
}
}
@@ -0,0 +1,229 @@
using Disco.Data.Repository;
using Disco.Models.Exporting;
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Models.Services.Exporting;
using Disco.Services.Plugins.Features.DetailsProvider;
using Disco.Services.Tasks;
using Disco.Services.Users;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
using Metadata = ExportFieldMetadata<DeviceFlagExportRecord>;
public class DeviceFlagExport
{
private readonly DiscoDataContext database;
private readonly DeviceFlagExportOptions options;
public DeviceFlagExport(DiscoDataContext database, DeviceFlagExportOptions options)
{
this.database = database;
this.options = options;
}
public ExportResult Generate(IScheduledTaskStatus status)
{
var records = BuildRecords(status);
var metadata = BuildMetadata(records, status);
if (metadata.Count == 0)
throw new ArgumentException("At least one export field must be specified", nameof(options));
status.UpdateStatus(90, $"Formatting {records.Count} records for export");
return ExportHelpers.WriteExport(options, status, metadata, records);
}
private List<DeviceFlagExportRecord> BuildRecords(IScheduledTaskStatus status)
{
var query = database.DeviceFlagAssignments
.Include(a => a.DeviceFlag);
if (options.HasDeviceOptions())
query = query.Include(a => a.Device);
if (options.HasDeviceModelOptions())
query = query.Include(a => a.Device.DeviceModel);
if (options.HasDeviceBatchOptions())
query = query.Include(a => a.Device.DeviceBatch);
if (options.HasDeviceProfileOptions())
query = query.Include(a => a.Device.DeviceProfile);
if (options.HasAssignedUserOptions())
query = query.Include(a => a.Device.AssignedUser);
if (options.AssignedUserDetailCustom)
query = query.Include(a => a.Device.AssignedUser.UserDetails);
query = query.Where(a => options.DeviceFlagIds.Contains(a.DeviceFlagId));
if (options.CurrentOnly)
{
query = query.Where(a => !a.RemovedDate.HasValue);
}
// Update Users
if (options.HasAssignedUserOptions())
{
status.UpdateStatus(5, "Refreshing user details from Active Directory");
var userIds = query.Where(d => d.Device.AssignedUserId != null).Select(d => d.Device.AssignedUserId).Distinct().ToList();
foreach (var userId in userIds)
{
try
{
UserService.GetUser(userId, database);
}
catch (Exception) { } // Ignore Errors
}
}
status.UpdateStatus(15, "Extracting records from the database");
var records = query.Select(a => new DeviceFlagExportRecord()
{
Assignment = a
}).ToList();
if (options.AssignedUserDetailCustom)
{
status.UpdateStatus(50, "Extracting custom user detail records");
var detailsService = new DetailsProviderService(database);
var cache = new Dictionary<string, Dictionary<string, string>>(StringComparer.Ordinal);
foreach (var record in records)
{
var userId = record.Assignment.Device.AssignedUserId;
if (userId == null)
continue;
if (!cache.TryGetValue(userId, out var details))
details = detailsService.GetDetails(record.Assignment.Device.AssignedUser);
record.AssignedUserCustomDetails = details;
}
}
return records;
}
private List<Metadata> BuildMetadata(List<DeviceFlagExportRecord> records, IScheduledTaskStatus status)
{
status.UpdateStatus(80, "Building metadata");
IEnumerable<string> userDetailCustomKeys = null;
if (options.AssignedUserDetailCustom)
userDetailCustomKeys = records.Where(r => r.AssignedUserCustomDetails != null).SelectMany(r => r.AssignedUserCustomDetails.Keys).Distinct(StringComparer.OrdinalIgnoreCase).ToList();
var accessors = BuildAccessors(userDetailCustomKeys);
return typeof(DeviceFlagExportOptions).GetProperties()
.Where(p => p.PropertyType == typeof(bool))
.Select(p => new
{
property = p,
details = (DisplayAttribute)p.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault()
})
.Where(p => p.details != null && p.property.Name != nameof(options.CurrentOnly) && (bool)p.property.GetValue(options))
.SelectMany(p =>
{
var fieldMetadata = accessors[p.property.Name];
fieldMetadata.ForEach(f =>
{
if (f.ColumnName == null)
f.ColumnName = (p.details.ShortName == "Device Flag") ? p.details.Name : $"{p.details.ShortName} {p.details.Name}";
});
return fieldMetadata;
}).ToList();
}
private static Dictionary<string, List<Metadata>> BuildAccessors(IEnumerable<string> userDetailsCustomKeys)
{
const string DateFormat = "yyyy-MM-dd";
const string DateTimeFormat = DateFormat + " HH:mm:ss";
Func<object, string> csvStringEncoded = (o) => o == null ? null : $"\"{((string)o).Replace("\"", "\"\"")}\"";
Func<object, string> csvToStringEncoded = (o) => o == null ? null : o.ToString();
Func<object, string> csvCurrencyEncoded = (o) => ((decimal?)o).HasValue ? ((decimal?)o).Value.ToString("C") : null;
Func<object, string> csvDateEncoded = (o) => ((DateTime)o).ToString(DateFormat);
Func<object, string> csvDateTimeEncoded = (o) => ((DateTime)o).ToString(DateTimeFormat);
Func<object, string> csvNullableDateEncoded = (o) => ((DateTime?)o).HasValue ? csvDateEncoded(o) : null;
Func<object, string> csvNullableDateTimeEncoded = (o) => ((DateTime?)o).HasValue ? csvDateTimeEncoded(o) : null;
var metadata = new Dictionary<string, List<Metadata>>();
// Device Flag
metadata.Add(nameof(DeviceFlagExportOptions.Id), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Id), typeof(string), r => r.Assignment.DeviceFlagId, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.Name), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Name), typeof(string), r => r.Assignment.DeviceFlag.Name, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.Description), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Description), typeof(string), r => r.Assignment.DeviceFlag.Description, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.Icon), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Icon), typeof(string), r => r.Assignment.DeviceFlag.Icon, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.IconColour), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.IconColour), typeof(string), r => r.Assignment.DeviceFlag.IconColour, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignmentId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignmentId), typeof(string), r => r.Assignment.Id, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AddedDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AddedDate), typeof(string), r => r.Assignment.AddedDate, csvDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AddedUserId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AddedUserId), typeof(string), r => r.Assignment.AddedUserId, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.RemovedUserId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.RemovedUserId), typeof(string), r => r.Assignment.RemovedUserId, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.RemovedDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.RemovedDate), typeof(string), r => r.Assignment.RemovedDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.Comments), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Comments), typeof(string), r => r.Assignment.Comments, csvStringEncoded) });
// Device
metadata.Add(nameof(DeviceFlagExportOptions.DeviceSerialNumber), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceSerialNumber), typeof(string), r => r.Assignment.Device.SerialNumber, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceAssetNumber), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceAssetNumber), typeof(string), r => r.Assignment.Device.AssetNumber, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceLocation), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceLocation), typeof(string), r => r.Assignment.Device.Location, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceComputerName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceComputerName), typeof(string), r => r.Assignment.Device.DeviceDomainId, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceLastNetworkLogon), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceLastNetworkLogon), typeof(DateTime), r => r.Assignment.Device.LastNetworkLogonDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceCreatedDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceCreatedDate), typeof(DateTime), r => r.Assignment.Device.CreatedDate, csvDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceFirstEnrolledDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceFirstEnrolledDate), typeof(DateTime), r => r.Assignment.Device.EnrolledDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceLastEnrolledDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceLastEnrolledDate), typeof(DateTime), r => r.Assignment.Device.LastEnrolDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceAllowUnauthenticatedEnrol), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceAllowUnauthenticatedEnrol), typeof(bool), r => r.Assignment.Device.AllowUnauthenticatedEnrol, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceDecommissionedDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceDecommissionedDate), typeof(DateTime), r => r.Assignment.Device.DecommissionedDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceDecommissionedReason), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceDecommissionedReason), typeof(string), r => r.Assignment.Device.DecommissionReason, csvToStringEncoded) });
// Model
metadata.Add(nameof(DeviceFlagExportOptions.ModelId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelId), typeof(int), r => r.Assignment.Device.DeviceModel.Id, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ModelDescription), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelDescription), typeof(string), r => r.Assignment.Device.DeviceModel.Description, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ModelManufacturer), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelManufacturer), typeof(string), r => r.Assignment.Device.DeviceModel.Manufacturer, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ModelModel), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelModel), typeof(string), r => r.Assignment.Device.DeviceModel.Model, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ModelType), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelType), typeof(string), r => r.Assignment.Device.DeviceModel.ModelType, csvStringEncoded) });
// Batch
metadata.Add(nameof(DeviceFlagExportOptions.BatchId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchId), typeof(int), r => r.Assignment.Device.DeviceBatch?.Id, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchName), typeof(string), r => r.Assignment.Device.DeviceBatch?.Name, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchPurchaseDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchPurchaseDate), typeof(DateTime), r => r.Assignment.Device.DeviceBatch?.PurchaseDate, csvNullableDateEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchSupplier), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchSupplier), typeof(string), r => r.Assignment.Device.DeviceBatch?.Supplier, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchUnitCost), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchUnitCost), typeof(decimal), r => r.Assignment.Device.DeviceBatch?.UnitCost, csvCurrencyEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchWarrantyValidUntilDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchWarrantyValidUntilDate), typeof(DateTime), r => r.Assignment.Device.DeviceBatch?.WarrantyValidUntil, csvNullableDateEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchInsuredDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchInsuredDate), typeof(DateTime), r => r.Assignment.Device.DeviceBatch?.InsuredDate, csvNullableDateEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchInsuranceSupplier), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchInsuranceSupplier), typeof(string), r => r.Assignment.Device.DeviceBatch?.InsuranceSupplier, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchInsuredUntilDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchInsuredUntilDate), typeof(DateTime), r => r.Assignment.Device.DeviceBatch?.InsuredUntil, csvNullableDateEncoded) });
// Profile
metadata.Add(nameof(DeviceFlagExportOptions.ProfileId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ProfileId), typeof(int), r => r.Assignment.Device.DeviceProfile?.Id, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ProfileName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ProfileName), typeof(string), r => r.Assignment.Device.DeviceProfile?.Name, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ProfileShortName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ProfileShortName), typeof(string), r => r.Assignment.Device.DeviceProfile?.ShortName, csvStringEncoded) });
// User
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserId), typeof(string), r => r.Assignment.Device?.AssignedUser?.UserId, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserDisplayName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserDisplayName), typeof(string), r => r.Assignment.Device?.AssignedUser?.DisplayName, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserSurname), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserSurname), typeof(string), r => r.Assignment.Device?.AssignedUser?.Surname, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserGivenName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserGivenName), typeof(string), r => r.Assignment.Device?.AssignedUser?.GivenName, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserPhoneNumber), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserPhoneNumber), typeof(string), r => r.Assignment.Device?.AssignedUser?.PhoneNumber, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserEmailAddress), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserEmailAddress), typeof(string), r => r.Assignment.Device?.AssignedUser?.EmailAddress, csvStringEncoded) });
if (userDetailsCustomKeys != null)
{
var userDetailCustomFields = new List<Metadata>();
foreach (var detailKey in userDetailsCustomKeys.OrderBy(k => k, StringComparer.OrdinalIgnoreCase))
{
var key = detailKey;
userDetailCustomFields.Add(new Metadata(detailKey, detailKey, typeof(string), r => r.AssignedUserCustomDetails != null && r.AssignedUserCustomDetails.TryGetValue(key, out var value) ? value : null, csvStringEncoded));
}
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserDetailCustom), userDetailCustomFields);
}
return metadata;
}
}
}
@@ -0,0 +1,46 @@
using Disco.Data.Repository;
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Services.Exporting;
using Disco.Services.Tasks;
using Quartz;
namespace Disco.Services.Devices.DeviceFlags
{
public class DeviceFlagExportTask : ScheduledTask
{
private const string JobDataMapContext = "Context";
public override string TaskName { get; } = "Export Device Flags";
public override bool SingleInstanceTask { get { return false; } }
public override bool CancelInitiallySupported { get { return false; } }
public static ExportTaskContext<DeviceFlagExportOptions> ScheduleNow(DeviceFlagExportOptions options)
{
// Build Context
var context = new ExportTaskContext<DeviceFlagExportOptions>(options);
// Build Data Map
var task = new DeviceFlagExportTask();
JobDataMap taskData = new JobDataMap() { { JobDataMapContext, context } };
// Schedule Task
context.TaskStatus = task.ScheduleTask(taskData);
return context;
}
protected override void ExecuteTask()
{
var context = (ExportTaskContext<DeviceFlagExportOptions>)ExecutionContext.JobDetail.JobDataMap[JobDataMapContext];
Status.UpdateStatus(10, "Exporting Device Flag Records", "Starting...");
using (DiscoDataContext Database = new DiscoDataContext())
{
var export = new DeviceFlagExport(Database, context.Options);
context.Result = export.Generate(Status);
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More