qol: formatting

This commit is contained in:
Gary Sharp
2025-07-20 13:47:56 +10:00
parent 49da389c2c
commit 5792771ea1
158 changed files with 693 additions and 679 deletions
+3 -3
View File
@@ -1,10 +1,10 @@
using System; using Disco.Client.Extensions;
using Newtonsoft.Json;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using Disco.Client.Extensions;
using Newtonsoft.Json;
namespace Disco.Client namespace Disco.Client
{ {
@@ -8,13 +8,13 @@ namespace Disco.Client.Extensions
{ {
public static class ClientServicesExtensions public static class ClientServicesExtensions
{ {
//#if DEBUG //#if DEBUG
// public const string ServicePathAuthenticatedTemplate = "http://WS-GSHARP:57252/Services/Client/Authenticated/{0}"; // public const string ServicePathAuthenticatedTemplate = "http://WS-GSHARP:57252/Services/Client/Authenticated/{0}";
// public const string ServicePathUnauthenticatedTemplate = "http://WS-GSHARP:57252/Services/Client/Unauthenticated/{0}"; // public const string ServicePathUnauthenticatedTemplate = "http://WS-GSHARP:57252/Services/Client/Unauthenticated/{0}";
//#else //#else
public const string ServicePathAuthenticatedTemplate = "http://DISCO:9292/Services/Client/Authenticated/{0}"; public const string ServicePathAuthenticatedTemplate = "http://DISCO:9292/Services/Client/Authenticated/{0}";
public const string ServicePathUnauthenticatedTemplate = "http://DISCO:9292/Services/Client/Unauthenticated/{0}"; public const string ServicePathUnauthenticatedTemplate = "http://DISCO:9292/Services/Client/Unauthenticated/{0}";
//#endif //#endif
public static ResponseType Post<ResponseType>(this ServiceBase<ResponseType> Service, bool Authenticated) public static ResponseType Post<ResponseType>(this ServiceBase<ResponseType> Service, bool Authenticated)
{ {
+2 -2
View File
@@ -1,5 +1,5 @@
using System.Text; using Disco.Models.ClientServices;
using Disco.Models.ClientServices; using System.Text;
namespace Disco.Client.Extensions namespace Disco.Client.Extensions
{ {
@@ -10,7 +10,7 @@ namespace Disco.Client.Interop.Native
/// The number of wireless profile entries in the ProfileInfo member. /// The number of wireless profile entries in the ProfileInfo member.
/// </summary> /// </summary>
public uint dwNumberOfItems; public uint dwNumberOfItems;
/// <summary> /// <summary>
/// The index of the current item. The index of the first item is 0. The dwIndex member must be less than the dwNumberOfItems member. /// The index of the current item. The index of the first item is 0. The dwIndex member must be less than the dwNumberOfItems member.
/// This member is not used by the wireless service. Applications can use this member when processing individual profiles in the /// This member is not used by the wireless service. Applications can use this member when processing individual profiles in the
+1 -1
View File
@@ -21,7 +21,7 @@ namespace Disco.Client.Interop
return adapters; return adapters;
} }
private static List<NetworkAdapter> GetWmiNetworkAdapters() private static List<NetworkAdapter> GetWmiNetworkAdapters()
{ {
try try
+3 -3
View File
@@ -1,9 +1,9 @@
using System; using Disco.Client.Extensions;
using Disco.Client.Interop;
using System;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using Disco.Client.Extensions;
using Disco.Client.Interop;
namespace Disco.Client namespace Disco.Client
{ {
+3 -3
View File
@@ -1,8 +1,8 @@
using System; using Disco.Client.Extensions;
using Disco.Models.ClientServices;
using System;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using Disco.Models.ClientServices;
using Disco.Client.Extensions;
namespace Disco.Client namespace Disco.Client
{ {
+10 -10
View File
@@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Net;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Net;
using System.IO;
using System.Diagnostics;
namespace Disco.ClientBootstrapper namespace Disco.ClientBootstrapper
{ {
@@ -20,13 +20,13 @@ namespace Disco.ClientBootstrapper
private StringBuilder errorMessage; private StringBuilder errorMessage;
private Process clientProcess; private Process clientProcess;
//#if DEBUG //#if DEBUG
// public const string DiscoServerName = "WS-GSHARP"; // public const string DiscoServerName = "WS-GSHARP";
// public const int DiscoServerPort = 57252; // public const int DiscoServerPort = 57252;
//#else //#else
public const string DiscoServerName = "DISCO"; public const string DiscoServerName = "DISCO";
public const int DiscoServerPort = 9292; public const int DiscoServerPort = 9292;
//#endif //#endif
public BootstrapperLoop(IStatus StatusUI, LoopCompleteCallback Callback) public BootstrapperLoop(IStatus StatusUI, LoopCompleteCallback Callback)
{ {
@@ -128,8 +128,8 @@ namespace Disco.ClientBootstrapper
break; break;
} }
} }
} }
if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName)) if (!Interop.NetworkInterop.PingDiscoIct(DiscoServerName))
{ {
// Client Failed // Client Failed
@@ -1,9 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.IO;
namespace Disco.ClientBootstrapper.Interop namespace Disco.ClientBootstrapper.Interop
{ {
@@ -66,7 +66,7 @@ namespace Disco.ClientBootstrapper.Interop
foreach (var file in Directory.EnumerateFiles(SourceLocation)) foreach (var file in Directory.EnumerateFiles(SourceLocation))
{ {
var fileName = Path.GetFileName(file); var fileName = Path.GetFileName(file);
// Only Copy Certain Files // Only Copy Certain Files
// Copy Wireless Certificates // Copy Wireless Certificates
@@ -79,7 +79,7 @@ namespace Disco.ClientBootstrapper.Interop
if (fileName.StartsWith("WLAN_Profile_", StringComparison.OrdinalIgnoreCase) && if (fileName.StartsWith("WLAN_Profile_", StringComparison.OrdinalIgnoreCase) &&
fileName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)) fileName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
File.Copy(file, Path.Combine(InstallLocation, fileName)); File.Copy(file, Path.Combine(InstallLocation, fileName));
} }
#endregion #endregion
@@ -340,7 +340,7 @@ namespace Disco.ClientBootstrapper.Interop
var progress = eventArgs.WideParameter.ToInt32(); var progress = eventArgs.WideParameter.ToInt32();
Program.Status.UpdateStatus(null, null, $"Time remaining: {timeRemainingMessage}", true, progress); Program.Status.UpdateStatus(null, null, $"Time remaining: {timeRemainingMessage}", true, progress);
break; break;
default: default:
break; break;
@@ -40,14 +40,16 @@ namespace Disco.ClientBootstrapper.Interop
{ {
var wirelessConnectionStatus = WirelessConnectionStatus; var wirelessConnectionStatus = WirelessConnectionStatus;
} }
catch (Exception) { catch (Exception)
{
IsWireless = false; IsWireless = false;
}; }
} }
public int WirelessConnectionStatus public int WirelessConnectionStatus
{ {
get { get
{
if (IsWireless) if (IsWireless)
{ {
IntPtr handle = IntPtr.Zero; IntPtr handle = IntPtr.Zero;
@@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.NetworkInformation;
using System.Management; using System.Management;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Xml; using System.Xml;
@@ -30,7 +30,7 @@ namespace Disco.ClientBootstrapper.Interop
private static extern int LookupPrivilegeValue(string lpsystemname, string lpname, [MarshalAs(UnmanagedType.Struct)] ref LUID lpLuid); private static extern int LookupPrivilegeValue(string lpsystemname, string lpname, [MarshalAs(UnmanagedType.Struct)] ref LUID lpLuid);
[DllImport("advapi32.dll", CharSet = CharSet.Auto)] [DllImport("advapi32.dll", CharSet = CharSet.Auto)]
private static extern int AdjustTokenPrivileges(int tokenhandle, int disableprivs, [MarshalAs(UnmanagedType.Struct)]ref TOKEN_PRIVILEGES Newstate, int bufferlength, int PreivousState, int Returnlength); private static extern int AdjustTokenPrivileges(int tokenhandle, int disableprivs, [MarshalAs(UnmanagedType.Struct)] ref TOKEN_PRIVILEGES Newstate, int bufferlength, int PreivousState, int Returnlength);
[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern int RegLoadKey(uint hKey, string lpSubKey, string lpFile); private static extern int RegLoadKey(uint hKey, string lpSubKey, string lpFile);
@@ -649,7 +649,8 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
///Private null constructor ///Private null constructor
///</summary> ///</summary>
private private
NativeMethods() { } NativeMethods()
{ }
[DllImport("Wimgapi.dll", ExactSpelling = true, [DllImport("Wimgapi.dll", ExactSpelling = true,
EntryPoint = "WIMCreateFile", EntryPoint = "WIMCreateFile",
@@ -1435,7 +1436,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
///Abort. ///Abort.
///</summary> ///</summary>
Abort = NativeMethods.WIMMessage.WIM_MSG_ABORT_IMAGE, Abort = NativeMethods.WIMMessage.WIM_MSG_ABORT_IMAGE,
MountCleanupProgress = NativeMethods.WIMMessage.WIM_MSG_MOUNT_CLEANUP_PROGRESS MountCleanupProgress = NativeMethods.WIMMessage.WIM_MSG_MOUNT_CLEANUP_PROGRESS
} }
+10 -11
View File
@@ -118,18 +118,17 @@ namespace Disco.ClientBootstrapper
SleepThread(4000, true); SleepThread(4000, true);
Interop.ShutdownInterop.Shutdown(); Interop.ShutdownInterop.Shutdown();
} }
else if (PostBootstrapperActions.Contains("Reboot"))
{
Status.UpdateStatus("System Preparation (Bootstrapper)", "Rebooting; Finished...", string.Empty, false, 0);
SleepThread(4000, true);
Interop.ShutdownInterop.Reboot();
}
else else
if (PostBootstrapperActions.Contains("Reboot")) {
{ Status.UpdateStatus("System Preparation (Bootstrapper)", "Starting System; Finished...", string.Empty, false, 0);
Status.UpdateStatus("System Preparation (Bootstrapper)", "Rebooting; Finished...", string.Empty, false, 0); SleepThread(2000, true);
SleepThread(4000, true); }
Interop.ShutdownInterop.Reboot();
}
else
{
Status.UpdateStatus("System Preparation (Bootstrapper)", "Starting System; Finished...", string.Empty, false, 0);
SleepThread(2000, true);
}
} }
else else
{ {
@@ -35,7 +35,8 @@ namespace Disco.Data.Configuration.Modules
public bool? SearchAllServers public bool? SearchAllServers
{ {
get { get
{
var value = Get<bool?>(null); var value = Get<bool?>(null);
/// migrate <see cref="SearchAllForestServers"/> /// migrate <see cref="SearchAllForestServers"/>
@@ -58,7 +58,7 @@ namespace Disco.Data.Configuration
if (result == null) if (result == null)
{ {
var appDataPath = System.Web.HttpContext.Current.Server.MapPath("~/App_Data"); var appDataPath = System.Web.HttpContext.Current.Server.MapPath("~/App_Data");
if (!appDataPath.EndsWith(@"\")) if (!appDataPath.EndsWith(@"\"))
appDataPath += @"\"; appDataPath += @"\";
@@ -1,7 +1,7 @@
using System; using Microsoft.Win32;
using System.Data.Entity.Infrastructure; using System;
using Microsoft.Win32;
using System.Data.Common; using System.Data.Common;
using System.Data.Entity.Infrastructure;
using System.Security; using System.Security;
namespace Disco.Data.Repository namespace Disco.Data.Repository
@@ -1,11 +1,11 @@
using System; using Disco.Models.Repository;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Data.Objects;
using System.Linq; using System.Linq;
using System.Reactive.Subjects; using System.Reactive.Subjects;
using System.Data.Entity.Infrastructure;
using System.Collections.Concurrent;
using System.Data.Objects;
using Disco.Models.Repository;
namespace Disco.Data.Repository.Monitor namespace Disco.Data.Repository.Monitor
{ {
@@ -52,7 +52,8 @@ namespace Disco.Data.Repository.Monitor
return (T)dbEntityState.CurrentValues[PropertyName]; return (T)dbEntityState.CurrentValues[PropertyName];
} }
public void ExecuteAfterCommit(Action<RepositoryMonitorEvent> action){ public void ExecuteAfterCommit(Action<RepositoryMonitorEvent> action)
{
if (afterCommit) if (afterCommit)
{ {
// Execute Immediately // Execute Immediately
@@ -3,7 +3,7 @@
public class ComputerSystem public class ComputerSystem
{ {
public string ChassisSKUNumber { get; set; } public string ChassisSKUNumber { get; set; }
public short? CurrentTimeZone { get; set;} public short? CurrentTimeZone { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string[] OEMStringArray { get; set; } public string[] OEMStringArray { get; set; }
public string PCSystemType { get; set; } public string PCSystemType { get; set; }
@@ -19,7 +19,7 @@ namespace Disco.Models.ClientServices.EnrolmentInformation
public string WlanStatus { get; set; } public string WlanStatus { get; set; }
public bool NetEnabled { get; set; } public bool NetEnabled { get; set; }
public bool IPEnabled { get; set; } public bool IPEnabled { get; set; }
public List<string> IPAddresses { get; set; } public List<string> IPAddresses { get; set; }
} }
} }
+1 -1
View File
@@ -11,7 +11,7 @@
public string DeviceUUID { get; set; } public string DeviceUUID { get; set; }
public string DeviceComputerName { get; set; } public string DeviceComputerName { get; set; }
public string DeviceManufacturer { get; set; } public string DeviceManufacturer { get; set; }
public string DeviceModel { get; set; } public string DeviceModel { get; set; }
public string DeviceModelType { get; set; } public string DeviceModelType { get; set; }
@@ -3,7 +3,7 @@
public class MacEnrolResponse public class MacEnrolResponse
{ {
public string DeviceComputerName { get; set; } public string DeviceComputerName { get; set; }
public string DeviceAssignedUserDomain { get; set; } public string DeviceAssignedUserDomain { get; set; }
public string DeviceAssignedUserName { get; set; } public string DeviceAssignedUserName { get; set; }
public string DeviceAssignedUserSID { get; set; } public string DeviceAssignedUserSID { get; set; }
@@ -3,7 +3,7 @@
public class MacSecureEnrolResponse public class MacSecureEnrolResponse
{ {
public string DeviceComputerName { get; set; } public string DeviceComputerName { get; set; }
public string DeviceAssignedUserDomain { get; set; } public string DeviceAssignedUserDomain { get; set; }
public string DeviceAssignedUserName { get; set; } public string DeviceAssignedUserName { get; set; }
public string DeviceAssignedUserSID { get; set; } public string DeviceAssignedUserSID { get; set; }
+2 -2
View File
@@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Disco.Models.Repository namespace Disco.Models.Repository
{ {
@@ -51,7 +51,7 @@ namespace Disco.Models.Repository
[InverseProperty(nameof(Job.Device))] [InverseProperty(nameof(Job.Device))]
public virtual IList<Job> Jobs { get; set; } public virtual IList<Job> Jobs { get; set; }
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; } public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
[InverseProperty(nameof(DeviceComment.Device))] [InverseProperty(nameof(DeviceComment.Device))]
public virtual IList<DeviceComment> DeviceComments { get; set; } public virtual IList<DeviceComment> DeviceComments { get; set; }
@@ -15,10 +15,10 @@ namespace Disco.Models.Repository
public DateTime Timestamp { get; set; } public DateTime Timestamp { get; set; }
[Required] [Required]
public string Comments { get; set; } public string Comments { get; set; }
[ForeignKey(nameof(DeviceSerialNumber))] [ForeignKey(nameof(DeviceSerialNumber))]
public Device Device { get; set; } public Device Device { get; set; }
[ForeignKey(nameof(TechUserId))] [ForeignKey(nameof(TechUserId))]
public User TechUser { get; set; } public User TechUser { get; set; }
} }
@@ -12,10 +12,10 @@ namespace Disco.Models.Repository
[StringLength(100)] [StringLength(100)]
public string Description { get; set; } public string Description { get; set; }
public decimal Cost { get; set; } public decimal Cost { get; set; }
[ForeignKey("DeviceModelId")] [ForeignKey("DeviceModelId")]
public virtual DeviceModel DeviceModel { get; set; } public virtual DeviceModel DeviceModel { get; set; }
public virtual IList<JobSubType> JobSubTypes { get; set; } public virtual IList<JobSubType> JobSubTypes { get; set; }
} }
} }
@@ -24,13 +24,13 @@ namespace Disco.Models.Repository
[Column(Order = 0), Key] [Column(Order = 0), Key]
public string DeviceSerialNumber { get; set; } public string DeviceSerialNumber { get; set; }
[Key, StringLength(100), Column(Order = 2)] [Key, StringLength(100), Column(Order = 2)]
public string Key { get; set; } public string Key { get; set; }
[Column(Order = 1), StringLength(100), Key] [Column(Order = 1), StringLength(100), Key]
public string Scope { get; set; } public string Scope { get; set; }
public string Value { get; set; } public string Value { get; set; }
[ForeignKey("DeviceSerialNumber")] [ForeignKey("DeviceSerialNumber")]
@@ -23,7 +23,7 @@ namespace Disco.Models.Repository
// 2012-06-14 G# // 2012-06-14 G#
[Required, DataType(DataType.MultilineText)] [Required, DataType(DataType.MultilineText)]
public string ComputerNameTemplate { get; set; } public string ComputerNameTemplate { get; set; }
[Required] [Required]
public DistributionTypes? DistributionType { get; set; } public DistributionTypes? DistributionType { get; set; }
+1 -1
View File
@@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Disco.Models.Repository namespace Disco.Models.Repository
{ {
+1 -1
View File
@@ -41,6 +41,6 @@ namespace Disco.Models.Repository
public virtual User TechUser { get; set; } public virtual User TechUser { get; set; }
[ForeignKey("DocumentTemplateId")] [ForeignKey("DocumentTemplateId")]
public virtual DocumentTemplate DocumentTemplate { get; set; } public virtual DocumentTemplate DocumentTemplate { get; set; }
} }
} }
+2 -2
View File
@@ -14,10 +14,10 @@ namespace Disco.Models.Repository
[StringLength(500)] [StringLength(500)]
public string Description { get; set; } public string Description { get; set; }
public decimal Cost { get; set; } public decimal Cost { get; set; }
[ForeignKey("JobId")] [ForeignKey("JobId")]
public virtual Job Job { get; set; } public virtual Job Job { get; set; }
[ForeignKey("TechUserId")] [ForeignKey("TechUserId")]
public virtual User TechUser { get; set; } public virtual User TechUser { get; set; }
} }
+2 -2
View File
@@ -15,10 +15,10 @@ namespace Disco.Models.Repository
public DateTime Timestamp { get; set; } public DateTime Timestamp { get; set; }
[Required] [Required]
public string Comments { get; set; } public string Comments { get; set; }
[ForeignKey("JobId")] [ForeignKey("JobId")]
public Job Job { get; set; } public Job Job { get; set; }
[ForeignKey("TechUserId")] [ForeignKey("TechUserId")]
public User TechUser { get; set; } public User TechUser { get; set; }
} }
@@ -59,7 +59,7 @@ namespace Disco.Models.Repository
public string Insurer { get; set; } public string Insurer { get; set; }
[StringLength(200)] [StringLength(200)]
public string InsurerReference { get; set; } public string InsurerReference { get; set; }
[Required, ForeignKey("JobId")] [Required, ForeignKey("JobId")]
public virtual Job Job { get; set; } public virtual Job Job { get; set; }
@@ -17,7 +17,7 @@ namespace Disco.Models.Repository
public string ExternalReference { get; set; } public string ExternalReference { get; set; }
[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? ExternalCompletedDate { get; set; } public DateTime? ExternalCompletedDate { get; set; }
[ForeignKey("JobId"), Required] [ForeignKey("JobId"), Required]
public virtual Job Job { get; set; } public virtual Job Job { get; set; }
} }
+1 -1
View File
@@ -9,7 +9,7 @@ namespace Disco.Models.Repository
public string Id { get; set; } public string Id { get; set; }
[StringLength(100)] [StringLength(100)]
public string Description { get; set; } public string Description { get; set; }
public virtual IList<JobSubType> JobSubTypes { get; set; } public virtual IList<JobSubType> JobSubTypes { get; set; }
public override string ToString() public override string ToString()
@@ -12,13 +12,13 @@ namespace Disco.Models.Repository
public int JobQueueId { get; set; } public int JobQueueId { get; set; }
[Required] [Required]
public int JobId { get; set; } public int JobId { get; set; }
[Required] [Required]
public DateTime AddedDate { get; set; } public DateTime AddedDate { get; set; }
[Required] [Required]
public string AddedUserId { get; set; } public string AddedUserId { get; set; }
public string AddedComment { get; set; } public string AddedComment { get; set; }
public DateTime? RemovedDate { get; set; } public DateTime? RemovedDate { get; set; }
public string RemovedUserId { get; set; } public string RemovedUserId { get; set; }
public string RemovedComment { get; set; } public string RemovedComment { get; set; }
+1 -1
View File
@@ -39,7 +39,7 @@ namespace Disco.Models.Repository
return DomainUsername; return DomainUsername;
} }
} }
[NotMapped] [NotMapped]
public string DomainUsername public string DomainUsername
{ {
+2 -2
View File
@@ -15,10 +15,10 @@ namespace Disco.Models.Repository
public DateTime Timestamp { get; set; } public DateTime Timestamp { get; set; }
[Required] [Required]
public string Comments { get; set; } public string Comments { get; set; }
[ForeignKey(nameof(UserId))] [ForeignKey(nameof(UserId))]
public User User { get; set; } public User User { get; set; }
[ForeignKey(nameof(TechUserId))] [ForeignKey(nameof(TechUserId))]
public User TechUser { get; set; } public User TechUser { get; set; }
} }
+2 -2
View File
@@ -7,10 +7,10 @@ namespace Disco.Models.Repository
{ {
[Key, Column(Order = 0)] [Key, Column(Order = 0)]
public string UserId { get; set; } public string UserId { get; set; }
[Column(Order = 1), Key, StringLength(100)] [Column(Order = 1), Key, StringLength(100)]
public string Scope { get; set; } public string Scope { get; set; }
[Key, Column(Order = 2), StringLength(100)] [Key, Column(Order = 2), StringLength(100)]
public string Key { get; set; } public string Key { get; set; }
@@ -6,7 +6,7 @@ namespace Disco.Models.Services.Devices.Importing
{ {
DeviceImportFieldTypes FieldType { get; } DeviceImportFieldTypes FieldType { get; }
EntityState? FieldAction { get; } EntityState? FieldAction { get; }
string ErrorMessage { get; } string ErrorMessage { get; }
object RawParsedValue { get; } object RawParsedValue { get; }
@@ -11,7 +11,7 @@ namespace Disco.Models.Services.Documents
public IAttachmentTarget AttachmentTarget { get; set; } public IAttachmentTarget AttachmentTarget { get; set; }
public Device Device { get; set; } public Device Device { get; set; }
public Job Job { get; set; } public Job Job { get; set; }
public string JobStatus { get; set; } public string JobStatus { get; set; }
public string JobTypeDescription { get; set; } public string JobTypeDescription { get; set; }
@@ -6,7 +6,7 @@ namespace Disco.Models.Services.Interop.DiscoServices
{ {
public string PluginId { get; set; } public string PluginId { get; set; }
public Version Version { get; set; } public Version Version { get; set; }
public string Reason { get; set; } public string Reason { get; set; }
} }
} }
@@ -42,7 +42,7 @@ namespace Disco.Models.Services.Users.Contact
return false; return false;
} }
var result = match.Value; var result = match.Value;
var name = default(string); var name = default(string);
if (match.Index > 0) if (match.Index > 0)
{ {
+1 -1
View File
@@ -14,7 +14,7 @@ namespace Disco.Models.UI.User
List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; } List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; }
List<UserFlag> AvailableUserFlags { get; set; } List<UserFlag> AvailableUserFlags { get; set; }
IAuthorizationToken AuthorizationToken { get; set; } IAuthorizationToken AuthorizationToken { get; set; }
IClaimNavigatorItem ClaimNavigator { get; set; } IClaimNavigatorItem ClaimNavigator { get; set; }
Dictionary<string, string> UserDetails { get; set; } Dictionary<string, string> UserDetails { get; set; }
@@ -1,14 +1,18 @@
using RazorGenerator.Mvc;
using System.Web; using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
using System.Web.WebPages; using System.Web.WebPages;
using RazorGenerator.Mvc;
[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(Disco.Services.App_Start.RazorGeneratorMvcStart), "Start")] [assembly: WebActivatorEx.PostApplicationStartMethod(typeof(Disco.Services.App_Start.RazorGeneratorMvcStart), "Start")]
namespace Disco.Services.App_Start { namespace Disco.Services.App_Start
public static class RazorGeneratorMvcStart { {
public static void Start() { public static class RazorGeneratorMvcStart
var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { {
public static void Start()
{
var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly)
{
UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
}; };
@@ -43,7 +43,7 @@ namespace Disco.Services.Authorization
Name = "Access Denied", Name = "Access Denied",
Format = "User: {0}; Resource: {1}; Reason: {2}", Format = "User: {0}; Resource: {1}; Reason: {2}",
Severity = (int)LogEventType.Severities.Warning, Severity = (int)LogEventType.Severities.Warning,
UseLive = true, UsePersist = true, UseDisplay = true UseLive = true, UsePersist = true, UseDisplay = true
}, },
new LogEventType() { new LogEventType() {
Id = (int)EventTypeIds.RoleCreated, Id = (int)EventTypeIds.RoleCreated,
@@ -1,5 +1,5 @@
using Disco.Models.Services.Authorization; using Disco.Models.Repository;
using Disco.Models.Repository; using Disco.Models.Services.Authorization;
using Disco.Services.Authorization.Roles; using Disco.Services.Authorization.Roles;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -9,7 +9,7 @@ namespace Disco.Services.Authorization
public class ClaimNavigatorItem : IClaimNavigatorItem public class ClaimNavigatorItem : IClaimNavigatorItem
{ {
private Func<RoleClaims, bool> accessor { get; set; } private Func<RoleClaims, bool> accessor { get; set; }
public string Key { get; private set; } public string Key { get; private set; }
public string Name { get; private set; } public string Name { get; private set; }
public string Description { get; private set; } public string Description { get; private set; }
@@ -49,15 +49,15 @@ namespace Disco.Services.Authorization
public IClaimNavigatorItem BuildClaimTree(RoleClaims RoleClaims) public IClaimNavigatorItem BuildClaimTree(RoleClaims RoleClaims)
{ {
return new ClaimNavigatorItem() return new ClaimNavigatorItem()
{ {
Key = Key, Key = Key,
Name = Name, Name = Name,
Description = Description, Description = Description,
Hidden = Hidden, Hidden = Hidden,
accessor = accessor, accessor = accessor,
Value = accessor == null ? (bool?)null : accessor(RoleClaims), Value = accessor == null ? (bool?)null : accessor(RoleClaims),
Children = Children == null ? null : Children.Cast<ClaimNavigatorItem>().Select(c => c.BuildClaimTree(RoleClaims)).ToList() Children = Children == null ? null : Children.Cast<ClaimNavigatorItem>().Select(c => c.BuildClaimTree(RoleClaims)).ToList()
}; };
} }
public IClaimNavigatorItem BuildClaimTree(IEnumerable<RoleClaims> RoleClaims) public IClaimNavigatorItem BuildClaimTree(IEnumerable<RoleClaims> RoleClaims)
@@ -30,11 +30,10 @@ namespace Disco.Services.Authorization
if (UserService.CurrentAuthorization == null) if (UserService.CurrentAuthorization == null)
resultMessage = AuthorizationToken.RequireAuthenticationMessage; resultMessage = AuthorizationToken.RequireAuthenticationMessage;
else if (string.IsNullOrEmpty(authorizedClaim))
resultMessage = AuthorizationToken.RequireDiscoAuthorizationMessage;
else else
if (string.IsNullOrEmpty(authorizedClaim)) resultMessage = AuthorizationToken.BuildRequireMessage(authorizedClaim);
resultMessage = AuthorizationToken.RequireDiscoAuthorizationMessage;
else
resultMessage = AuthorizationToken.BuildRequireMessage(authorizedClaim);
return resultMessage; return resultMessage;
} }
@@ -26,7 +26,7 @@
[ClaimDetails("Bulk Generate Document Templates", "Can bulk generate document templates")] [ClaimDetails("Bulk Generate Document Templates", "Can bulk generate document templates")]
public bool BulkGenerate { get; set; } public bool BulkGenerate { get; set; }
[ClaimDetails("Export Attachment Instances", "Can export document attachment instances")] [ClaimDetails("Export Attachment Instances", "Can export document attachment instances")]
public bool Export { get; set; } public bool Export { get; set; }
@@ -8,7 +8,7 @@
[ClaimDetails("Configure Proxy Settings", "Can configure the proxy settings")] [ClaimDetails("Configure Proxy Settings", "Can configure the proxy settings")]
public bool ConfigureProxy { get; set; } public bool ConfigureProxy { get; set; }
[ClaimDetails("Configure Email Settings", "Can configure the email settings")] [ClaimDetails("Configure Email Settings", "Can configure the email settings")]
public bool ConfigureEmail { get; set; } public bool ConfigureEmail { get; set; }
@@ -24,7 +24,7 @@
public bool DevicesReadyForReturn { get; set; } public bool DevicesReadyForReturn { get; set; }
[ClaimDetails("Devices Awaiting Repair List", "Can show list")] [ClaimDetails("Devices Awaiting Repair List", "Can show list")]
public bool DevicesAwaitingRepair { get; set; } public bool DevicesAwaitingRepair { get; set; }
[ClaimDetails("Awaiting Finance List", "Can show list")] [ClaimDetails("Awaiting Finance List", "Can show list")]
public bool AwaitingFinance { get; set; } public bool AwaitingFinance { get; set; }
@@ -36,7 +36,7 @@
public bool AwaitingFinanceInsuranceProcessing { get; set; } public bool AwaitingFinanceInsuranceProcessing { get; set; }
[ClaimDetails("Awaiting Finance Agreement Breach List", "Can show list (NOTE: Requires Awaiting Finance List)")] [ClaimDetails("Awaiting Finance Agreement Breach List", "Can show list (NOTE: Requires Awaiting Finance List)")]
public bool AwaitingFinanceAgreementBreach { get; set; } public bool AwaitingFinanceAgreementBreach { get; set; }
[ClaimDetails("Awaiting User Action List", "Can show list")] [ClaimDetails("Awaiting User Action List", "Can show list")]
public bool AwaitingUserAction { get; set; } public bool AwaitingUserAction { get; set; }
[ClaimDetails("Recently Closed List", "Can show list")] [ClaimDetails("Recently Closed List", "Can show list")]
@@ -17,7 +17,7 @@
public bool ShowSImg { get; set; } public bool ShowSImg { get; set; }
[ClaimDetails("Show Software - Operating System Jobs", "Can show jobs of this type")] [ClaimDetails("Show Software - Operating System Jobs", "Can show jobs of this type")]
public bool ShowSOS { get; set; } public bool ShowSOS { get; set; }
[ClaimDetails("Show User Management Jobs", "Can show jobs of this type")] [ClaimDetails("Show User Management Jobs", "Can show jobs of this type")]
public bool ShowUMgmt { get; set; } public bool ShowUMgmt { get; set; }
@@ -1,11 +1,11 @@
using Disco.Data.Repository; using Disco.Data.Repository;
using Disco.Models.Services.Authorization;
using Disco.Models.Repository; using Disco.Models.Repository;
using Disco.Models.Services.Authorization;
using Disco.Services.Interop.ActiveDirectory;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Disco.Services.Interop.ActiveDirectory;
using Newtonsoft.Json;
namespace Disco.Services.Authorization.Roles namespace Disco.Services.Authorization.Roles
{ {
@@ -156,7 +156,7 @@ namespace Disco.Services.Authorization.Roles
{ {
// Determine roles which need migration from DBv11 -> DBv14 // Determine roles which need migration from DBv11 -> DBv14
var affectedRoles_DBv14 = Database.AuthorizationRoles.Where(r => !r.ClaimsJson.Contains("MyJobs")).ToList(); var affectedRoles_DBv14 = Database.AuthorizationRoles.Where(r => !r.ClaimsJson.Contains("MyJobs")).ToList();
// Determine roles which need migration from DBv14 -> DBv15 // Determine roles which need migration from DBv14 -> DBv15
var affectedRoles_DBv15 = Database.AuthorizationRoles.Where(r => !r.ClaimsJson.Contains("RepairProviderDetails")).ToList(); var affectedRoles_DBv15 = Database.AuthorizationRoles.Where(r => !r.ClaimsJson.Contains("RepairProviderDetails")).ToList();
@@ -1,5 +1,5 @@
using Disco.Models.Services.Authorization; using Disco.Models.Repository;
using Disco.Models.Repository; using Disco.Models.Services.Authorization;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -20,7 +20,7 @@ namespace Disco.Services.Authorization.Roles
return FromAuthorizationRole(Role, claims); return FromAuthorizationRole(Role, claims);
} }
internal static RoleToken FromAuthorizationRole(AuthorizationRole Role, RoleClaims Claims) internal static RoleToken FromAuthorizationRole(AuthorizationRole Role, RoleClaims Claims)
{ {
string[] sg = (Role.SubjectIds == null ? new string[0] : Role.SubjectIds.Split(',').ToArray()); string[] sg = (Role.SubjectIds == null ? new string[0] : Role.SubjectIds.Split(',').ToArray());
@@ -111,7 +111,7 @@ namespace Disco.Services.Devices.DeviceFlags
var assignment = (DeviceFlagAssignment)Event.Entity; var assignment = (DeviceFlagAssignment)Event.Entity;
var domainId = assignment.Device?.DeviceDomainId; var domainId = assignment.Device?.DeviceDomainId;
if (!ActiveDirectory.IsValidDomainAccountId(domainId)) if (!ActiveDirectory.IsValidDomainAccountId(domainId))
return; return;
domainId += "$"; domainId += "$";
@@ -189,7 +189,7 @@ namespace Disco.Services.Devices.DeviceFlags
status.UpdateStatus((chunkIndexOffset + index) * progressInterval, $"Removing Flag: {flagAssignment.Device}"); status.UpdateStatus((chunkIndexOffset + index) * progressInterval, $"Removing Flag: {flagAssignment.Device}");
flagAssignment.OnRemoveUnsafe(database, technician); flagAssignment.OnRemoveUnsafe(database, technician);
return flagAssignment; return flagAssignment;
}).ToList(); }).ToList();
@@ -8,7 +8,7 @@ namespace Disco.Services.Devices.DeviceFlags
{ {
public override string TaskName { get { return "Device Flags - Delete Flag"; } } public override string TaskName { get { return "Device Flags - Delete Flag"; } }
public override bool SingleInstanceTask { get { return false; }} public override bool SingleInstanceTask { get { return false; } }
public override bool CancelInitiallySupported { get { return false; } } public override bool CancelInitiallySupported { get { return false; } }
public override bool LogExceptionsOnly { get { return true; } } public override bool LogExceptionsOnly { get { return true; } }
@@ -168,7 +168,7 @@ namespace Disco.Services.Devices.Enrolment
Request.Hardware.Model, Request.Hardware.Model,
Request.Hardware.ModelType); Request.Hardware.ModelType);
} }
public static void LogSessionProgress(string SessionId, int Progress, string Status) public static void LogSessionProgress(string SessionId, int Progress, string Status)
{ {
Log(EventTypeIds.SessionProgress, new object[] Log(EventTypeIds.SessionProgress, new object[]
@@ -35,7 +35,7 @@ namespace Disco.Services.Devices.Importing.Fields
else if (ExistingDevice != null) else if (ExistingDevice != null)
{ {
var detail = ExistingDevice.DeviceDetails.FirstOrDefault(dd => dd.Scope == DeviceDetail.ScopeHardware && dd.Key == DeviceDetail.HardwareKeyACAdapter); var detail = ExistingDevice.DeviceDetails.FirstOrDefault(dd => dd.Scope == DeviceDetail.ScopeHardware && dd.Key == DeviceDetail.HardwareKeyACAdapter);
if (detail == null && parsedValue == null) if (detail == null && parsedValue == null)
return Success(EntityState.Unchanged); return Success(EntityState.Unchanged);
else if (detail == null && parsedValue != null) else if (detail == null && parsedValue != null)
@@ -35,7 +35,7 @@ namespace Disco.Services.Devices.Importing.Fields
else if (ExistingDevice != null) else if (ExistingDevice != null)
{ {
var detail = ExistingDevice.DeviceDetails.FirstOrDefault(dd => dd.Scope == DeviceDetail.ScopeHardware && dd.Key == DeviceDetail.HardwareKeyWLanMacAddress); var detail = ExistingDevice.DeviceDetails.FirstOrDefault(dd => dd.Scope == DeviceDetail.ScopeHardware && dd.Key == DeviceDetail.HardwareKeyWLanMacAddress);
if (detail == null && parsedValue == null) if (detail == null && parsedValue == null)
return Success(EntityState.Unchanged); return Success(EntityState.Unchanged);
else if (detail == null && parsedValue != null) else if (detail == null && parsedValue != null)
@@ -16,7 +16,7 @@ namespace Disco.Services.Devices.ManagedGroups
private const string DescriptionFormat = "Devices within the {0} Batch will have their assigned users added to this Active Directory group."; private const string DescriptionFormat = "Devices within the {0} Batch will have their assigned users added to this Active Directory group.";
private const string CategoryDescriptionFormat = "Assigned Users Linked Group"; private const string CategoryDescriptionFormat = "Assigned Users Linked Group";
private const string GroupDescriptionFormat = "{0} [Device Batch Assigned Users]"; private const string GroupDescriptionFormat = "{0} [Device Batch Assigned Users]";
private static Lazy<IObservable<RepositoryMonitorEvent>> RepositoryEvents; private static Lazy<IObservable<RepositoryMonitorEvent>> RepositoryEvents;
private IDisposable repositorySubscription; private IDisposable repositorySubscription;
@@ -16,7 +16,7 @@ namespace Disco.Services.Devices.ManagedGroups
private const string DescriptionFormat = "Devices within the {0} Profile will have their assigned users added to this Active Directory group."; private const string DescriptionFormat = "Devices within the {0} Profile will have their assigned users added to this Active Directory group.";
private const string CategoryDescriptionFormat = "Assigned Users Linked Group"; private const string CategoryDescriptionFormat = "Assigned Users Linked Group";
private const string GroupDescriptionFormat = "{0} [Device Profile Assigned Users]"; private const string GroupDescriptionFormat = "{0} [Device Profile Assigned Users]";
private static Lazy<IObservable<RepositoryMonitorEvent>> RepositoryEvents; private static Lazy<IObservable<RepositoryMonitorEvent>> RepositoryEvents;
private IDisposable repositorySubscription; private IDisposable repositorySubscription;
@@ -16,7 +16,7 @@ namespace Disco.Services.Devices.ManagedGroups
private const string DescriptionFormat = "Devices within the {0} Profile will be added to this Active Directory group."; private const string DescriptionFormat = "Devices within the {0} Profile will be added to this Active Directory group.";
private const string CategoryDescriptionFormat = "Devices Linked Group"; private const string CategoryDescriptionFormat = "Devices Linked Group";
private const string GroupDescriptionFormat = "{0} [Device Profile Devices]"; private const string GroupDescriptionFormat = "{0} [Device Profile Devices]";
private static Lazy<IObservable<RepositoryMonitorEvent>> RepositoryEvents; private static Lazy<IObservable<RepositoryMonitorEvent>> RepositoryEvents;
private IDisposable repositorySubscription; private IDisposable repositorySubscription;
@@ -270,7 +270,7 @@ namespace Disco.Services.Documents.AttachmentImport
{ {
var rules = Identifier.DocumentTemplate.GetOnImportUserFlagRules(); var rules = Identifier.DocumentTemplate.GetOnImportUserFlagRules();
foreach ( var rule in rules) foreach (var rule in rules)
{ {
rule.Apply(Database, Identifier.Target, creatorUser); rule.Apply(Database, Identifier.Target, creatorUser);
} }
+1 -1
View File
@@ -249,7 +249,7 @@ namespace Disco.Services.Documents
{ {
var query = database.UserAttachments var query = database.UserAttachments
.Include(a => a.User); .Include(a => a.User);
if (Options.HasDeviceOptions()) if (Options.HasDeviceOptions())
query = query.Include(a => a.User.DeviceUserAssignments.Select(u => u.Device)); query = query.Include(a => a.User.DeviceUserAssignments.Select(u => u.Device));
if (Options.HasDeviceBatchOptions()) if (Options.HasDeviceBatchOptions())
@@ -20,9 +20,8 @@ namespace Disco.Services.Expressions
{ {
if (expressionParseException == null) if (expressionParseException == null)
return null; return null;
else else if (evaluateParseException == null)
if (evaluateParseException == null) evaluateParseException = EvaluateExpressionParseException.FromRecognitionException(expressionParseException, Source);
evaluateParseException = EvaluateExpressionParseException.FromRecognitionException(expressionParseException, Source);
return evaluateParseException; return evaluateParseException;
} }
} }
@@ -24,10 +24,10 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
public override MemoryStream GetImage(out int width, out int height) public override MemoryStream GetImage(out int width, out int height)
{ {
var image = Image; var image = Image;
width = image.Width; width = image.Width;
height = image.Height; height = image.Height;
return OutputBitmapImage(image); return OutputBitmapImage(image);
} }
} }
@@ -53,7 +53,8 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
{ {
maxWidth = images.Sum(i => i.Width); maxWidth = images.Sum(i => i.Width);
maxHeight = images.Max(i => i.Height); maxHeight = images.Max(i => i.Height);
}else if (MontageVerticalLayout) }
else if (MontageVerticalLayout)
{ {
maxWidth = images.Max(i => i.Width); maxWidth = images.Max(i => i.Width);
maxHeight = images.Sum(i => i.Height); maxHeight = images.Sum(i => i.Height);
@@ -2,14 +2,14 @@ using System.Collections;
namespace Disco.Services.Expressions namespace Disco.Services.Expressions
{ {
public interface IExpressionPart public interface IExpressionPart
{ {
string RawSource { get; set; } string RawSource { get; set; }
string Source { get; set; } string Source { get; set; }
bool ErrorsAllowed { get; set; } bool ErrorsAllowed { get; set; }
bool ParseError { get; } bool ParseError { get; }
string ParseErrorMessage { get; } string ParseErrorMessage { get; }
bool IsDynamic { get; set; } bool IsDynamic { get; set; }
object Evaluate(object ExpressionContext, IDictionary Variables); object Evaluate(object ExpressionContext, IDictionary Variables);
} }
} }
@@ -50,7 +50,7 @@ namespace Disco
IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator()
=> new OneOfEnumerator(instance); => new OneOfEnumerator(instance);
private struct OneOfEnumerator : IEnumerator<T> private struct OneOfEnumerator : IEnumerator<T>
{ {
private readonly T instance; private readonly T instance;
@@ -178,7 +178,7 @@ namespace Disco.Services
public static void DrawImageResized(this Graphics graphics, Image SourceImage, float Scale, float LocationX, float LocationY) public static void DrawImageResized(this Graphics graphics, Image SourceImage, float Scale, float LocationX, float LocationY)
{ {
RectangleF clipBounds = graphics.VisibleClipBounds; RectangleF clipBounds = graphics.VisibleClipBounds;
float width = SourceImage.Width * Scale, float width = SourceImage.Width * Scale,
height = SourceImage.Height * Scale, height = SourceImage.Height * Scale,
x = LocationX, x = LocationX,
@@ -63,7 +63,7 @@ namespace Disco.Services.Interop.ActiveDirectory
ADDomain deviceDomain; ADDomain deviceDomain;
ActiveDirectory.ParseDomainAccountId(Device.DeviceDomainId + "$", out deviceSamAccountName, out deviceDomain); ActiveDirectory.ParseDomainAccountId(Device.DeviceDomainId + "$", out deviceSamAccountName, out deviceDomain);
var ldapFilter = string.Format(ldapFilterTemplate, ADHelpers.EscapeLdapQuery(deviceSamAccountName)); var ldapFilter = string.Format(ldapFilterTemplate, ADHelpers.EscapeLdapQuery(deviceSamAccountName));
IEnumerable<ADDomainController> domainControllers; IEnumerable<ADDomainController> domainControllers;
@@ -12,7 +12,7 @@ namespace Disco.Services.Interop.ActiveDirectory
private ConcurrentDictionary<SecurityIdentifier, Tuple<ADGroup, DateTime>> securityIdentifierCache; private ConcurrentDictionary<SecurityIdentifier, Tuple<ADGroup, DateTime>> securityIdentifierCache;
private ConcurrentDictionary<string, Tuple<ADGroup, DateTime>> distinguishedNameCache; private ConcurrentDictionary<string, Tuple<ADGroup, DateTime>> distinguishedNameCache;
private const long CacheTimeoutTicks = 6000000000; // 10 Minutes private const long CacheTimeoutTicks = 6000000000; // 10 Minutes
private const int CacheCleanIntervalMinutes = 15; private const int CacheCleanIntervalMinutes = 15;
private DateTime cacheCleanNext; private DateTime cacheCleanNext;
private object cacheCleanLock = new object(); private object cacheCleanLock = new object();
@@ -1,9 +1,9 @@
using System; using Disco.Data.Repository;
using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reactive.Subjects; using System.Reactive.Subjects;
using Disco.Data.Repository;
namespace Disco.Services.Interop.ActiveDirectory namespace Disco.Services.Interop.ActiveDirectory
{ {
@@ -468,7 +468,7 @@ namespace Disco.Services.Interop.ActiveDirectory
{ {
return new ADManagedGroupScheduledActionItem[] return new ADManagedGroupScheduledActionItem[]
{ {
new ADManagedGroupScheduledActionItem(ManagedGroup, ActionType, InvokingIdentifier) new ADManagedGroupScheduledActionItem(ManagedGroup, ActionType, InvokingIdentifier)
}; };
} }
} }
@@ -8,7 +8,7 @@ namespace Disco.Services.Interop.ActiveDirectory
string DistinguishedName { get; } string DistinguishedName { get; }
SecurityIdentifier SecurityIdentifier { get; } SecurityIdentifier SecurityIdentifier { get; }
string Id { get; } string Id { get; }
string SamAccountName { get; } string SamAccountName { get; }
@@ -15,9 +15,9 @@ using System.Text;
namespace Disco.Services.Interop.DiscoServices namespace Disco.Services.Interop.DiscoServices
{ {
using StatisticInt = UpdateRequestV2.StatisticInt; using StatisticInt = UpdateRequestV2.StatisticInt;
using StatisticIntPair = UpdateRequestV2.StatisticIntPair;
using StatisticJob = UpdateRequestV2.StatisticJob; using StatisticJob = UpdateRequestV2.StatisticJob;
using StatisticString = UpdateRequestV2.StatisticString; using StatisticString = UpdateRequestV2.StatisticString;
using StatisticIntPair = UpdateRequestV2.StatisticIntPair;
public static class UpdateQuery public static class UpdateQuery
{ {
+1 -1
View File
@@ -83,7 +83,7 @@ namespace Disco.Services
public static string JobStatusDescription(string StatusId, Job j) public static string JobStatusDescription(string StatusId, Job j)
=> JobStatusDescription(StatusId, j?.DeviceHeld, j?.JobMetaWarranty?.ExternalName, j?.JobMetaNonWarranty?.RepairerName); => JobStatusDescription(StatusId, j?.DeviceHeld, j?.JobMetaWarranty?.ExternalName, j?.JobMetaNonWarranty?.RepairerName);
public static string JobStatusDescription(string StatusId, JobTableStatusItemModel j) public static string JobStatusDescription(string StatusId, JobTableStatusItemModel j)
=> JobStatusDescription(StatusId, j?.DeviceHeld, j?.JobMetaWarranty_ExternalName, j?.JobMetaNonWarranty_RepairerName); => JobStatusDescription(StatusId, j?.DeviceHeld, j?.JobMetaWarranty_ExternalName, j?.JobMetaNonWarranty_RepairerName);
@@ -264,7 +264,7 @@ namespace Disco.Services
foreach (var j in items) foreach (var j in items)
{ {
j.UserFriendlyId =j.UserId == null ? null : ActiveDirectory.FriendlyAccountId(j.UserId); j.UserFriendlyId = j.UserId == null ? null : ActiveDirectory.FriendlyAccountId(j.UserId);
j.OpenedTechUserFriendlyId = ActiveDirectory.FriendlyAccountId(j.OpenedTechUserId); j.OpenedTechUserFriendlyId = ActiveDirectory.FriendlyAccountId(j.OpenedTechUserId);
if (j.DeviceAddressId.HasValue) if (j.DeviceAddressId.HasValue)
@@ -8,7 +8,7 @@ namespace Disco.Services.Jobs.JobQueues
{ {
public override string TaskName { get { return "Job Queues - Delete Queue"; } } public override string TaskName { get { return "Job Queues - Delete Queue"; } }
public override bool SingleInstanceTask { get { return false; }} public override bool SingleInstanceTask { get { return false; } }
public override bool CancelInitiallySupported { get { return false; } } public override bool CancelInitiallySupported { get { return false; } }
public override bool LogExceptionsOnly { get { return true; } } public override bool LogExceptionsOnly { get { return true; } }
+1 -1
View File
@@ -2,6 +2,7 @@
using Disco.Data.Repository.Monitor; using Disco.Data.Repository.Monitor;
using Disco.Models.Repository; using Disco.Models.Repository;
using Disco.Services.Authorization; using Disco.Services.Authorization;
using Disco.Services.Users;
using Disco.Services.Web.Signalling; using Disco.Services.Web.Signalling;
using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs; using Microsoft.AspNet.SignalR.Hubs;
@@ -9,7 +10,6 @@ using System;
using System.Linq; using System.Linq;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Disco.Services.Users;
namespace Disco.Services.Jobs namespace Disco.Services.Jobs
{ {
@@ -19,7 +19,7 @@ namespace Disco.Services.Jobs.Noticeboards
"DeviceSerialNumber", "DeviceSerialNumber",
"UserId", "UserId",
"ExpectedClosedDate", "ExpectedClosedDate",
"ClosedDate", "ClosedDate",
"WaitingForUserAction", "WaitingForUserAction",
"DeviceHeld", "DeviceHeld",
"DeviceReadyForReturn", "DeviceReadyForReturn",
+8 -8
View File
@@ -1,12 +1,12 @@
using System; using Disco.Data.Repository;
using System.Collections.Generic; using Newtonsoft.Json;
using System.Linq;
using Disco.Data.Repository;
using System.IO;
using System.Data.SqlServerCe;
using Quartz; using Quartz;
using Quartz.Impl; using Quartz.Impl;
using Newtonsoft.Json; using System;
using System.Collections.Generic;
using System.Data.SqlServerCe;
using System.IO;
using System.Linq;
namespace Disco.Services.Logging namespace Disco.Services.Logging
{ {
@@ -50,7 +50,7 @@ namespace Disco.Services.Logging
var appDomain = AppDomain.CurrentDomain; var appDomain = AppDomain.CurrentDomain;
var servicesAssemblyName = typeof(LogContext).Assembly.GetName().Name; var servicesAssemblyName = typeof(LogContext).Assembly.GetName().Name;
var logModuleTypes = appDomain.GetAssemblies() var logModuleTypes = appDomain.GetAssemblies()
.Where(a => !a.GlobalAssemblyCache && !a.IsDynamic && .Where(a => !a.GlobalAssemblyCache && !a.IsDynamic &&
(a.GetName().Name == servicesAssemblyName || a.GetReferencedAssemblies().Any(ra => ra.Name == servicesAssemblyName))) (a.GetName().Name == servicesAssemblyName || a.GetReferencedAssemblies().Any(ra => ra.Name == servicesAssemblyName)))
.SelectMany(a => a.GetTypes()) .SelectMany(a => a.GetTypes())
+2 -2
View File
@@ -1,5 +1,5 @@
using Quartz; using Disco.Data.Repository;
using Disco.Data.Repository; using Quartz;
namespace Disco.Services.Logging namespace Disco.Services.Logging
{ {
+1 -1
View File
@@ -15,7 +15,7 @@ namespace Disco.Services.Logging.Models
public int EventTypeId { get; set; } public int EventTypeId { get; set; }
[Required] [Required]
public DateTime Timestamp { get; set; } public DateTime Timestamp { get; set; }
[Column(TypeName="ntext"), MaxLength] [Column(TypeName = "ntext"), MaxLength]
public string Arguments { get; set; } public string Arguments { get; set; }
} }
} }
@@ -1,13 +1,13 @@
using System.Linq; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Disco.Services.Logging.Models namespace Disco.Services.Logging.Models
{ {
[Table("EventTypes")] [Table("EventTypes")]
public class LogEventType public class LogEventType
{ {
[Required, Key, Column(Order=0), DatabaseGenerated(DatabaseGeneratedOption.None)] [Required, Key, Column(Order = 0), DatabaseGenerated(DatabaseGeneratedOption.None)]
public int ModuleId { get; set; } public int ModuleId { get; set; }
[Required, Key, Column(Order = 1), DatabaseGenerated(DatabaseGeneratedOption.None)] [Required, Key, Column(Order = 1), DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Id { get; set; } public int Id { get; set; }
@@ -17,7 +17,7 @@ namespace Disco.Services.Logging.Models
public int Severity { get; set; } public int Severity { get; set; }
[MaxLength(1024)] [MaxLength(1024)]
public string Format { get; set; } public string Format { get; set; }
[NotMapped] [NotMapped]
public bool UsePersist { get; set; } public bool UsePersist { get; set; }
[NotMapped] [NotMapped]
@@ -1,6 +1,6 @@
using System; using Disco.Models.Exporting;
using Disco.Models.Exporting;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
namespace Disco.Services.Logging.Models namespace Disco.Services.Logging.Models
{ {
+4 -4
View File
@@ -1,9 +1,9 @@
using System; using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Microsoft.Win32.SafeHandles;
using System.Runtime.InteropServices;
using System.IO; using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Web.Mvc; using System.Web.Mvc;
namespace Disco.Services.Logging namespace Disco.Services.Logging
@@ -90,7 +90,8 @@ namespace Disco.Services.Plugins.Features.DetailsProvider
return user.UserDetails return user.UserDetails
.Where(d => string.Equals(d.Scope, DetailsScope, StringComparison.Ordinal)) .Where(d => string.Equals(d.Scope, DetailsScope, StringComparison.Ordinal))
.ToDictionary(d => d.Key, d => d.Value, StringComparer.OrdinalIgnoreCase); .ToDictionary(d => d.Key, d => d.Value, StringComparer.OrdinalIgnoreCase);
} else }
else
{ {
return database.UserDetails return database.UserDetails
.Where(d => d.UserId == user.UserId && .Where(d => d.UserId == user.UserId &&
@@ -15,7 +15,7 @@ namespace Disco.Services.Plugins.Features.RepairProvider
/// The repairer identifier. Used to link this provider to any <see cref="Models.Repository.RepairerName"/>. This identifier is used to automatically set the RepairerName when a job is submitted using this plugin. /// The repairer identifier. Used to link this provider to any <see cref="Models.Repository.RepairerName"/>. This identifier is used to automatically set the RepairerName when a job is submitted using this plugin.
/// </summary> /// </summary>
public abstract string ProviderId { get; } public abstract string ProviderId { get; }
#region Job Submission #region Job Submission
/// <summary> /// <summary>
@@ -64,7 +64,7 @@ namespace Disco.Services.Plugins.Features.RepairProvider
public virtual Tuple<Type, dynamic> JobDetails(DiscoDataContext Database, Controller controller, Job Job) public virtual Tuple<Type, dynamic> JobDetails(DiscoDataContext Database, Controller controller, Job Job)
{ {
return null; return null;
} }
#endregion #endregion
@@ -1,7 +1,7 @@
using System; using Disco.Models.UI;
using System.Web.Mvc;
using Disco.Models.UI;
using Disco.Services.Plugins.Features.UIExtension.Results; using Disco.Services.Plugins.Features.UIExtension.Results;
using System;
using System.Web.Mvc;
namespace Disco.Services.Plugins.Features.UIExtension namespace Disco.Services.Plugins.Features.UIExtension
{ {
@@ -19,7 +19,8 @@ namespace Disco.Services.Plugins.Features.UIExtension
} }
public UIExtensionFeature() public UIExtensionFeature()
{ {
plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => { plugin = new Lazy<WebHelper>(new Func<WebHelper>(() =>
{
if (Context == null) if (Context == null)
throw new InvalidOperationException("The Context property is not initialized"); throw new InvalidOperationException("The Context property is not initialized");
@@ -5,7 +5,7 @@ namespace Disco.Services.Plugins.Features.UIExtension
public abstract class UIExtensionResult public abstract class UIExtensionResult
{ {
public PluginFeatureManifest Source { get; private set; } public PluginFeatureManifest Source { get; private set; }
public UIExtensionResult(PluginFeatureManifest Source) public UIExtensionResult(PluginFeatureManifest Source)
{ {
this.Source = Source; this.Source = Source;
@@ -1,9 +1,9 @@
using System; using Disco.Models.UI;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Web; using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
using Disco.Models.UI;
namespace Disco.Services.Plugins.Features.UIExtension namespace Disco.Services.Plugins.Features.UIExtension
{ {
@@ -1,10 +1,10 @@
using System; using Disco.Data.Repository;
using Disco.Models.BI.Config;
using Disco.Models.Repository;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web.Mvc; using System.Web.Mvc;
using Disco.Data.Repository;
using Disco.Models.BI.Config;
using Disco.Models.Repository;
namespace Disco.Services.Plugins.Features.WarrantyProvider namespace Disco.Services.Plugins.Features.WarrantyProvider
{ {
+1 -1
View File
@@ -72,7 +72,7 @@ namespace Disco.Services.Plugins
Status.UpdateStatus(20, $"{packageManifest.Name} [{packageManifest.Id} v{packageManifest.Version.ToString(4)}] by {packageManifest.Author}", "Initializing Install Environment"); Status.UpdateStatus(20, $"{packageManifest.Name} [{packageManifest.Id} v{packageManifest.Version.ToString(4)}] by {packageManifest.Author}", "Initializing Install Environment");
PluginsLog.LogInstalling(packageManifest); PluginsLog.LogInstalling(packageManifest);
lock (Plugins._PluginLock) lock (Plugins._PluginLock)
{ {
if (!Plugins.PluginsLoaded) if (!Plugins.PluginsLoaded)
+3 -3
View File
@@ -1,12 +1,12 @@
using System; using Disco.Data.Repository;
using Disco.Data.Repository;
using Disco.Services.Tasks; using Disco.Services.Tasks;
using System;
namespace Disco.Services.Plugins namespace Disco.Services.Plugins
{ {
public abstract class Plugin : IDisposable public abstract class Plugin : IDisposable
{ {
public PluginManifest Manifest {get; internal set;} public PluginManifest Manifest { get; internal set; }
#region Lifecycle #region Lifecycle
// Events/Triggers for Custom Plugin Initialization (Optional) // Events/Triggers for Custom Plugin Initialization (Optional)
@@ -1,6 +1,6 @@
using System; using Disco.Data.Repository;
using System;
using System.Web.Mvc; using System.Web.Mvc;
using Disco.Data.Repository;
namespace Disco.Services.Plugins namespace Disco.Services.Plugins
{ {
+8 -8
View File
@@ -1,13 +1,13 @@
using System; using Disco.Services.Web.Bundles;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Web.Mvc;
using System.Web.WebPages;
using System.Web.Routing;
using System.Web;
using System.Web.Mvc.Html;
using System.Globalization; using System.Globalization;
using Disco.Services.Web.Bundles; using System.IO;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.WebPages;
namespace Disco.Services.Plugins namespace Disco.Services.Plugins
{ {

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