diff --git a/Disco.BI/BI/Interop/Pdf/PdfGenerator.cs b/Disco.BI/BI/Interop/Pdf/PdfGenerator.cs index 88840746..b4a08f25 100644 --- a/Disco.BI/BI/Interop/Pdf/PdfGenerator.cs +++ b/Disco.BI/BI/Interop/Pdf/PdfGenerator.cs @@ -296,8 +296,7 @@ namespace Disco.BI.Interop.Pdf } else { - Expression fieldExpression = null; - if (expressionCache.TryGetValue(pdfFieldKey, out fieldExpression)) + if (expressionCache.TryGetValue(pdfFieldKey, out var fieldExpression)) { if (fieldExpression.IsDynamic) { diff --git a/Disco.Client/Interop/Certificates.cs b/Disco.Client/Interop/Certificates.cs index 1e481d61..cf0f2fd2 100644 --- a/Disco.Client/Interop/Certificates.cs +++ b/Disco.Client/Interop/Certificates.cs @@ -105,8 +105,7 @@ namespace Disco.Client.Interop { foreach (var thumbprint in RemoveThumbprints) { - List certificates; - if (existingThumbprints.TryGetValue(thumbprint, out certificates) && !addedThumbprints.Contains(thumbprint)) + if (existingThumbprints.TryGetValue(thumbprint, out var certificates) && !addedThumbprints.Contains(thumbprint)) { foreach (var certificate in certificates) { diff --git a/Disco.Client/Interop/Hardware.cs b/Disco.Client/Interop/Hardware.cs index 979807fb..f9445e47 100644 --- a/Disco.Client/Interop/Hardware.cs +++ b/Disco.Client/Interop/Hardware.cs @@ -539,8 +539,7 @@ namespace Disco.Client.Interop // if serial number is absent attempt using UUID if valid if (string.IsNullOrWhiteSpace(deviceHardware.SerialNumber)) { - Guid uuidGuid; - if (Guid.TryParse(deviceHardware.UUID, out uuidGuid) && uuidGuid != Guid.Empty) + if (Guid.TryParse(deviceHardware.UUID, out var uuidGuid) && uuidGuid != Guid.Empty) { deviceHardware.SerialNumber = $"UUID{uuidGuid:N}"; } diff --git a/Disco.Client/Interop/WirelessNetwork.cs b/Disco.Client/Interop/WirelessNetwork.cs index 72bb38af..f4f5a041 100644 --- a/Disco.Client/Interop/WirelessNetwork.cs +++ b/Disco.Client/Interop/WirelessNetwork.cs @@ -17,16 +17,13 @@ namespace Disco.Client.Interop { try { - IntPtr wlanHandle; - uint wlanServiceVersion; - if (WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out wlanServiceVersion, out wlanHandle) == WlanApi.ERROR_SUCCESS) + if (WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out var wlanServiceVersion, out var wlanHandle) == WlanApi.ERROR_SUCCESS) { try { - IntPtr wlanInterfacesPtr; - if (WlanApi.WlanEnumInterfaces(wlanHandle, IntPtr.Zero, out wlanInterfacesPtr) == WlanApi.ERROR_SUCCESS) + if (WlanApi.WlanEnumInterfaces(wlanHandle, IntPtr.Zero, out var wlanInterfacesPtr) == WlanApi.ERROR_SUCCESS) { try { @@ -69,12 +66,10 @@ namespace Disco.Client.Interop { try { - IntPtr wlanHandle; - uint wlanServiceVersion; uint interopResult; // Connect to wireless service - interopResult = WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out wlanServiceVersion, out wlanHandle); + interopResult = WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out var wlanServiceVersion, out var wlanHandle); if (interopResult == WlanApi.ERROR_SERVICE_NOT_ACTIVE) { // Indicates the Wlan service has not been started on the client @@ -109,10 +104,9 @@ namespace Disco.Client.Interop private static List GetWirelessProfiles(IntPtr wlanHandle) { uint interopResult; - IntPtr wlanInterfacesPtr; // Enumerate wireless interfaces - interopResult = WlanApi.WlanEnumInterfaces(wlanHandle, IntPtr.Zero, out wlanInterfacesPtr); + interopResult = WlanApi.WlanEnumInterfaces(wlanHandle, IntPtr.Zero, out var wlanInterfacesPtr); if (interopResult != WlanApi.ERROR_SUCCESS) { throw new Exception($"Unable to list interfaces with the local wireless service. WlanEnumInterfaces returned: {interopResult}"); @@ -124,9 +118,8 @@ namespace Disco.Client.Interop foreach (var wlanInterface in wlanInterfaces.InterfaceInfo) { - IntPtr wlanProfilesPtr; // Enumerate wireless profiles for interface - interopResult = WlanApi.WlanGetProfileList(wlanHandle, wlanInterface.InterfaceGuid, IntPtr.Zero, out wlanProfilesPtr); + interopResult = WlanApi.WlanGetProfileList(wlanHandle, wlanInterface.InterfaceGuid, IntPtr.Zero, out var wlanProfilesPtr); if (interopResult != WlanApi.ERROR_SUCCESS) { throw new Exception($"Unable to list wireless profiles for the {wlanInterface.InterfaceGuid} interface with the local wireless service. WlanGetProfileList returned: {interopResult}"); @@ -165,12 +158,10 @@ namespace Disco.Client.Interop try { - IntPtr wlanHandle; - uint wlanServiceVersion; uint interopResult; // Connect to wireless service - interopResult = WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out wlanServiceVersion, out wlanHandle); + interopResult = WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out var wlanServiceVersion, out var wlanHandle); if (interopResult == WlanApi.ERROR_SERVICE_NOT_ACTIVE) { // Indicates the Wlan service has not been started on the client @@ -243,9 +234,8 @@ namespace Disco.Client.Interop } else { - uint pdwReasonCode; Presentation.UpdateStatus("Enrolling Device", $"Configuring Wireless Profiles\r\nAdding Wireless Profile '{addProfile.Name}' on '{adapter.NetConnectionID}'", true, -1, 1000); - interopResult = WlanApi.WlanSetProfile(wlanHandle, adapter.ConnectionIdentifier, 0, addProfile.ProfileXml, null, true, IntPtr.Zero, out pdwReasonCode); + interopResult = WlanApi.WlanSetProfile(wlanHandle, adapter.ConnectionIdentifier, 0, addProfile.ProfileXml, null, true, IntPtr.Zero, out var pdwReasonCode); if (interopResult != WlanApi.ERROR_SUCCESS) { @@ -285,11 +275,8 @@ namespace Disco.Client.Interop else { // Load profile - IntPtr pstrProfileXml; - uint pdwFlags; - IntPtr pdwGrantAccess; - interopResult = WlanApi.WlanGetProfile(wlanHandle, adapter.ConnectionIdentifier, profileName, IntPtr.Zero, out pstrProfileXml, out pdwFlags, out pdwGrantAccess); + interopResult = WlanApi.WlanGetProfile(wlanHandle, adapter.ConnectionIdentifier, profileName, IntPtr.Zero, out var pstrProfileXml, out var pdwFlags, out var pdwGrantAccess); if (interopResult == WlanApi.ERROR_SUCCESS) { @@ -312,10 +299,9 @@ namespace Disco.Client.Interop if (!XNode.DeepEquals(originalProfileXml, transformedProfileXml)) { // Set Profile - uint pdwReasonCode; Presentation.UpdateStatus("Enrolling Device", $"Configuring Wireless Profiles\r\nModifying Wireless Profile '{profileName}' on '{adapter.NetConnectionID}'", true, -1, 1000); transformProfileXml = transformedProfileXml.ToString(SaveOptions.None); - interopResult = WlanApi.WlanSetProfile(wlanHandle, adapter.ConnectionIdentifier, 0, transformProfileXml, null, true, IntPtr.Zero, out pdwReasonCode); + interopResult = WlanApi.WlanSetProfile(wlanHandle, adapter.ConnectionIdentifier, 0, transformProfileXml, null, true, IntPtr.Zero, out var pdwReasonCode); if (interopResult != WlanApi.ERROR_SUCCESS) { diff --git a/Disco.ClientBootstrapper/Interop/NetworkAdapter.cs b/Disco.ClientBootstrapper/Interop/NetworkAdapter.cs index d9b18f7f..c86f02d8 100644 --- a/Disco.ClientBootstrapper/Interop/NetworkAdapter.cs +++ b/Disco.ClientBootstrapper/Interop/NetworkAdapter.cs @@ -34,7 +34,7 @@ namespace Disco.ClientBootstrapper.Interop Name = (string)wmiObject.GetPropertyValue("Name"); NetConnectionID = (string)wmiObject.GetPropertyValue("NetConnectionID"); Speed = (UInt64)wmiObject.GetPropertyValue("Speed"); - var connectionStatus = ConnectionStatus; + _ = ConnectionStatus; IsWireless = true; try { @@ -53,19 +53,17 @@ namespace Disco.ClientBootstrapper.Interop if (IsWireless) { IntPtr handle = IntPtr.Zero; - uint negotiatedVersion; try { - if (NetworkInterop.WlanOpenHandle(1, IntPtr.Zero, out negotiatedVersion, ref handle) != 0) + if (NetworkInterop.WlanOpenHandle(1, IntPtr.Zero, out var negotiatedVersion, ref handle) != 0) throw new NotSupportedException("This network adapter does not support Wireless"); IntPtr ptr = new IntPtr(); - uint dataSize; var interfaceGuid = Guid; - if (NetworkInterop.WlanQueryInterface(handle, ref interfaceGuid, NetworkInterop.WLAN_INTF_OPCODE.wlan_intf_opcode_interface_state, IntPtr.Zero, out dataSize, ref ptr, IntPtr.Zero) != 0) + if (NetworkInterop.WlanQueryInterface(handle, ref interfaceGuid, NetworkInterop.WLAN_INTF_OPCODE.wlan_intf_opcode_interface_state, IntPtr.Zero, out var dataSize, ref ptr, IntPtr.Zero) != 0) throw new NotSupportedException("This network adapter does not support Wireless"); LastWirelessConnectionStatus = Marshal.ReadInt32(ptr); diff --git a/Disco.ClientBootstrapper/Interop/NetworkInterop.cs b/Disco.ClientBootstrapper/Interop/NetworkInterop.cs index a3275eed..5d2290ce 100644 --- a/Disco.ClientBootstrapper/Interop/NetworkInterop.cs +++ b/Disco.ClientBootstrapper/Interop/NetworkInterop.cs @@ -196,11 +196,10 @@ namespace Disco.ClientBootstrapper.Interop { IntPtr wlanHandle = IntPtr.Zero; - uint negotiatedVersion; try { - if (WlanOpenHandle(1, IntPtr.Zero, out negotiatedVersion, ref wlanHandle) != 0) + if (WlanOpenHandle(1, IntPtr.Zero, out var negotiatedVersion, ref wlanHandle) != 0) throw new NotSupportedException("This device does not support Wireless"); // Add Profile to Each Wireless Adapter @@ -241,8 +240,7 @@ namespace Disco.ClientBootstrapper.Interop var pInterfaceGuid = interfaceGuid; var pProfileXml = ProfileXml; uint pFlag = 0; - uint failReason; - return (WlanSetProfile(WlanHandle, ref pInterfaceGuid, pFlag, pProfileXml, null, true, IntPtr.Zero, out failReason) == 0); + return WlanSetProfile(WlanHandle, ref pInterfaceGuid, pFlag, pProfileXml, null, true, IntPtr.Zero, out _) == 0; } } diff --git a/Disco.ClientBootstrapper/Interop/RegistryInterop.cs b/Disco.ClientBootstrapper/Interop/RegistryInterop.cs index 14f1297f..ae69b7cb 100644 --- a/Disco.ClientBootstrapper/Interop/RegistryInterop.cs +++ b/Disco.ClientBootstrapper/Interop/RegistryInterop.cs @@ -58,16 +58,15 @@ namespace Disco.ClientBootstrapper.Interop public RegistryInterop(RegistryHives hive, string subKey, string filePath) { int token = 0; - int retval = 0; TOKEN_PRIVILEGES TP = new TOKEN_PRIVILEGES(); TOKEN_PRIVILEGES TP2 = new TOKEN_PRIVILEGES(); LUID RestoreLuid = new LUID(); LUID BackupLuid = new LUID(); - retval = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref token); - retval = LookupPrivilegeValue(null, SE_RESTORE_NAME, ref RestoreLuid); - retval = LookupPrivilegeValue(null, SE_BACKUP_NAME, ref BackupLuid); + OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref token); + LookupPrivilegeValue(null, SE_RESTORE_NAME, ref RestoreLuid); + LookupPrivilegeValue(null, SE_BACKUP_NAME, ref BackupLuid); TP.PrivilegeCount = 1; TP.Attributes = SE_PRIVILEGE_ENABLED; TP.Luid = RestoreLuid; @@ -75,8 +74,8 @@ namespace Disco.ClientBootstrapper.Interop TP2.Attributes = SE_PRIVILEGE_ENABLED; TP2.Luid = BackupLuid; - retval = AdjustTokenPrivileges(token, 0, ref TP, 1024, 0, 0); - retval = AdjustTokenPrivileges(token, 0, ref TP2, 1024, 0, 0); + AdjustTokenPrivileges(token, 0, ref TP, 1024, 0, 0); + AdjustTokenPrivileges(token, 0, ref TP2, 1024, 0, 0); uint regHive = (uint)hive; diff --git a/Disco.ClientBootstrapper/Interop/ShutdownInterop.cs b/Disco.ClientBootstrapper/Interop/ShutdownInterop.cs index 4ecd2092..c0c49720 100644 --- a/Disco.ClientBootstrapper/Interop/ShutdownInterop.cs +++ b/Disco.ClientBootstrapper/Interop/ShutdownInterop.cs @@ -39,21 +39,20 @@ namespace Disco.ClientBootstrapper.Interop // End Removed 2012-11-23 G# // Added 2012-11-23 G# - Migrate to Win32 PInvoke Shutdown - bool result; TokPriv1Luid tp; IntPtr hproc = GetCurrentProcess(); IntPtr htok = IntPtr.Zero; - result = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok); + OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok); tp.Count = 1; tp.Luid = 0; tp.Attr = SE_PRIVILEGE_ENABLED; - result = LookupPrivilegeValue(null, SE_SHUTDOWN_NAME, ref tp.Luid); - result = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero); - result = ExitWindowsEx(flag, 0); + LookupPrivilegeValue(null, SE_SHUTDOWN_NAME, ref tp.Luid); + AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero); + ExitWindowsEx(flag, 0); // End Added 2012-11-23 G# } diff --git a/Disco.ClientBootstrapper/Interop/WIMInterop.cs b/Disco.ClientBootstrapper/Interop/WIMInterop.cs index bb8bbe6e..affd691b 100644 --- a/Disco.ClientBootstrapper/Interop/WIMInterop.cs +++ b/Disco.ClientBootstrapper/Interop/WIMInterop.cs @@ -684,7 +684,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop IntPtr windowsImageHandle = IntPtr.Zero; int rc = -1; - windowsImageHandle = NativeMethods.WimCreateFile(imageFile, access, mode, 0, 0, out creationResult); + windowsImageHandle = NativeMethods.WimCreateFile(imageFile, access, mode, 0, 0, out _); rc = Marshal.GetLastWin32Error(); if (windowsImageHandle == IntPtr.Zero) { @@ -1062,7 +1062,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop IntPtr info = IntPtr.Zero, sizeOfInfo = IntPtr.Zero; bool status; - status = NativeMethods.WimGetImageInformation(handle, out info, out sizeOfInfo); + status = NativeMethods.WimGetImageInformation(handle, out info, out _); int rc = Marshal.GetLastWin32Error(); if (status == false) @@ -1221,7 +1221,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop void RegisterCallback(MessageCallback callback) { - uint callbackZeroBasedIndex = NativeMethods.WimRegisterMessageCallback(IntPtr.Zero, callback, IntPtr.Zero); + NativeMethods.WimRegisterMessageCallback(IntPtr.Zero, callback, IntPtr.Zero); int rc = Marshal.GetLastWin32Error(); if (rc != 0) { @@ -1254,7 +1254,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop UnregisterMessageCallback(MessageCallback registeredCallback) { bool status = NativeMethods.WimUnregisterMessageCallback(IntPtr.Zero, registeredCallback); - int rc = Marshal.GetLastWin32Error(); + _ = Marshal.GetLastWin32Error(); if (status != true) { // diff --git a/Disco.Data/Configuration/ConfigurationCache.cs b/Disco.Data/Configuration/ConfigurationCache.cs index 95d2f4f3..44f12180 100644 --- a/Disco.Data/Configuration/ConfigurationCache.cs +++ b/Disco.Data/Configuration/ConfigurationCache.cs @@ -53,11 +53,9 @@ namespace Disco.Data.Configuration { var cache = Cache(Database); - ConfigurationCacheScopeType scopeCache; - if (cache.TryGetValue(Scope, out scopeCache)) + if (cache.TryGetValue(Scope, out var scopeCache)) { - ConfigurationCacheItemType item = default(ConfigurationCacheItemType); - if (scopeCache.TryGetValue(Key, out item)) + if (scopeCache.TryGetValue(Key, out var item)) return item; } @@ -93,8 +91,7 @@ namespace Disco.Data.Configuration Database.ConfigurationItems.Add(configItem); // Add Item to Cache - ConfigurationCacheScopeType scopeCache; - if (!cacheStore.TryGetValue(Scope, out scopeCache)) + if (!cacheStore.TryGetValue(Scope, out var scopeCache)) { scopeCache = new ConfigurationCacheScopeType(); cacheStore.TryAdd(Scope, scopeCache); @@ -134,10 +131,9 @@ namespace Disco.Data.Configuration Database.ConfigurationItems.Remove(configItem); // Remove item from Cache - ConfigurationCacheScopeType scopeCache; - if (cacheStore.TryGetValue(Scope, out scopeCache)) + if (cacheStore.TryGetValue(Scope, out var scopeCache)) { - scopeCache.TryRemove(Key, out item); + scopeCache.TryRemove(Key, out _); } return null; @@ -148,8 +144,7 @@ namespace Disco.Data.Configuration configItem.Value = Value; // Update Cache - ConfigurationCacheScopeType scopeCache; - if (cacheStore.TryGetValue(Scope, out scopeCache)) + if (cacheStore.TryGetValue(Scope, out var scopeCache)) { scopeCache.TryRemove(Key, out item); item = new ConfigurationCacheItemType(configItem, ObjectValue); @@ -167,8 +162,7 @@ namespace Disco.Data.Configuration { var cache = ConfigurationCache.cacheStore; - ConfigurationCacheScopeType scopeCache; - if (cache.TryGetValue(ExistingItem.Item1.Scope, out scopeCache)) + if (cache.TryGetValue(ExistingItem.Item1.Scope, out var scopeCache)) { ConfigurationCacheItemType newItem = new ConfigurationCacheItemType(ExistingItem.Item1, Value); scopeCache.TryUpdate(ExistingItem.Item1.Key, newItem, ExistingItem); @@ -340,8 +334,7 @@ namespace Disco.Data.Configuration { var cache = Cache(Database); - ConfigurationCacheScopeType scopeCache; - if (cache.TryGetValue(Scope, out scopeCache)) + if (cache.TryGetValue(Scope, out var scopeCache)) { return scopeCache.Keys.ToList(); } @@ -365,8 +358,7 @@ namespace Disco.Data.Configuration // Remove item from Cache if (cacheStore != null) { - ConfigurationCacheScopeType scopeCache; - cacheStore.TryRemove(Scope, out scopeCache); + cacheStore.TryRemove(Scope, out var scopeCache); } } } @@ -406,10 +398,9 @@ namespace Disco.Data.Configuration // Remove item from Cache if (cacheItem != null) { - ConfigurationCacheScopeType scopeCache; - if (cacheStore.TryGetValue(Scope, out scopeCache)) + if (cacheStore.TryGetValue(Scope, out var scopeCache)) { - scopeCache.TryRemove(Key, out cacheItem); + scopeCache.TryRemove(Key, out _); } } } diff --git a/Disco.Data/Repository/DiscoDataSeeder.cs b/Disco.Data/Repository/DiscoDataSeeder.cs index d96c20f0..3d24d308 100644 --- a/Disco.Data/Repository/DiscoDataSeeder.cs +++ b/Disco.Data/Repository/DiscoDataSeeder.cs @@ -264,8 +264,7 @@ namespace Disco.Data.Repository foreach (var configurationItem in configurationItems) { int profileId = int.Parse(configurationItem.Scope.Substring(configurationItem.Scope.IndexOf(":") + 1)); - DeviceProfile dp; - if (deviceProfiles.TryGetValue(profileId, out dp)) + if (deviceProfiles.TryGetValue(profileId, out var dp)) { switch (configurationItem.Key) { @@ -273,7 +272,7 @@ namespace Disco.Data.Repository dp.ComputerNameTemplate = configurationItem.Value; break; case "DistributionType": - dp.DistributionType = (DeviceProfile.DistributionTypes)(int.Parse(configurationItem.Value)); + dp.DistributionType = (DeviceProfile.DistributionTypes)int.Parse(configurationItem.Value); break; case "OrganisationalUnit": dp.OrganisationalUnit = configurationItem.Value; diff --git a/Disco.Data/Repository/Monitor/RepositoryMonitor.cs b/Disco.Data/Repository/Monitor/RepositoryMonitor.cs index 5cd54be5..833da7b1 100644 --- a/Disco.Data/Repository/Monitor/RepositoryMonitor.cs +++ b/Disco.Data/Repository/Monitor/RepositoryMonitor.cs @@ -49,9 +49,8 @@ namespace Disco.Data.Repository.Monitor private static Type EntityTypeFromProxy(Type EntityProxyType) { - Type EntityType; - if (entityProxyTypeCache.TryGetValue(EntityProxyType, out EntityType)) + if (entityProxyTypeCache.TryGetValue(EntityProxyType, out var EntityType)) return EntityType; EntityType = EntityProxyType; diff --git a/Disco.Services/Attachments/AttachmentActionExtensions.cs b/Disco.Services/Attachments/AttachmentActionExtensions.cs index ce98afcc..58030413 100644 --- a/Disco.Services/Attachments/AttachmentActionExtensions.cs +++ b/Disco.Services/Attachments/AttachmentActionExtensions.cs @@ -245,8 +245,7 @@ namespace Disco.Services { string thumbnailFilePath = attachment.RepositoryThumbnailFilename(Database); - Image thumbnail; - if (attachment.GenerateThumbnail(AttachmentStream, out thumbnail)) + if (attachment.GenerateThumbnail(AttachmentStream, out var thumbnail)) { thumbnail.SaveJpg(90, thumbnailFilePath); } @@ -260,8 +259,7 @@ namespace Disco.Services using (var attachmentStream = File.OpenRead(attachment.RepositoryFilename(Database))) { - Image thumbnail; - if (attachment.GenerateThumbnail(attachmentStream, out thumbnail)) + if (attachment.GenerateThumbnail(attachmentStream, out var thumbnail)) { thumbnail.SaveJpg(90, thumbnailFilePath); } diff --git a/Disco.Services/Authorization/AuthorizationRoleExtensions.cs b/Disco.Services/Authorization/AuthorizationRoleExtensions.cs index 91102f3e..933fcce1 100644 --- a/Disco.Services/Authorization/AuthorizationRoleExtensions.cs +++ b/Disco.Services/Authorization/AuthorizationRoleExtensions.cs @@ -2,6 +2,7 @@ using Disco.Models.Repository; using Disco.Models.Services.Authorization; using Disco.Services.Users; +using System; namespace Disco.Services { @@ -10,8 +11,9 @@ namespace Disco.Services public static void Delete(this IRoleToken roleToken, DiscoDataContext Database) { - var role = Database.AuthorizationRoles.Find(roleToken.Role.Id); - UserService.DeleteAuthorizationRole(Database, roleToken.Role); + var role = Database.AuthorizationRoles.Find(roleToken.Role.Id) + ?? throw new ArgumentException("Role not found", nameof(roleToken)); + UserService.DeleteAuthorizationRole(Database, role); } public static void Delete(this AuthorizationRole role, DiscoDataContext Database) diff --git a/Disco.Services/Authorization/Claims.cs b/Disco.Services/Authorization/Claims.cs index 64d169d9..6a54270c 100644 --- a/Disco.Services/Authorization/Claims.cs +++ b/Disco.Services/Authorization/Claims.cs @@ -11,808 +11,796 @@ using System.Linq; namespace Disco.Services.Authorization { - public static class Claims - { - private static Dictionary, Action, string, string, bool>> _roleClaims; - private static ClaimNavigatorItem _claimNavigator; + public static class Claims + { + private static Dictionary, Action, string, string, bool>> _roleClaims; + private static ClaimNavigatorItem _claimNavigator; - static Claims() + static Claims() { #region Role Claim Dictionary _roleClaims = new Dictionary, Action, string, string, bool>>() - { - { "Config.DeviceCertificate.DownloadCertificates", new Tuple, Action, string, string, bool>(c => c.Config.DeviceCertificate.DownloadCertificates, (c, v) => c.Config.DeviceCertificate.DownloadCertificates = v, "Download Certificates", "Can download certificates", false) }, - { "Config.Enrolment.Configure", new Tuple, Action, string, string, bool>(c => c.Config.Enrolment.Configure, (c, v) => c.Config.Enrolment.Configure = v, "Configure Enrolment", "Can configure device enrolment", false) }, - { "Config.Enrolment.DownloadBootstrapper", new Tuple, Action, string, string, bool>(c => c.Config.Enrolment.DownloadBootstrapper, (c, v) => c.Config.Enrolment.DownloadBootstrapper = v, "Download Bootstrapper", "Can download the Device Bootstrapper", false) }, - { "Config.Enrolment.Show", new Tuple, Action, string, string, bool>(c => c.Config.Enrolment.Show, (c, v) => c.Config.Enrolment.Show = v, "Show Enrolment", "Can show device enrolment", false) }, - { "Config.Enrolment.ShowStatus", new Tuple, Action, string, string, bool>(c => c.Config.Enrolment.ShowStatus, (c, v) => c.Config.Enrolment.ShowStatus = v, "Show Enrolment Status", "Can show the enrolment status", false) }, - { "Config.DeviceBatch.Configure", new Tuple, Action, string, string, bool>(c => c.Config.DeviceBatch.Configure, (c, v) => c.Config.DeviceBatch.Configure = v, "Configure Device Batches", "Can configure device batches", false) }, - { "Config.DeviceBatch.Create", new Tuple, Action, string, string, bool>(c => c.Config.DeviceBatch.Create, (c, v) => c.Config.DeviceBatch.Create = v, "Create Device Batches", "Can create device batches", false) }, - { "Config.DeviceBatch.Delete", new Tuple, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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.CreateCustom", new Tuple, Action, string, string, bool>(c => c.Config.DeviceModel.CreateCustom, (c, v) => c.Config.DeviceModel.CreateCustom = v, "Create Custom Device Models", "Can create custom device models", false) }, - { "Config.DeviceModel.Delete", new Tuple, Action, 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.Show", new Tuple, Action, string, string, bool>(c => c.Config.DeviceModel.Show, (c, v) => c.Config.DeviceModel.Show = v, "Show Device Models", "Can show device models", false) }, - { "Config.DeviceProfile.ConfigureComputerNameTemplate", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.ConfigureComputerNameTemplate, (c, v) => c.Config.DeviceProfile.ConfigureComputerNameTemplate = v, "Configure Computer Name Templates", "Can configure computer name templates for device profiles", false) }, - { "Config.DeviceProfile.ConfigureDefaults", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.ConfigureDefaults, (c, v) => c.Config.DeviceProfile.ConfigureDefaults = v, "Configure Default Device Profiles", "Can configure default device profiles", false) }, - { "Config.DeviceProfile.Configure", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.Configure, (c, v) => c.Config.DeviceProfile.Configure = v, "Configure Device Profiles", "Can configure device profiles", false) }, - { "Config.DeviceProfile.Create", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.Create, (c, v) => c.Config.DeviceProfile.Create = v, "Create Device Profiles", "Can create device profiles", false) }, - { "Config.DeviceProfile.Delete", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.Delete, (c, v) => c.Config.DeviceProfile.Delete = v, "Delete Device Profiles", "Can delete device profiles", false) }, - { "Config.DeviceProfile.Show", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.Show, (c, v) => c.Config.DeviceProfile.Show = v, "Show Device Profiles", "Can show device profiles", false) }, - { "Config.DocumentTemplate.BulkGenerate", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.BulkGenerate, (c, v) => c.Config.DocumentTemplate.BulkGenerate = v, "Bulk Generate Document Templates", "Can bulk generate document templates", false) }, - { "Config.DocumentTemplate.ConfigureFilterExpression", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.ConfigureFilterExpression, (c, v) => c.Config.DocumentTemplate.ConfigureFilterExpression = v, "Configure Advanced Expression", "Can configure filter, generate and import expressions for document templates", false) }, - { "Config.DocumentTemplate.Configure", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Configure, (c, v) => c.Config.DocumentTemplate.Configure = v, "Configure Document Templates", "Can configure document templates", false) }, - { "Config.DocumentTemplate.Create", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Create, (c, v) => c.Config.DocumentTemplate.Create = v, "Create Document Templates", "Can create document templates", false) }, - { "Config.DocumentTemplate.Delete", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Delete, (c, v) => c.Config.DocumentTemplate.Delete = v, "Delete Document Templates", "Can delete document templates", false) }, - { "Config.DocumentTemplate.Export", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Export, (c, v) => c.Config.DocumentTemplate.Export = v, "Export Attachment Instances", "Can export document attachment instances", false) }, - { "Config.DocumentTemplate.UndetectedPages", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.UndetectedPages, (c, v) => c.Config.DocumentTemplate.UndetectedPages = v, "Process Undetected Pages", "Can show and assign imported documents which were not undetected", false) }, - { "Config.DocumentTemplate.ShowStatus", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.ShowStatus, (c, v) => c.Config.DocumentTemplate.ShowStatus = v, "Show Document Template Import Status", "Can show the document template import status", false) }, - { "Config.DocumentTemplate.Show", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Show, (c, v) => c.Config.DocumentTemplate.Show = v, "Show Document Templates", "Can show document templates", false) }, - { "Config.DocumentTemplate.Upload", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Upload, (c, v) => c.Config.DocumentTemplate.Upload = v, "Upload Document Templates", "Can upload document templates", false) }, - { "Config.Logging.Show", new Tuple, Action, string, string, bool>(c => c.Config.Logging.Show, (c, v) => c.Config.Logging.Show = v, "Show Logging", "Can show logging", false) }, - { "Config.Plugin.Configure", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.Configure, (c, v) => c.Config.Plugin.Configure = v, "Configure Plugins", "Can configure plugins", false) }, - { "Config.Plugin.InstallLocal", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.InstallLocal, (c, v) => c.Config.Plugin.InstallLocal = v, "Install/Update Local Plugins", "Can install and update locally uploaded plugins", false) }, - { "Config.Plugin.Install", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.Install, (c, v) => c.Config.Plugin.Install = v, "Install/Update Plugins", "Can install and update plugins", false) }, - { "Config.Plugin.Show", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.Show, (c, v) => c.Config.Plugin.Show = v, "Show Plugins", "Can show plugins", false) }, - { "Config.Plugin.Uninstall", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.Uninstall, (c, v) => c.Config.Plugin.Uninstall = v, "Uninstall Plugins", "Can uninstall plugins", false) }, - { "Config.System.ConfigureActiveDirectory", new Tuple, Action, string, string, bool>(c => c.Config.System.ConfigureActiveDirectory, (c, v) => c.Config.System.ConfigureActiveDirectory = v, "Configure Active Directory Settings", "Can configure the Active Directory interoperability settings", false) }, - { "Config.System.ConfigureEmail", new Tuple, Action, string, string, bool>(c => c.Config.System.ConfigureEmail, (c, v) => c.Config.System.ConfigureEmail = v, "Configure Email Settings", "Can configure the email settings", false) }, - { "Config.System.ConfigureProxy", new Tuple, Action, string, string, bool>(c => c.Config.System.ConfigureProxy, (c, v) => c.Config.System.ConfigureProxy = v, "Configure Proxy Settings", "Can configure the proxy settings", false) }, - { "Config.System.Show", new Tuple, Action, string, string, bool>(c => c.Config.System.Show, (c, v) => c.Config.System.Show = v, "Show System Configuration", "Can show the system configuration", false) }, - { "Config.Organisation.ConfigureAddresses", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.ConfigureAddresses, (c, v) => c.Config.Organisation.ConfigureAddresses = v, "Configure Addresses", "Can configure organisation addresses", false) }, - { "Config.Organisation.ConfigureLogo", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.ConfigureLogo, (c, v) => c.Config.Organisation.ConfigureLogo = v, "Configure Logo", "Can configure the organisation logo", false) }, - { "Config.Organisation.ConfigureMultiSiteMode", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.ConfigureMultiSiteMode, (c, v) => c.Config.Organisation.ConfigureMultiSiteMode = v, "Configure Multi-Site Mode", "Can configure multi-site mode", false) }, - { "Config.Organisation.ConfigureName", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.ConfigureName, (c, v) => c.Config.Organisation.ConfigureName = v, "Configure Name", "Can configure the organisation name", false) }, - { "Config.Organisation.Show", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.Show, (c, v) => c.Config.Organisation.Show = v, "Show Organisation Details", "Can show the organisation details", false) }, - { "Config.JobPreferences.Configure", new Tuple, Action, string, string, bool>(c => c.Config.JobPreferences.Configure, (c, v) => c.Config.JobPreferences.Configure = v, "Configure Job Preferences", "Can configure job preferences", false) }, - { "Config.JobPreferences.Show", new Tuple, Action, string, string, bool>(c => c.Config.JobPreferences.Show, (c, v) => c.Config.JobPreferences.Show = v, "Show Job Preferences", "Can show job preferences", false) }, - { "Config.JobQueue.Configure", new Tuple, Action, string, string, bool>(c => c.Config.JobQueue.Configure, (c, v) => c.Config.JobQueue.Configure = v, "Configure Job Queues", "Can configure job queues", false) }, - { "Config.JobQueue.Create", new Tuple, Action, string, string, bool>(c => c.Config.JobQueue.Create, (c, v) => c.Config.JobQueue.Create = v, "Create Job Queues", "Can create job queues", false) }, - { "Config.JobQueue.Delete", new Tuple, Action, string, string, bool>(c => c.Config.JobQueue.Delete, (c, v) => c.Config.JobQueue.Delete = v, "Delete Job Queues", "Can delete job queues", false) }, - { "Config.JobQueue.Show", new Tuple, Action, string, string, bool>(c => c.Config.JobQueue.Show, (c, v) => c.Config.JobQueue.Show = v, "Show Job Queues", "Can show job queues", false) }, - { "Config.UserFlag.Configure", new Tuple, Action, 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, Action, 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, Action, 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, Action, 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, Action, string, string, bool>(c => c.Config.UserFlag.Show, (c, v) => c.Config.UserFlag.Show = v, "Show User Flags", "Can show user flags", false) }, - { "Config.ManageSavedExports", new Tuple, Action, string, string, bool>(c => c.Config.ManageSavedExports, (c, v) => c.Config.ManageSavedExports = v, "Managed Saved Exports", "Can manage saved exports", false) }, - { "Config.Show", new Tuple, Action, 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, Action, string, string, bool>(c => c.Job.Lists.AllOpen, (c, v) => c.Job.Lists.AllOpen = v, "All Open List", "Can show list", false) }, - { "Job.Lists.AwaitingFinanceAgreementBreach", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinanceAgreementBreach, (c, v) => c.Job.Lists.AwaitingFinanceAgreementBreach = v, "Awaiting Finance Agreement Breach List", "Can show list (NOTE: Requires Awaiting Finance List)", false) }, - { "Job.Lists.AwaitingFinanceCharge", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinanceCharge, (c, v) => c.Job.Lists.AwaitingFinanceCharge = v, "Awaiting Finance Charge List", "Can show list (NOTE: Requires Awaiting Finance List)", false) }, - { "Job.Lists.AwaitingFinanceInsuranceProcessing", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinanceInsuranceProcessing, (c, v) => c.Job.Lists.AwaitingFinanceInsuranceProcessing = v, "Awaiting Finance Insurance Processing List", "Can show list (NOTE: Requires Awaiting Finance List)", false) }, - { "Job.Lists.AwaitingFinance", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinance, (c, v) => c.Job.Lists.AwaitingFinance = v, "Awaiting Finance List", "Can show list", false) }, - { "Job.Lists.AwaitingFinancePayment", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinancePayment, (c, v) => c.Job.Lists.AwaitingFinancePayment = v, "Awaiting Finance Payment List", "Can show list (NOTE: Requires Awaiting Finance List)", false) }, - { "Job.Lists.AwaitingTechnicianAction", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingTechnicianAction, (c, v) => c.Job.Lists.AwaitingTechnicianAction = v, "Awaiting Technician Action List", "Can show list", false) }, - { "Job.Lists.AwaitingUserAction", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingUserAction, (c, v) => c.Job.Lists.AwaitingUserAction = v, "Awaiting User Action List", "Can show list", false) }, - { "Job.Lists.DevicesAwaitingRepair", new Tuple, Action, string, string, bool>(c => c.Job.Lists.DevicesAwaitingRepair, (c, v) => c.Job.Lists.DevicesAwaitingRepair = v, "Devices Awaiting Repair List", "Can show list", false) }, - { "Job.Lists.DevicesReadyForReturn", new Tuple, Action, string, string, bool>(c => c.Job.Lists.DevicesReadyForReturn, (c, v) => c.Job.Lists.DevicesReadyForReturn = v, "Devices Ready For Return List", "Can show list", false) }, - { "Job.Lists.JobQueueLists", new Tuple, Action, string, string, bool>(c => c.Job.Lists.JobQueueLists, (c, v) => c.Job.Lists.JobQueueLists = v, "Job Queue Lists", "Can show job queue lists", false) }, - { "Job.Lists.Locations", new Tuple, Action, string, string, bool>(c => c.Job.Lists.Locations, (c, v) => c.Job.Lists.Locations = v, "Locations List", "Can show list", false) }, - { "Job.Lists.LongRunningJobs", new Tuple, Action, string, string, bool>(c => c.Job.Lists.LongRunningJobs, (c, v) => c.Job.Lists.LongRunningJobs = v, "Long Running Jobs List", "Can show list", false) }, - { "Job.Lists.MyJobs", new Tuple, Action, string, string, bool>(c => c.Job.Lists.MyJobs, (c, v) => c.Job.Lists.MyJobs = v, "My Jobs List", "Can show list", false) }, - { "Job.Lists.MyJobsOrphaned", new Tuple, Action, string, string, bool>(c => c.Job.Lists.MyJobsOrphaned, (c, v) => c.Job.Lists.MyJobsOrphaned = v, "My Jobs List (Includes No Queue)", "Can show list", false) }, - { "Job.Lists.RecentlyClosed", new Tuple, Action, string, string, bool>(c => c.Job.Lists.RecentlyClosed, (c, v) => c.Job.Lists.RecentlyClosed = v, "Recently Closed List", "Can show list", false) }, - { "Job.Lists.StaleJobs", new Tuple, Action, string, string, bool>(c => c.Job.Lists.StaleJobs, (c, v) => c.Job.Lists.StaleJobs = v, "Stale Jobs List", "Can show list", false) }, - { "Job.Actions.AddAttachments", new Tuple, Action, string, string, bool>(c => c.Job.Actions.AddAttachments, (c, v) => c.Job.Actions.AddAttachments = v, "Add Attachments", "Can add attachments to jobs", false) }, - { "Job.Actions.AddLogs", new Tuple, Action, string, string, bool>(c => c.Job.Actions.AddLogs, (c, v) => c.Job.Actions.AddLogs = v, "Add Logs", "Can add job logs", false) }, - { "Job.Actions.AddAnyQueues", new Tuple, Action, string, string, bool>(c => c.Job.Actions.AddAnyQueues, (c, v) => c.Job.Actions.AddAnyQueues = v, "Add to Any Queues", "Can add to any job queues", false) }, - { "Job.Actions.AddOwnQueues", new Tuple, Action, string, string, bool>(c => c.Job.Actions.AddOwnQueues, (c, v) => c.Job.Actions.AddOwnQueues = v, "Add to Own Queues", "Can add to own job queues", false) }, - { "Job.Actions.Close", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Close, (c, v) => c.Job.Actions.Close = v, "Close Jobs", "Can close jobs", false) }, - { "Job.Actions.ConvertHWarToHNWar", new Tuple, Action, string, string, bool>(c => c.Job.Actions.ConvertHWarToHNWar, (c, v) => c.Job.Actions.ConvertHWarToHNWar = v, "Convert HWar Jobs To HNWar", "Can convert warranty jobs to non-warranty jobs", false) }, - { "Job.Actions.Create", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Create, (c, v) => c.Job.Actions.Create = v, "Create Jobs", "Can create jobs", false) }, - { "Job.Actions.Delete", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Delete, (c, v) => c.Job.Actions.Delete = v, "Delete Jobs", "Can delete jobs", false) }, - { "Job.Actions.Export", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Export, (c, v) => c.Job.Actions.Export = v, "Export Jobs", "Can export jobs in a bulk format", false) }, - { "Job.Actions.ForceClose", new Tuple, Action, 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, Action, 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, Action, string, string, bool>(c => c.Job.Actions.LogInsurance, (c, v) => c.Job.Actions.LogInsurance = v, "Lodge Insurance", "Can lodge insurance for non-warranty jobs", false) }, - { "Job.Actions.LogRepair", new Tuple, Action, string, string, bool>(c => c.Job.Actions.LogRepair, (c, v) => c.Job.Actions.LogRepair = v, "Lodge Repair", "Can lodge repair for non-warranty jobs", false) }, - { "Job.Actions.LogWarranty", new Tuple, Action, string, string, bool>(c => c.Job.Actions.LogWarranty, (c, v) => c.Job.Actions.LogWarranty = v, "Lodge Warranty", "Can lodge warranty for jobs", false) }, - { "Job.Actions.RemoveAnyAttachments", new Tuple, Action, 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.RemoveAnyLogs", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveAnyLogs, (c, v) => c.Job.Actions.RemoveAnyLogs = v, "Remove Any Logs", "Can remove any job logs", false) }, - { "Job.Actions.RemoveAnyQueues", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveAnyQueues, (c, v) => c.Job.Actions.RemoveAnyQueues = v, "Remove from Any Queues", "Can remove from any job queues", false) }, - { "Job.Actions.RemoveOwnQueues", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveOwnQueues, (c, v) => c.Job.Actions.RemoveOwnQueues = v, "Remove from Own Queues", "Can remove from own job queues", false) }, - { "Job.Actions.RemoveOwnAttachments", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveOwnAttachments, (c, v) => c.Job.Actions.RemoveOwnAttachments = v, "Remove Own Attachments", "Can remove own attachments from jobs", false) }, - { "Job.Actions.RemoveOwnLogs", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveOwnLogs, (c, v) => c.Job.Actions.RemoveOwnLogs = v, "Remove Own Logs", "Can remove own job logs", false) }, - { "Job.Actions.Reopen", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Reopen, (c, v) => c.Job.Actions.Reopen = v, "Reopen Jobs", "Can reopen jobs", false) }, - { "Job.Actions.UpdateSubTypes", new Tuple, Action, string, string, bool>(c => c.Job.Actions.UpdateSubTypes, (c, v) => c.Job.Actions.UpdateSubTypes = v, "Update Sub Types", "Can update sub types for jobs", false) }, - { "Job.Properties.WarrantyProperties.ExternalCompletedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ExternalCompletedDate, (c, v) => c.Job.Properties.WarrantyProperties.ExternalCompletedDate = v, "External Completed Date Property", "Can update property", false) }, - { "Job.Properties.WarrantyProperties.ExternalLoggedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ExternalLoggedDate, (c, v) => c.Job.Properties.WarrantyProperties.ExternalLoggedDate = v, "External Logged Date Property", "Can update property", false) }, - { "Job.Properties.WarrantyProperties.ExternalName", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ExternalName, (c, v) => c.Job.Properties.WarrantyProperties.ExternalName = v, "External Name Property", "Can update property", false) }, - { "Job.Properties.WarrantyProperties.ExternalReference", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ExternalReference, (c, v) => c.Job.Properties.WarrantyProperties.ExternalReference = v, "External Reference Property", "Can update property", false) }, - { "Job.Properties.WarrantyProperties.ProviderDetails", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ProviderDetails, (c, v) => c.Job.Properties.WarrantyProperties.ProviderDetails = v, "Provider Details", "Can access warranty provider details", false) }, - { "Job.Properties.WarrantyProperties.WarrantyCompleted", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.WarrantyCompleted, (c, v) => c.Job.Properties.WarrantyProperties.WarrantyCompleted = v, "Warranty Completed Property", "Can update property", false) }, - { "Job.Properties.NonWarrantyProperties.AccountingChargeAdded", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.AccountingChargeAdded, (c, v) => c.Job.Properties.NonWarrantyProperties.AccountingChargeAdded = v, "Accounting Charge Added Property", "Can update property", false) }, - { "Job.Properties.NonWarrantyProperties.AccountingChargePaid", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.AccountingChargePaid, (c, v) => c.Job.Properties.NonWarrantyProperties.AccountingChargePaid = v, "Accounting Charge Paid Property", "Can update property", false) }, - { "Job.Properties.NonWarrantyProperties.AccountingChargeRequired", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.AccountingChargeRequired, (c, v) => c.Job.Properties.NonWarrantyProperties.AccountingChargeRequired = v, "Accounting Charge Required Property", "Can update property", false) }, - { "Job.Properties.NonWarrantyProperties.AddComponents", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.AddComponents, (c, v) => c.Job.Properties.NonWarrantyProperties.AddComponents = v, "Add Components", "Can add job components (NOTE: Requires Edit Components)", false) }, - { "Job.Properties.NonWarrantyProperties.EditComponents", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.EditComponents, (c, v) => c.Job.Properties.NonWarrantyProperties.EditComponents = v, "Edit Components", "Can edit and remove job components", false) }, - { "Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent", new Tuple, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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.RepairProviderDetails", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairProviderDetails, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairProviderDetails = v, "Repair Provider Details", "Can access repair provider details", false) }, - { "Job.Properties.NonWarrantyProperties.RepairerCompletedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairerCompletedDate, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairerCompletedDate = v, "Repairer Completed Date Property", "Can update property", false) }, - { "Job.Properties.NonWarrantyProperties.RepairerLoggedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairerLoggedDate, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairerLoggedDate = v, "Repairer Logged Date Property", "Can update property", false) }, - { "Job.Properties.NonWarrantyProperties.RepairerName", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairerName, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairerName = v, "Repairer Name Property", "Can update property", false) }, - { "Job.Properties.NonWarrantyProperties.RepairerReference", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairerReference, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairerReference = v, "Repairer Reference Property", "Can update property", false) }, - { "Job.Properties.JobQueueProperties.EditAnyComments", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditAnyComments, (c, v) => c.Job.Properties.JobQueueProperties.EditAnyComments = v, "Edit Any Comments", "Can edit any job queue comments", false) }, - { "Job.Properties.JobQueueProperties.EditAnyPriority", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditAnyPriority, (c, v) => c.Job.Properties.JobQueueProperties.EditAnyPriority = v, "Edit Any Priority", "Can edit any job queue Priority", false) }, - { "Job.Properties.JobQueueProperties.EditAnySLA", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditAnySLA, (c, v) => c.Job.Properties.JobQueueProperties.EditAnySLA = v, "Edit Any SLA", "Can edit any job queue SLA", false) }, - { "Job.Properties.JobQueueProperties.EditOwnComments", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditOwnComments, (c, v) => c.Job.Properties.JobQueueProperties.EditOwnComments = v, "Edit Own Comments", "Can edit own job queue comments", false) }, - { "Job.Properties.JobQueueProperties.EditOwnPriority", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditOwnPriority, (c, v) => c.Job.Properties.JobQueueProperties.EditOwnPriority = v, "Edit Own Priority", "Can edit own job queue Priority", false) }, - { "Job.Properties.JobQueueProperties.EditOwnSLA", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditOwnSLA, (c, v) => c.Job.Properties.JobQueueProperties.EditOwnSLA = v, "Edit Own SLA", "Can edit own job queue SLA", false) }, - { "Job.Properties.DeviceHeldLocation", new Tuple, Action, string, string, bool>(c => c.Job.Properties.DeviceHeldLocation, (c, v) => c.Job.Properties.DeviceHeldLocation = v, "Device Held Location Property", "Can update property", false) }, - { "Job.Properties.DeviceHeld", new Tuple, Action, string, string, bool>(c => c.Job.Properties.DeviceHeld, (c, v) => c.Job.Properties.DeviceHeld = v, "Device Held Property", "Can update property", false) }, - { "Job.Properties.DeviceReadyForReturn", new Tuple, Action, string, string, bool>(c => c.Job.Properties.DeviceReadyForReturn, (c, v) => c.Job.Properties.DeviceReadyForReturn = v, "Device Ready For Return Property", "Can update property", false) }, - { "Job.Properties.DeviceReturned", new Tuple, Action, string, string, bool>(c => c.Job.Properties.DeviceReturned, (c, v) => c.Job.Properties.DeviceReturned = v, "Device Returned Property", "Can update property", false) }, - { "Job.Properties.ExpectedClosedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.ExpectedClosedDate, (c, v) => c.Job.Properties.ExpectedClosedDate = v, "Expected Closed Date Property", "Can update property", false) }, - { "Job.Properties.Flags", new Tuple, Action, string, string, bool>(c => c.Job.Properties.Flags, (c, v) => c.Job.Properties.Flags = v, "Flags Property", "Can update property", false) }, - { "Job.Properties.NotWaitingForUserAction", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NotWaitingForUserAction, (c, v) => c.Job.Properties.NotWaitingForUserAction = v, "Not Waiting For User Action Property", "Can update property", false) }, - { "Job.Properties.WaitingForUserAction", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WaitingForUserAction, (c, v) => c.Job.Properties.WaitingForUserAction = v, "Waiting For User Action Property", "Can update property", false) }, - { "Job.Types.CreateHMisc", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateHMisc, (c, v) => c.Job.Types.CreateHMisc = v, "Create Hardware - Miscellaneous Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, - { "Job.Types.CreateHNWar", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateHNWar, (c, v) => c.Job.Types.CreateHNWar = v, "Create Hardware - Non-Warranty Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, - { "Job.Types.CreateHWar", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateHWar, (c, v) => c.Job.Types.CreateHWar = v, "Create Hardware - Warranty Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, - { "Job.Types.CreateSApp", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateSApp, (c, v) => c.Job.Types.CreateSApp = v, "Create Software - Application Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, - { "Job.Types.CreateSOS", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateSOS, (c, v) => c.Job.Types.CreateSOS = v, "Create Software - Operating System Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, - { "Job.Types.CreateSImg", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateSImg, (c, v) => c.Job.Types.CreateSImg = v, "Create Software - Reimage Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, - { "Job.Types.CreateUMgmt", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateUMgmt, (c, v) => c.Job.Types.CreateUMgmt = v, "Create User Management Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, - { "Job.Types.ShowHMisc", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowHMisc, (c, v) => c.Job.Types.ShowHMisc = v, "Show Hardware - Miscellaneous Jobs", "Can show jobs of this type", false) }, - { "Job.Types.ShowHNWar", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowHNWar, (c, v) => c.Job.Types.ShowHNWar = v, "Show Hardware - Non-Warranty Jobs", "Can show jobs of this type", false) }, - { "Job.Types.ShowHWar", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowHWar, (c, v) => c.Job.Types.ShowHWar = v, "Show Hardware - Warranty Jobs", "Can show jobs of this type", false) }, - { "Job.Types.ShowSApp", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowSApp, (c, v) => c.Job.Types.ShowSApp = v, "Show Software - Application Jobs", "Can show jobs of this type", false) }, - { "Job.Types.ShowSOS", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowSOS, (c, v) => c.Job.Types.ShowSOS = v, "Show Software - Operating System Jobs", "Can show jobs of this type", false) }, - { "Job.Types.ShowSImg", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowSImg, (c, v) => c.Job.Types.ShowSImg = v, "Show Software - Reimage Jobs", "Can show jobs of this type", false) }, - { "Job.Types.ShowUMgmt", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowUMgmt, (c, v) => c.Job.Types.ShowUMgmt = v, "Show User Management Jobs", "Can show jobs of this type", false) }, - { "Job.Search", new Tuple, Action, string, string, bool>(c => c.Job.Search, (c, v) => c.Job.Search = v, "Search Jobs", "Can search jobs", false) }, - { "Job.ShowAttachments", new Tuple, Action, string, string, bool>(c => c.Job.ShowAttachments, (c, v) => c.Job.ShowAttachments = v, "Show Attachments", "Can show job attachments", false) }, - { "Job.ShowDailyChart", new Tuple, Action, string, string, bool>(c => c.Job.ShowDailyChart, (c, v) => c.Job.ShowDailyChart = v, "Show Daily Opened & Closed", "Can show daily opened & closed chart", false) }, - { "Job.ShowFlags", new Tuple, Action, string, string, bool>(c => c.Job.ShowFlags, (c, v) => c.Job.ShowFlags = v, "Show Flags", "Can show job flags", false) }, - { "Job.Show", new Tuple, Action, string, string, bool>(c => c.Job.Show, (c, v) => c.Job.Show = v, "Show Jobs", "Can show jobs", false) }, - { "Job.ShowJobsQueues", new Tuple, Action, string, string, bool>(c => c.Job.ShowJobsQueues, (c, v) => c.Job.ShowJobsQueues = v, "Show Jobs Queues", "Can show jobs queues", false) }, - { "Job.ShowLogs", new Tuple, Action, string, string, bool>(c => c.Job.ShowLogs, (c, v) => c.Job.ShowLogs = v, "Show Logs", "Can show job logs", false) }, - { "Job.ShowNonWarrantyComponents", new Tuple, Action, string, string, bool>(c => c.Job.ShowNonWarrantyComponents, (c, v) => c.Job.ShowNonWarrantyComponents = v, "Show Non-Warranty Components", "Can show non-warranty job components", false) }, - { "Job.ShowNonWarrantyFinance", new Tuple, Action, string, string, bool>(c => c.Job.ShowNonWarrantyFinance, (c, v) => c.Job.ShowNonWarrantyFinance = v, "Show Non-Warranty Finance", "Can show non-warranty job finance", false) }, - { "Job.ShowNonWarrantyInsurance", new Tuple, Action, string, string, bool>(c => c.Job.ShowNonWarrantyInsurance, (c, v) => c.Job.ShowNonWarrantyInsurance = v, "Show Non-Warranty Insurance", "Can show non-warranty job insurance", false) }, - { "Job.ShowNonWarrantyRepairs", new Tuple, Action, string, string, bool>(c => c.Job.ShowNonWarrantyRepairs, (c, v) => c.Job.ShowNonWarrantyRepairs = v, "Show Non-Warranty Repairs", "Can show non-warranty job repairs", false) }, - { "Job.ShowWarranty", new Tuple, Action, string, string, bool>(c => c.Job.ShowWarranty, (c, v) => c.Job.ShowWarranty = v, "Show Warranty", "Can show job warranty", false) }, - { "Device.Properties.AssetNumber", new Tuple, Action, string, string, bool>(c => c.Device.Properties.AssetNumber, (c, v) => c.Device.Properties.AssetNumber = v, "Asset Number Property", "Can update property", false) }, - { "Device.Properties.Details", new Tuple, Action, string, string, bool>(c => c.Device.Properties.Details, (c, v) => c.Device.Properties.Details = v, "Detail Properties", "Can update detail properties", false) }, - { "Device.Properties.DeviceBatch", new Tuple, Action, string, string, bool>(c => c.Device.Properties.DeviceBatch, (c, v) => c.Device.Properties.DeviceBatch = v, "Device Batch Property", "Can update property", false) }, - { "Device.Properties.DeviceProfile", new Tuple, Action, 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, Action, 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, Action, 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.AddComments", new Tuple, Action, string, string, bool>(c => c.Device.Actions.AddComments, (c, v) => c.Device.Actions.AddComments = v, "Add Comments", "Can add device comments", false) }, - { "Device.Actions.AddFlags", new Tuple, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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.RemoveAnyComments", new Tuple, Action, string, string, bool>(c => c.Device.Actions.RemoveAnyComments, (c, v) => c.Device.Actions.RemoveAnyComments = v, "Remove Any Comments", "Can remove any device comments", false) }, - { "Device.Actions.RemoveFlags", new Tuple, Action, 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, Action, 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.RemoveOwnComments", new Tuple, Action, string, string, bool>(c => c.Device.Actions.RemoveOwnComments, (c, v) => c.Device.Actions.RemoveOwnComments = v, "Remove Own Comments", "Can remove own device comments", false) }, - { "Device.Search", new Tuple, Action, string, string, bool>(c => c.Device.Search, (c, v) => c.Device.Search = v, "Search Devices", "Can search devices", false) }, - { "Device.ShowAssignmentHistory", new Tuple, Action, 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, Action, string, string, bool>(c => c.Device.ShowAttachments, (c, v) => c.Device.ShowAttachments = v, "Show Attachments", "Can show device attachments", false) }, - { "Device.ShowCertificates", new Tuple, Action, string, string, bool>(c => c.Device.ShowCertificates, (c, v) => c.Device.ShowCertificates = v, "Show Certificates", "Can show certificates associated with devices", false) }, - { "Device.ShowComments", new Tuple, Action, string, string, bool>(c => c.Device.ShowComments, (c, v) => c.Device.ShowComments = v, "Show Comments", "Can show device comments", false) }, - { "Device.ShowDetails", new Tuple, Action, 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, Action, 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, Action, string, string, bool>(c => c.Device.Show, (c, v) => c.Device.Show = v, "Show Devices", "Can show devices", false) }, - { "Device.ShowJobs", new Tuple, Action, 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, Action, 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.AddComments", new Tuple, Action, string, string, bool>(c => c.User.Actions.AddComments, (c, v) => c.User.Actions.AddComments = v, "Add Comments", "Can add user comments", false) }, - { "User.Actions.AddFlags", new Tuple, Action, string, string, bool>(c => c.User.Actions.AddFlags, (c, v) => c.User.Actions.AddFlags = v, "Add User Flags", "Can add user flags", false) }, - { "User.Actions.EditFlags", new Tuple, Action, string, string, bool>(c => c.User.Actions.EditFlags, (c, v) => c.User.Actions.EditFlags = v, "Edit User Flags", "Can edit user flags", false) }, - { "User.Actions.GenerateDocuments", new Tuple, Action, string, string, bool>(c => c.User.Actions.GenerateDocuments, (c, v) => c.User.Actions.GenerateDocuments = v, "Generate Documents", "Can generate documents for users", false) }, - { "User.Actions.RemoveAnyAttachments", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveAnyAttachments, (c, v) => c.User.Actions.RemoveAnyAttachments = v, "Remove Any Attachments", "Can remove any attachments from users", false) }, - { "User.Actions.RemoveAnyComments", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveAnyComments, (c, v) => c.User.Actions.RemoveAnyComments = v, "Remove Any Comments", "Can remove any user comments", false) }, - { "User.Actions.RemoveOwnAttachments", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveOwnAttachments, (c, v) => c.User.Actions.RemoveOwnAttachments = v, "Remove Own Attachments", "Can remove own attachments from users", false) }, - { "User.Actions.RemoveOwnComments", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveOwnComments, (c, v) => c.User.Actions.RemoveOwnComments = v, "Remove Own Comments", "Can remove own user comments", false) }, - { "User.Actions.RemoveFlags", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveFlags, (c, v) => c.User.Actions.RemoveFlags = v, "Remove User Flags", "Can remove user flags", false) }, - { "User.Search", new Tuple, Action, string, string, bool>(c => c.User.Search, (c, v) => c.User.Search = v, "Search Users", "Can search users", false) }, - { "User.ShowAttachments", new Tuple, Action, string, string, bool>(c => c.User.ShowAttachments, (c, v) => c.User.ShowAttachments = v, "Show Attachments", "Can show user attachments", false) }, - { "User.ShowComments", new Tuple, Action, string, string, bool>(c => c.User.ShowComments, (c, v) => c.User.ShowComments = v, "Show Comments", "Can show user comments", false) }, - { "User.ShowAssignmentHistory", new Tuple, Action, string, string, bool>(c => c.User.ShowAssignmentHistory, (c, v) => c.User.ShowAssignmentHistory = v, "Show Device Assignment History", "Can show the device assignment history for users", false) }, - { "User.ShowAssignments", new Tuple, Action, string, string, bool>(c => c.User.ShowAssignments, (c, v) => c.User.ShowAssignments = v, "Show Device Assignments", "Can show the current device assignments users", false) }, - { "User.Show", new Tuple, Action, string, string, bool>(c => c.User.Show, (c, v) => c.User.Show = v, "Show Users", "Can show users", false) }, - { "User.ShowAuthorization", new Tuple, Action, string, string, bool>(c => c.User.ShowAuthorization, (c, v) => c.User.ShowAuthorization = v, "Show Users Authorization", "Can show authorization permissions associated with users", false) }, - { "User.ShowDetails", new Tuple, Action, string, string, bool>(c => c.User.ShowDetails, (c, v) => c.User.ShowDetails = v, "Show Users Details", "Can show users contact and personal details", false) }, - { "User.ShowFlagAssignments", new Tuple, Action, 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, Action, 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, Action, string, string, bool>(c => c.ComputerAccount, (c, v) => c.ComputerAccount = v, "Computer Account", "Represents a computer account", true) }, - { "DiscoAdminAccount", new Tuple, Action, string, string, bool>(c => c.DiscoAdminAccount, (c, v) => c.DiscoAdminAccount = v, "Disco Administrator Account", "Represents a Disco ICT Administrator account", true) } - }; + { + { "Config.DeviceCertificate.DownloadCertificates", new Tuple, Action, string, string, bool>(c => c.Config.DeviceCertificate.DownloadCertificates, (c, v) => c.Config.DeviceCertificate.DownloadCertificates = v, "Download Certificates", "Can download certificates", false) }, + { "Config.Enrolment.Configure", new Tuple, Action, string, string, bool>(c => c.Config.Enrolment.Configure, (c, v) => c.Config.Enrolment.Configure = v, "Configure Enrolment", "Can configure device enrolment", false) }, + { "Config.Enrolment.DownloadBootstrapper", new Tuple, Action, string, string, bool>(c => c.Config.Enrolment.DownloadBootstrapper, (c, v) => c.Config.Enrolment.DownloadBootstrapper = v, "Download Bootstrapper", "Can download the Device Bootstrapper", false) }, + { "Config.Enrolment.Show", new Tuple, Action, string, string, bool>(c => c.Config.Enrolment.Show, (c, v) => c.Config.Enrolment.Show = v, "Show Enrolment", "Can show device enrolment", false) }, + { "Config.Enrolment.ShowStatus", new Tuple, Action, string, string, bool>(c => c.Config.Enrolment.ShowStatus, (c, v) => c.Config.Enrolment.ShowStatus = v, "Show Enrolment Status", "Can show the enrolment status", false) }, + { "Config.DeviceBatch.Configure", new Tuple, Action, string, string, bool>(c => c.Config.DeviceBatch.Configure, (c, v) => c.Config.DeviceBatch.Configure = v, "Configure Device Batches", "Can configure device batches", false) }, + { "Config.DeviceBatch.Create", new Tuple, Action, string, string, bool>(c => c.Config.DeviceBatch.Create, (c, v) => c.Config.DeviceBatch.Create = v, "Create Device Batches", "Can create device batches", false) }, + { "Config.DeviceBatch.Delete", new Tuple, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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.CreateCustom", new Tuple, Action, string, string, bool>(c => c.Config.DeviceModel.CreateCustom, (c, v) => c.Config.DeviceModel.CreateCustom = v, "Create Custom Device Models", "Can create custom device models", false) }, + { "Config.DeviceModel.Delete", new Tuple, Action, 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.Show", new Tuple, Action, string, string, bool>(c => c.Config.DeviceModel.Show, (c, v) => c.Config.DeviceModel.Show = v, "Show Device Models", "Can show device models", false) }, + { "Config.DeviceProfile.ConfigureComputerNameTemplate", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.ConfigureComputerNameTemplate, (c, v) => c.Config.DeviceProfile.ConfigureComputerNameTemplate = v, "Configure Computer Name Templates", "Can configure computer name templates for device profiles", false) }, + { "Config.DeviceProfile.ConfigureDefaults", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.ConfigureDefaults, (c, v) => c.Config.DeviceProfile.ConfigureDefaults = v, "Configure Default Device Profiles", "Can configure default device profiles", false) }, + { "Config.DeviceProfile.Configure", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.Configure, (c, v) => c.Config.DeviceProfile.Configure = v, "Configure Device Profiles", "Can configure device profiles", false) }, + { "Config.DeviceProfile.Create", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.Create, (c, v) => c.Config.DeviceProfile.Create = v, "Create Device Profiles", "Can create device profiles", false) }, + { "Config.DeviceProfile.Delete", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.Delete, (c, v) => c.Config.DeviceProfile.Delete = v, "Delete Device Profiles", "Can delete device profiles", false) }, + { "Config.DeviceProfile.Show", new Tuple, Action, string, string, bool>(c => c.Config.DeviceProfile.Show, (c, v) => c.Config.DeviceProfile.Show = v, "Show Device Profiles", "Can show device profiles", false) }, + { "Config.DocumentTemplate.BulkGenerate", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.BulkGenerate, (c, v) => c.Config.DocumentTemplate.BulkGenerate = v, "Bulk Generate Document Templates", "Can bulk generate document templates", false) }, + { "Config.DocumentTemplate.ConfigureFilterExpression", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.ConfigureFilterExpression, (c, v) => c.Config.DocumentTemplate.ConfigureFilterExpression = v, "Configure Advanced Expression", "Can configure filter, generate and import expressions for document templates", false) }, + { "Config.DocumentTemplate.Configure", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Configure, (c, v) => c.Config.DocumentTemplate.Configure = v, "Configure Document Templates", "Can configure document templates", false) }, + { "Config.DocumentTemplate.Create", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Create, (c, v) => c.Config.DocumentTemplate.Create = v, "Create Document Templates", "Can create document templates", false) }, + { "Config.DocumentTemplate.Delete", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Delete, (c, v) => c.Config.DocumentTemplate.Delete = v, "Delete Document Templates", "Can delete document templates", false) }, + { "Config.DocumentTemplate.Export", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Export, (c, v) => c.Config.DocumentTemplate.Export = v, "Export Attachment Instances", "Can export document attachment instances", false) }, + { "Config.DocumentTemplate.UndetectedPages", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.UndetectedPages, (c, v) => c.Config.DocumentTemplate.UndetectedPages = v, "Process Undetected Pages", "Can show and assign imported documents which were not undetected", false) }, + { "Config.DocumentTemplate.ShowStatus", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.ShowStatus, (c, v) => c.Config.DocumentTemplate.ShowStatus = v, "Show Document Template Import Status", "Can show the document template import status", false) }, + { "Config.DocumentTemplate.Show", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Show, (c, v) => c.Config.DocumentTemplate.Show = v, "Show Document Templates", "Can show document templates", false) }, + { "Config.DocumentTemplate.Upload", new Tuple, Action, string, string, bool>(c => c.Config.DocumentTemplate.Upload, (c, v) => c.Config.DocumentTemplate.Upload = v, "Upload Document Templates", "Can upload document templates", false) }, + { "Config.Logging.Show", new Tuple, Action, string, string, bool>(c => c.Config.Logging.Show, (c, v) => c.Config.Logging.Show = v, "Show Logging", "Can show logging", false) }, + { "Config.Plugin.Configure", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.Configure, (c, v) => c.Config.Plugin.Configure = v, "Configure Plugins", "Can configure plugins", false) }, + { "Config.Plugin.InstallLocal", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.InstallLocal, (c, v) => c.Config.Plugin.InstallLocal = v, "Install/Update Local Plugins", "Can install and update locally uploaded plugins", false) }, + { "Config.Plugin.Install", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.Install, (c, v) => c.Config.Plugin.Install = v, "Install/Update Plugins", "Can install and update plugins", false) }, + { "Config.Plugin.Show", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.Show, (c, v) => c.Config.Plugin.Show = v, "Show Plugins", "Can show plugins", false) }, + { "Config.Plugin.Uninstall", new Tuple, Action, string, string, bool>(c => c.Config.Plugin.Uninstall, (c, v) => c.Config.Plugin.Uninstall = v, "Uninstall Plugins", "Can uninstall plugins", false) }, + { "Config.System.ConfigureActiveDirectory", new Tuple, Action, string, string, bool>(c => c.Config.System.ConfigureActiveDirectory, (c, v) => c.Config.System.ConfigureActiveDirectory = v, "Configure Active Directory Settings", "Can configure the Active Directory interoperability settings", false) }, + { "Config.System.ConfigureEmail", new Tuple, Action, string, string, bool>(c => c.Config.System.ConfigureEmail, (c, v) => c.Config.System.ConfigureEmail = v, "Configure Email Settings", "Can configure the email settings", false) }, + { "Config.System.ConfigureProxy", new Tuple, Action, string, string, bool>(c => c.Config.System.ConfigureProxy, (c, v) => c.Config.System.ConfigureProxy = v, "Configure Proxy Settings", "Can configure the proxy settings", false) }, + { "Config.System.Show", new Tuple, Action, string, string, bool>(c => c.Config.System.Show, (c, v) => c.Config.System.Show = v, "Show System Configuration", "Can show the system configuration", false) }, + { "Config.Organisation.ConfigureAddresses", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.ConfigureAddresses, (c, v) => c.Config.Organisation.ConfigureAddresses = v, "Configure Addresses", "Can configure organisation addresses", false) }, + { "Config.Organisation.ConfigureLogo", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.ConfigureLogo, (c, v) => c.Config.Organisation.ConfigureLogo = v, "Configure Logo", "Can configure the organisation logo", false) }, + { "Config.Organisation.ConfigureMultiSiteMode", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.ConfigureMultiSiteMode, (c, v) => c.Config.Organisation.ConfigureMultiSiteMode = v, "Configure Multi-Site Mode", "Can configure multi-site mode", false) }, + { "Config.Organisation.ConfigureName", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.ConfigureName, (c, v) => c.Config.Organisation.ConfigureName = v, "Configure Name", "Can configure the organisation name", false) }, + { "Config.Organisation.Show", new Tuple, Action, string, string, bool>(c => c.Config.Organisation.Show, (c, v) => c.Config.Organisation.Show = v, "Show Organisation Details", "Can show the organisation details", false) }, + { "Config.JobPreferences.Configure", new Tuple, Action, string, string, bool>(c => c.Config.JobPreferences.Configure, (c, v) => c.Config.JobPreferences.Configure = v, "Configure Job Preferences", "Can configure job preferences", false) }, + { "Config.JobPreferences.Show", new Tuple, Action, string, string, bool>(c => c.Config.JobPreferences.Show, (c, v) => c.Config.JobPreferences.Show = v, "Show Job Preferences", "Can show job preferences", false) }, + { "Config.JobQueue.Configure", new Tuple, Action, string, string, bool>(c => c.Config.JobQueue.Configure, (c, v) => c.Config.JobQueue.Configure = v, "Configure Job Queues", "Can configure job queues", false) }, + { "Config.JobQueue.Create", new Tuple, Action, string, string, bool>(c => c.Config.JobQueue.Create, (c, v) => c.Config.JobQueue.Create = v, "Create Job Queues", "Can create job queues", false) }, + { "Config.JobQueue.Delete", new Tuple, Action, string, string, bool>(c => c.Config.JobQueue.Delete, (c, v) => c.Config.JobQueue.Delete = v, "Delete Job Queues", "Can delete job queues", false) }, + { "Config.JobQueue.Show", new Tuple, Action, string, string, bool>(c => c.Config.JobQueue.Show, (c, v) => c.Config.JobQueue.Show = v, "Show Job Queues", "Can show job queues", false) }, + { "Config.UserFlag.Configure", new Tuple, Action, 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, Action, 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, Action, 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, Action, 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, Action, string, string, bool>(c => c.Config.UserFlag.Show, (c, v) => c.Config.UserFlag.Show = v, "Show User Flags", "Can show user flags", false) }, + { "Config.ManageSavedExports", new Tuple, Action, string, string, bool>(c => c.Config.ManageSavedExports, (c, v) => c.Config.ManageSavedExports = v, "Managed Saved Exports", "Can manage saved exports", false) }, + { "Config.Show", new Tuple, Action, 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, Action, string, string, bool>(c => c.Job.Lists.AllOpen, (c, v) => c.Job.Lists.AllOpen = v, "All Open List", "Can show list", false) }, + { "Job.Lists.AwaitingFinanceAgreementBreach", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinanceAgreementBreach, (c, v) => c.Job.Lists.AwaitingFinanceAgreementBreach = v, "Awaiting Finance Agreement Breach List", "Can show list (NOTE: Requires Awaiting Finance List)", false) }, + { "Job.Lists.AwaitingFinanceCharge", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinanceCharge, (c, v) => c.Job.Lists.AwaitingFinanceCharge = v, "Awaiting Finance Charge List", "Can show list (NOTE: Requires Awaiting Finance List)", false) }, + { "Job.Lists.AwaitingFinanceInsuranceProcessing", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinanceInsuranceProcessing, (c, v) => c.Job.Lists.AwaitingFinanceInsuranceProcessing = v, "Awaiting Finance Insurance Processing List", "Can show list (NOTE: Requires Awaiting Finance List)", false) }, + { "Job.Lists.AwaitingFinance", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinance, (c, v) => c.Job.Lists.AwaitingFinance = v, "Awaiting Finance List", "Can show list", false) }, + { "Job.Lists.AwaitingFinancePayment", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingFinancePayment, (c, v) => c.Job.Lists.AwaitingFinancePayment = v, "Awaiting Finance Payment List", "Can show list (NOTE: Requires Awaiting Finance List)", false) }, + { "Job.Lists.AwaitingTechnicianAction", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingTechnicianAction, (c, v) => c.Job.Lists.AwaitingTechnicianAction = v, "Awaiting Technician Action List", "Can show list", false) }, + { "Job.Lists.AwaitingUserAction", new Tuple, Action, string, string, bool>(c => c.Job.Lists.AwaitingUserAction, (c, v) => c.Job.Lists.AwaitingUserAction = v, "Awaiting User Action List", "Can show list", false) }, + { "Job.Lists.DevicesAwaitingRepair", new Tuple, Action, string, string, bool>(c => c.Job.Lists.DevicesAwaitingRepair, (c, v) => c.Job.Lists.DevicesAwaitingRepair = v, "Devices Awaiting Repair List", "Can show list", false) }, + { "Job.Lists.DevicesReadyForReturn", new Tuple, Action, string, string, bool>(c => c.Job.Lists.DevicesReadyForReturn, (c, v) => c.Job.Lists.DevicesReadyForReturn = v, "Devices Ready For Return List", "Can show list", false) }, + { "Job.Lists.JobQueueLists", new Tuple, Action, string, string, bool>(c => c.Job.Lists.JobQueueLists, (c, v) => c.Job.Lists.JobQueueLists = v, "Job Queue Lists", "Can show job queue lists", false) }, + { "Job.Lists.Locations", new Tuple, Action, string, string, bool>(c => c.Job.Lists.Locations, (c, v) => c.Job.Lists.Locations = v, "Locations List", "Can show list", false) }, + { "Job.Lists.LongRunningJobs", new Tuple, Action, string, string, bool>(c => c.Job.Lists.LongRunningJobs, (c, v) => c.Job.Lists.LongRunningJobs = v, "Long Running Jobs List", "Can show list", false) }, + { "Job.Lists.MyJobs", new Tuple, Action, string, string, bool>(c => c.Job.Lists.MyJobs, (c, v) => c.Job.Lists.MyJobs = v, "My Jobs List", "Can show list", false) }, + { "Job.Lists.MyJobsOrphaned", new Tuple, Action, string, string, bool>(c => c.Job.Lists.MyJobsOrphaned, (c, v) => c.Job.Lists.MyJobsOrphaned = v, "My Jobs List (Includes No Queue)", "Can show list", false) }, + { "Job.Lists.RecentlyClosed", new Tuple, Action, string, string, bool>(c => c.Job.Lists.RecentlyClosed, (c, v) => c.Job.Lists.RecentlyClosed = v, "Recently Closed List", "Can show list", false) }, + { "Job.Lists.StaleJobs", new Tuple, Action, string, string, bool>(c => c.Job.Lists.StaleJobs, (c, v) => c.Job.Lists.StaleJobs = v, "Stale Jobs List", "Can show list", false) }, + { "Job.Actions.AddAttachments", new Tuple, Action, string, string, bool>(c => c.Job.Actions.AddAttachments, (c, v) => c.Job.Actions.AddAttachments = v, "Add Attachments", "Can add attachments to jobs", false) }, + { "Job.Actions.AddLogs", new Tuple, Action, string, string, bool>(c => c.Job.Actions.AddLogs, (c, v) => c.Job.Actions.AddLogs = v, "Add Logs", "Can add job logs", false) }, + { "Job.Actions.AddAnyQueues", new Tuple, Action, string, string, bool>(c => c.Job.Actions.AddAnyQueues, (c, v) => c.Job.Actions.AddAnyQueues = v, "Add to Any Queues", "Can add to any job queues", false) }, + { "Job.Actions.AddOwnQueues", new Tuple, Action, string, string, bool>(c => c.Job.Actions.AddOwnQueues, (c, v) => c.Job.Actions.AddOwnQueues = v, "Add to Own Queues", "Can add to own job queues", false) }, + { "Job.Actions.Close", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Close, (c, v) => c.Job.Actions.Close = v, "Close Jobs", "Can close jobs", false) }, + { "Job.Actions.ConvertHWarToHNWar", new Tuple, Action, string, string, bool>(c => c.Job.Actions.ConvertHWarToHNWar, (c, v) => c.Job.Actions.ConvertHWarToHNWar = v, "Convert HWar Jobs To HNWar", "Can convert warranty jobs to non-warranty jobs", false) }, + { "Job.Actions.Create", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Create, (c, v) => c.Job.Actions.Create = v, "Create Jobs", "Can create jobs", false) }, + { "Job.Actions.Delete", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Delete, (c, v) => c.Job.Actions.Delete = v, "Delete Jobs", "Can delete jobs", false) }, + { "Job.Actions.Export", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Export, (c, v) => c.Job.Actions.Export = v, "Export Jobs", "Can export jobs in a bulk format", false) }, + { "Job.Actions.ForceClose", new Tuple, Action, 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, Action, 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, Action, string, string, bool>(c => c.Job.Actions.LogInsurance, (c, v) => c.Job.Actions.LogInsurance = v, "Lodge Insurance", "Can lodge insurance for non-warranty jobs", false) }, + { "Job.Actions.LogRepair", new Tuple, Action, string, string, bool>(c => c.Job.Actions.LogRepair, (c, v) => c.Job.Actions.LogRepair = v, "Lodge Repair", "Can lodge repair for non-warranty jobs", false) }, + { "Job.Actions.LogWarranty", new Tuple, Action, string, string, bool>(c => c.Job.Actions.LogWarranty, (c, v) => c.Job.Actions.LogWarranty = v, "Lodge Warranty", "Can lodge warranty for jobs", false) }, + { "Job.Actions.RemoveAnyAttachments", new Tuple, Action, 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.RemoveAnyLogs", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveAnyLogs, (c, v) => c.Job.Actions.RemoveAnyLogs = v, "Remove Any Logs", "Can remove any job logs", false) }, + { "Job.Actions.RemoveAnyQueues", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveAnyQueues, (c, v) => c.Job.Actions.RemoveAnyQueues = v, "Remove from Any Queues", "Can remove from any job queues", false) }, + { "Job.Actions.RemoveOwnQueues", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveOwnQueues, (c, v) => c.Job.Actions.RemoveOwnQueues = v, "Remove from Own Queues", "Can remove from own job queues", false) }, + { "Job.Actions.RemoveOwnAttachments", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveOwnAttachments, (c, v) => c.Job.Actions.RemoveOwnAttachments = v, "Remove Own Attachments", "Can remove own attachments from jobs", false) }, + { "Job.Actions.RemoveOwnLogs", new Tuple, Action, string, string, bool>(c => c.Job.Actions.RemoveOwnLogs, (c, v) => c.Job.Actions.RemoveOwnLogs = v, "Remove Own Logs", "Can remove own job logs", false) }, + { "Job.Actions.Reopen", new Tuple, Action, string, string, bool>(c => c.Job.Actions.Reopen, (c, v) => c.Job.Actions.Reopen = v, "Reopen Jobs", "Can reopen jobs", false) }, + { "Job.Actions.UpdateSubTypes", new Tuple, Action, string, string, bool>(c => c.Job.Actions.UpdateSubTypes, (c, v) => c.Job.Actions.UpdateSubTypes = v, "Update Sub Types", "Can update sub types for jobs", false) }, + { "Job.Properties.WarrantyProperties.ExternalCompletedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ExternalCompletedDate, (c, v) => c.Job.Properties.WarrantyProperties.ExternalCompletedDate = v, "External Completed Date Property", "Can update property", false) }, + { "Job.Properties.WarrantyProperties.ExternalLoggedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ExternalLoggedDate, (c, v) => c.Job.Properties.WarrantyProperties.ExternalLoggedDate = v, "External Logged Date Property", "Can update property", false) }, + { "Job.Properties.WarrantyProperties.ExternalName", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ExternalName, (c, v) => c.Job.Properties.WarrantyProperties.ExternalName = v, "External Name Property", "Can update property", false) }, + { "Job.Properties.WarrantyProperties.ExternalReference", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ExternalReference, (c, v) => c.Job.Properties.WarrantyProperties.ExternalReference = v, "External Reference Property", "Can update property", false) }, + { "Job.Properties.WarrantyProperties.ProviderDetails", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.ProviderDetails, (c, v) => c.Job.Properties.WarrantyProperties.ProviderDetails = v, "Provider Details", "Can access warranty provider details", false) }, + { "Job.Properties.WarrantyProperties.WarrantyCompleted", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WarrantyProperties.WarrantyCompleted, (c, v) => c.Job.Properties.WarrantyProperties.WarrantyCompleted = v, "Warranty Completed Property", "Can update property", false) }, + { "Job.Properties.NonWarrantyProperties.AccountingChargeAdded", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.AccountingChargeAdded, (c, v) => c.Job.Properties.NonWarrantyProperties.AccountingChargeAdded = v, "Accounting Charge Added Property", "Can update property", false) }, + { "Job.Properties.NonWarrantyProperties.AccountingChargePaid", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.AccountingChargePaid, (c, v) => c.Job.Properties.NonWarrantyProperties.AccountingChargePaid = v, "Accounting Charge Paid Property", "Can update property", false) }, + { "Job.Properties.NonWarrantyProperties.AccountingChargeRequired", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.AccountingChargeRequired, (c, v) => c.Job.Properties.NonWarrantyProperties.AccountingChargeRequired = v, "Accounting Charge Required Property", "Can update property", false) }, + { "Job.Properties.NonWarrantyProperties.AddComponents", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.AddComponents, (c, v) => c.Job.Properties.NonWarrantyProperties.AddComponents = v, "Add Components", "Can add job components (NOTE: Requires Edit Components)", false) }, + { "Job.Properties.NonWarrantyProperties.EditComponents", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.EditComponents, (c, v) => c.Job.Properties.NonWarrantyProperties.EditComponents = v, "Edit Components", "Can edit and remove job components", false) }, + { "Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent", new Tuple, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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.RepairProviderDetails", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairProviderDetails, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairProviderDetails = v, "Repair Provider Details", "Can access repair provider details", false) }, + { "Job.Properties.NonWarrantyProperties.RepairerCompletedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairerCompletedDate, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairerCompletedDate = v, "Repairer Completed Date Property", "Can update property", false) }, + { "Job.Properties.NonWarrantyProperties.RepairerLoggedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairerLoggedDate, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairerLoggedDate = v, "Repairer Logged Date Property", "Can update property", false) }, + { "Job.Properties.NonWarrantyProperties.RepairerName", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairerName, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairerName = v, "Repairer Name Property", "Can update property", false) }, + { "Job.Properties.NonWarrantyProperties.RepairerReference", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NonWarrantyProperties.RepairerReference, (c, v) => c.Job.Properties.NonWarrantyProperties.RepairerReference = v, "Repairer Reference Property", "Can update property", false) }, + { "Job.Properties.JobQueueProperties.EditAnyComments", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditAnyComments, (c, v) => c.Job.Properties.JobQueueProperties.EditAnyComments = v, "Edit Any Comments", "Can edit any job queue comments", false) }, + { "Job.Properties.JobQueueProperties.EditAnyPriority", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditAnyPriority, (c, v) => c.Job.Properties.JobQueueProperties.EditAnyPriority = v, "Edit Any Priority", "Can edit any job queue Priority", false) }, + { "Job.Properties.JobQueueProperties.EditAnySLA", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditAnySLA, (c, v) => c.Job.Properties.JobQueueProperties.EditAnySLA = v, "Edit Any SLA", "Can edit any job queue SLA", false) }, + { "Job.Properties.JobQueueProperties.EditOwnComments", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditOwnComments, (c, v) => c.Job.Properties.JobQueueProperties.EditOwnComments = v, "Edit Own Comments", "Can edit own job queue comments", false) }, + { "Job.Properties.JobQueueProperties.EditOwnPriority", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditOwnPriority, (c, v) => c.Job.Properties.JobQueueProperties.EditOwnPriority = v, "Edit Own Priority", "Can edit own job queue Priority", false) }, + { "Job.Properties.JobQueueProperties.EditOwnSLA", new Tuple, Action, string, string, bool>(c => c.Job.Properties.JobQueueProperties.EditOwnSLA, (c, v) => c.Job.Properties.JobQueueProperties.EditOwnSLA = v, "Edit Own SLA", "Can edit own job queue SLA", false) }, + { "Job.Properties.DeviceHeldLocation", new Tuple, Action, string, string, bool>(c => c.Job.Properties.DeviceHeldLocation, (c, v) => c.Job.Properties.DeviceHeldLocation = v, "Device Held Location Property", "Can update property", false) }, + { "Job.Properties.DeviceHeld", new Tuple, Action, string, string, bool>(c => c.Job.Properties.DeviceHeld, (c, v) => c.Job.Properties.DeviceHeld = v, "Device Held Property", "Can update property", false) }, + { "Job.Properties.DeviceReadyForReturn", new Tuple, Action, string, string, bool>(c => c.Job.Properties.DeviceReadyForReturn, (c, v) => c.Job.Properties.DeviceReadyForReturn = v, "Device Ready For Return Property", "Can update property", false) }, + { "Job.Properties.DeviceReturned", new Tuple, Action, string, string, bool>(c => c.Job.Properties.DeviceReturned, (c, v) => c.Job.Properties.DeviceReturned = v, "Device Returned Property", "Can update property", false) }, + { "Job.Properties.ExpectedClosedDate", new Tuple, Action, string, string, bool>(c => c.Job.Properties.ExpectedClosedDate, (c, v) => c.Job.Properties.ExpectedClosedDate = v, "Expected Closed Date Property", "Can update property", false) }, + { "Job.Properties.Flags", new Tuple, Action, string, string, bool>(c => c.Job.Properties.Flags, (c, v) => c.Job.Properties.Flags = v, "Flags Property", "Can update property", false) }, + { "Job.Properties.NotWaitingForUserAction", new Tuple, Action, string, string, bool>(c => c.Job.Properties.NotWaitingForUserAction, (c, v) => c.Job.Properties.NotWaitingForUserAction = v, "Not Waiting For User Action Property", "Can update property", false) }, + { "Job.Properties.WaitingForUserAction", new Tuple, Action, string, string, bool>(c => c.Job.Properties.WaitingForUserAction, (c, v) => c.Job.Properties.WaitingForUserAction = v, "Waiting For User Action Property", "Can update property", false) }, + { "Job.Types.CreateHMisc", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateHMisc, (c, v) => c.Job.Types.CreateHMisc = v, "Create Hardware - Miscellaneous Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, + { "Job.Types.CreateHNWar", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateHNWar, (c, v) => c.Job.Types.CreateHNWar = v, "Create Hardware - Non-Warranty Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, + { "Job.Types.CreateHWar", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateHWar, (c, v) => c.Job.Types.CreateHWar = v, "Create Hardware - Warranty Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, + { "Job.Types.CreateSApp", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateSApp, (c, v) => c.Job.Types.CreateSApp = v, "Create Software - Application Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, + { "Job.Types.CreateSOS", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateSOS, (c, v) => c.Job.Types.CreateSOS = v, "Create Software - Operating System Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, + { "Job.Types.CreateSImg", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateSImg, (c, v) => c.Job.Types.CreateSImg = v, "Create Software - Reimage Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, + { "Job.Types.CreateUMgmt", new Tuple, Action, string, string, bool>(c => c.Job.Types.CreateUMgmt, (c, v) => c.Job.Types.CreateUMgmt = v, "Create User Management Jobs", "Can create jobs of this type (Requires: Create Jobs)", false) }, + { "Job.Types.ShowHMisc", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowHMisc, (c, v) => c.Job.Types.ShowHMisc = v, "Show Hardware - Miscellaneous Jobs", "Can show jobs of this type", false) }, + { "Job.Types.ShowHNWar", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowHNWar, (c, v) => c.Job.Types.ShowHNWar = v, "Show Hardware - Non-Warranty Jobs", "Can show jobs of this type", false) }, + { "Job.Types.ShowHWar", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowHWar, (c, v) => c.Job.Types.ShowHWar = v, "Show Hardware - Warranty Jobs", "Can show jobs of this type", false) }, + { "Job.Types.ShowSApp", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowSApp, (c, v) => c.Job.Types.ShowSApp = v, "Show Software - Application Jobs", "Can show jobs of this type", false) }, + { "Job.Types.ShowSOS", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowSOS, (c, v) => c.Job.Types.ShowSOS = v, "Show Software - Operating System Jobs", "Can show jobs of this type", false) }, + { "Job.Types.ShowSImg", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowSImg, (c, v) => c.Job.Types.ShowSImg = v, "Show Software - Reimage Jobs", "Can show jobs of this type", false) }, + { "Job.Types.ShowUMgmt", new Tuple, Action, string, string, bool>(c => c.Job.Types.ShowUMgmt, (c, v) => c.Job.Types.ShowUMgmt = v, "Show User Management Jobs", "Can show jobs of this type", false) }, + { "Job.Search", new Tuple, Action, string, string, bool>(c => c.Job.Search, (c, v) => c.Job.Search = v, "Search Jobs", "Can search jobs", false) }, + { "Job.ShowAttachments", new Tuple, Action, string, string, bool>(c => c.Job.ShowAttachments, (c, v) => c.Job.ShowAttachments = v, "Show Attachments", "Can show job attachments", false) }, + { "Job.ShowDailyChart", new Tuple, Action, string, string, bool>(c => c.Job.ShowDailyChart, (c, v) => c.Job.ShowDailyChart = v, "Show Daily Opened & Closed", "Can show daily opened & closed chart", false) }, + { "Job.ShowFlags", new Tuple, Action, string, string, bool>(c => c.Job.ShowFlags, (c, v) => c.Job.ShowFlags = v, "Show Flags", "Can show job flags", false) }, + { "Job.Show", new Tuple, Action, string, string, bool>(c => c.Job.Show, (c, v) => c.Job.Show = v, "Show Jobs", "Can show jobs", false) }, + { "Job.ShowJobsQueues", new Tuple, Action, string, string, bool>(c => c.Job.ShowJobsQueues, (c, v) => c.Job.ShowJobsQueues = v, "Show Jobs Queues", "Can show jobs queues", false) }, + { "Job.ShowLogs", new Tuple, Action, string, string, bool>(c => c.Job.ShowLogs, (c, v) => c.Job.ShowLogs = v, "Show Logs", "Can show job logs", false) }, + { "Job.ShowNonWarrantyComponents", new Tuple, Action, string, string, bool>(c => c.Job.ShowNonWarrantyComponents, (c, v) => c.Job.ShowNonWarrantyComponents = v, "Show Non-Warranty Components", "Can show non-warranty job components", false) }, + { "Job.ShowNonWarrantyFinance", new Tuple, Action, string, string, bool>(c => c.Job.ShowNonWarrantyFinance, (c, v) => c.Job.ShowNonWarrantyFinance = v, "Show Non-Warranty Finance", "Can show non-warranty job finance", false) }, + { "Job.ShowNonWarrantyInsurance", new Tuple, Action, string, string, bool>(c => c.Job.ShowNonWarrantyInsurance, (c, v) => c.Job.ShowNonWarrantyInsurance = v, "Show Non-Warranty Insurance", "Can show non-warranty job insurance", false) }, + { "Job.ShowNonWarrantyRepairs", new Tuple, Action, string, string, bool>(c => c.Job.ShowNonWarrantyRepairs, (c, v) => c.Job.ShowNonWarrantyRepairs = v, "Show Non-Warranty Repairs", "Can show non-warranty job repairs", false) }, + { "Job.ShowWarranty", new Tuple, Action, string, string, bool>(c => c.Job.ShowWarranty, (c, v) => c.Job.ShowWarranty = v, "Show Warranty", "Can show job warranty", false) }, + { "Device.Properties.AssetNumber", new Tuple, Action, string, string, bool>(c => c.Device.Properties.AssetNumber, (c, v) => c.Device.Properties.AssetNumber = v, "Asset Number Property", "Can update property", false) }, + { "Device.Properties.Details", new Tuple, Action, string, string, bool>(c => c.Device.Properties.Details, (c, v) => c.Device.Properties.Details = v, "Detail Properties", "Can update detail properties", false) }, + { "Device.Properties.DeviceBatch", new Tuple, Action, string, string, bool>(c => c.Device.Properties.DeviceBatch, (c, v) => c.Device.Properties.DeviceBatch = v, "Device Batch Property", "Can update property", false) }, + { "Device.Properties.DeviceProfile", new Tuple, Action, 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, Action, 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, Action, 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.AddComments", new Tuple, Action, string, string, bool>(c => c.Device.Actions.AddComments, (c, v) => c.Device.Actions.AddComments = v, "Add Comments", "Can add device comments", false) }, + { "Device.Actions.AddFlags", new Tuple, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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, Action, 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.RemoveAnyComments", new Tuple, Action, string, string, bool>(c => c.Device.Actions.RemoveAnyComments, (c, v) => c.Device.Actions.RemoveAnyComments = v, "Remove Any Comments", "Can remove any device comments", false) }, + { "Device.Actions.RemoveFlags", new Tuple, Action, 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, Action, 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.RemoveOwnComments", new Tuple, Action, string, string, bool>(c => c.Device.Actions.RemoveOwnComments, (c, v) => c.Device.Actions.RemoveOwnComments = v, "Remove Own Comments", "Can remove own device comments", false) }, + { "Device.Search", new Tuple, Action, string, string, bool>(c => c.Device.Search, (c, v) => c.Device.Search = v, "Search Devices", "Can search devices", false) }, + { "Device.ShowAssignmentHistory", new Tuple, Action, 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, Action, string, string, bool>(c => c.Device.ShowAttachments, (c, v) => c.Device.ShowAttachments = v, "Show Attachments", "Can show device attachments", false) }, + { "Device.ShowCertificates", new Tuple, Action, string, string, bool>(c => c.Device.ShowCertificates, (c, v) => c.Device.ShowCertificates = v, "Show Certificates", "Can show certificates associated with devices", false) }, + { "Device.ShowComments", new Tuple, Action, string, string, bool>(c => c.Device.ShowComments, (c, v) => c.Device.ShowComments = v, "Show Comments", "Can show device comments", false) }, + { "Device.ShowDetails", new Tuple, Action, 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, Action, 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, Action, string, string, bool>(c => c.Device.Show, (c, v) => c.Device.Show = v, "Show Devices", "Can show devices", false) }, + { "Device.ShowJobs", new Tuple, Action, 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, Action, 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.AddComments", new Tuple, Action, string, string, bool>(c => c.User.Actions.AddComments, (c, v) => c.User.Actions.AddComments = v, "Add Comments", "Can add user comments", false) }, + { "User.Actions.AddFlags", new Tuple, Action, string, string, bool>(c => c.User.Actions.AddFlags, (c, v) => c.User.Actions.AddFlags = v, "Add User Flags", "Can add user flags", false) }, + { "User.Actions.EditFlags", new Tuple, Action, string, string, bool>(c => c.User.Actions.EditFlags, (c, v) => c.User.Actions.EditFlags = v, "Edit User Flags", "Can edit user flags", false) }, + { "User.Actions.GenerateDocuments", new Tuple, Action, string, string, bool>(c => c.User.Actions.GenerateDocuments, (c, v) => c.User.Actions.GenerateDocuments = v, "Generate Documents", "Can generate documents for users", false) }, + { "User.Actions.RemoveAnyAttachments", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveAnyAttachments, (c, v) => c.User.Actions.RemoveAnyAttachments = v, "Remove Any Attachments", "Can remove any attachments from users", false) }, + { "User.Actions.RemoveAnyComments", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveAnyComments, (c, v) => c.User.Actions.RemoveAnyComments = v, "Remove Any Comments", "Can remove any user comments", false) }, + { "User.Actions.RemoveOwnAttachments", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveOwnAttachments, (c, v) => c.User.Actions.RemoveOwnAttachments = v, "Remove Own Attachments", "Can remove own attachments from users", false) }, + { "User.Actions.RemoveOwnComments", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveOwnComments, (c, v) => c.User.Actions.RemoveOwnComments = v, "Remove Own Comments", "Can remove own user comments", false) }, + { "User.Actions.RemoveFlags", new Tuple, Action, string, string, bool>(c => c.User.Actions.RemoveFlags, (c, v) => c.User.Actions.RemoveFlags = v, "Remove User Flags", "Can remove user flags", false) }, + { "User.Search", new Tuple, Action, string, string, bool>(c => c.User.Search, (c, v) => c.User.Search = v, "Search Users", "Can search users", false) }, + { "User.ShowAttachments", new Tuple, Action, string, string, bool>(c => c.User.ShowAttachments, (c, v) => c.User.ShowAttachments = v, "Show Attachments", "Can show user attachments", false) }, + { "User.ShowComments", new Tuple, Action, string, string, bool>(c => c.User.ShowComments, (c, v) => c.User.ShowComments = v, "Show Comments", "Can show user comments", false) }, + { "User.ShowAssignmentHistory", new Tuple, Action, string, string, bool>(c => c.User.ShowAssignmentHistory, (c, v) => c.User.ShowAssignmentHistory = v, "Show Device Assignment History", "Can show the device assignment history for users", false) }, + { "User.ShowAssignments", new Tuple, Action, string, string, bool>(c => c.User.ShowAssignments, (c, v) => c.User.ShowAssignments = v, "Show Device Assignments", "Can show the current device assignments users", false) }, + { "User.Show", new Tuple, Action, string, string, bool>(c => c.User.Show, (c, v) => c.User.Show = v, "Show Users", "Can show users", false) }, + { "User.ShowAuthorization", new Tuple, Action, string, string, bool>(c => c.User.ShowAuthorization, (c, v) => c.User.ShowAuthorization = v, "Show Users Authorization", "Can show authorization permissions associated with users", false) }, + { "User.ShowDetails", new Tuple, Action, string, string, bool>(c => c.User.ShowDetails, (c, v) => c.User.ShowDetails = v, "Show Users Details", "Can show users contact and personal details", false) }, + { "User.ShowFlagAssignments", new Tuple, Action, 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, Action, 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, Action, string, string, bool>(c => c.ComputerAccount, (c, v) => c.ComputerAccount = v, "Computer Account", "Represents a computer account", true) }, + { "DiscoAdminAccount", new Tuple, Action, string, string, bool>(c => c.DiscoAdminAccount, (c, v) => c.DiscoAdminAccount = v, "Disco Administrator Account", "Represents a Disco ICT Administrator account", true) } + }; #endregion #region Role Claim Navigator - _claimNavigator = - new ClaimNavigatorItem("Claims", "Permissions", "Top-level node for all permissions", false, new List() { - new ClaimNavigatorItem("Config", "Configuration", "Permissions related to Disco ICT Configuration", false, new List() { - new ClaimNavigatorItem("Config.DeviceBatch", "Device Batches", "Permissions related to Device Batches", false, new List() { - new ClaimNavigatorItem("Config.DeviceBatch.Configure", false), - new ClaimNavigatorItem("Config.DeviceBatch.Create", false), - new ClaimNavigatorItem("Config.DeviceBatch.Delete", false), - new ClaimNavigatorItem("Config.DeviceBatch.Show", false), - new ClaimNavigatorItem("Config.DeviceBatch.ShowTimeline", false) - }), - new ClaimNavigatorItem("Config.DeviceCertificate", "Device Certificates", "Permissions related to Device Certificates", false, new List() { - new ClaimNavigatorItem("Config.DeviceCertificate.DownloadCertificates", false) - }), - new ClaimNavigatorItem("Config.DeviceFlag", "Device Flags", "Permissions related to Device Flags", false, new List() { - 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() { - new ClaimNavigatorItem("Config.DeviceModel.ConfigureComponents", false), - new ClaimNavigatorItem("Config.DeviceModel.Configure", false), - new ClaimNavigatorItem("Config.DeviceModel.CreateCustom", false), - new ClaimNavigatorItem("Config.DeviceModel.Delete", false), - new ClaimNavigatorItem("Config.DeviceModel.Show", false) - }), - new ClaimNavigatorItem("Config.DeviceProfile", "Device Profiles", "Permissions related to Device Profiles", false, new List() { - new ClaimNavigatorItem("Config.DeviceProfile.ConfigureComputerNameTemplate", false), - new ClaimNavigatorItem("Config.DeviceProfile.ConfigureDefaults", false), - new ClaimNavigatorItem("Config.DeviceProfile.Configure", false), - new ClaimNavigatorItem("Config.DeviceProfile.Create", false), - new ClaimNavigatorItem("Config.DeviceProfile.Delete", false), - new ClaimNavigatorItem("Config.DeviceProfile.Show", false) - }), - new ClaimNavigatorItem("Config.DocumentTemplate", "Document Templates", "Permissions related to Document Templates", false, new List() { - new ClaimNavigatorItem("Config.DocumentTemplate.BulkGenerate", false), - new ClaimNavigatorItem("Config.DocumentTemplate.ConfigureFilterExpression", false), - new ClaimNavigatorItem("Config.DocumentTemplate.Configure", false), - new ClaimNavigatorItem("Config.DocumentTemplate.Create", false), - new ClaimNavigatorItem("Config.DocumentTemplate.Delete", false), - new ClaimNavigatorItem("Config.DocumentTemplate.Export", false), - new ClaimNavigatorItem("Config.DocumentTemplate.UndetectedPages", false), - new ClaimNavigatorItem("Config.DocumentTemplate.ShowStatus", false), - new ClaimNavigatorItem("Config.DocumentTemplate.Show", false), - new ClaimNavigatorItem("Config.DocumentTemplate.Upload", false) - }), - new ClaimNavigatorItem("Config.Enrolment", "Enrolment", "Permissions related to Device Enrolment", false, new List() { - new ClaimNavigatorItem("Config.Enrolment.Configure", false), - new ClaimNavigatorItem("Config.Enrolment.DownloadBootstrapper", false), - new ClaimNavigatorItem("Config.Enrolment.Show", false), - new ClaimNavigatorItem("Config.Enrolment.ShowStatus", false) - }), - new ClaimNavigatorItem("Config.JobPreferences", "Job Preferences", "Permissions related to Job Preferences", false, new List() { - new ClaimNavigatorItem("Config.JobPreferences.Configure", false), - new ClaimNavigatorItem("Config.JobPreferences.Show", false) - }), - new ClaimNavigatorItem("Config.JobQueue", "Job Queues", "Permissions related to Job Queues", false, new List() { - new ClaimNavigatorItem("Config.JobQueue.Configure", false), - new ClaimNavigatorItem("Config.JobQueue.Create", false), - new ClaimNavigatorItem("Config.JobQueue.Delete", false), - new ClaimNavigatorItem("Config.JobQueue.Show", false) - }), - new ClaimNavigatorItem("Config.Logging", "Logging", "Permissions related to Logging", false, new List() { - new ClaimNavigatorItem("Config.Logging.Show", false) - }), - new ClaimNavigatorItem("Config.Organisation", "Organisation Details", "Permissions related to the Organisation Details", false, new List() { - new ClaimNavigatorItem("Config.Organisation.ConfigureAddresses", false), - new ClaimNavigatorItem("Config.Organisation.ConfigureLogo", false), - new ClaimNavigatorItem("Config.Organisation.ConfigureMultiSiteMode", false), - new ClaimNavigatorItem("Config.Organisation.ConfigureName", false), - new ClaimNavigatorItem("Config.Organisation.Show", false) - }), - new ClaimNavigatorItem("Config.Plugin", "Plugin", "Permissions related to Plugins", false, new List() { - new ClaimNavigatorItem("Config.Plugin.Configure", false), - new ClaimNavigatorItem("Config.Plugin.InstallLocal", false), - new ClaimNavigatorItem("Config.Plugin.Install", false), - new ClaimNavigatorItem("Config.Plugin.Show", false), - new ClaimNavigatorItem("Config.Plugin.Uninstall", false) - }), - new ClaimNavigatorItem("Config.System", "System", "Permissions related to System Configuration", false, new List() { - new ClaimNavigatorItem("Config.System.ConfigureActiveDirectory", false), - new ClaimNavigatorItem("Config.System.ConfigureEmail", false), - new ClaimNavigatorItem("Config.System.ConfigureProxy", false), - new ClaimNavigatorItem("Config.System.Show", false) - }), - new ClaimNavigatorItem("Config.UserFlag", "User Flags", "Permissions related to User Flags", false, new List() { - new ClaimNavigatorItem("Config.UserFlag.Configure", false), - new ClaimNavigatorItem("Config.UserFlag.Create", false), - new ClaimNavigatorItem("Config.UserFlag.Delete", false), - new ClaimNavigatorItem("Config.UserFlag.Export", false), - new ClaimNavigatorItem("Config.UserFlag.Show", false) - }), - new ClaimNavigatorItem("Config.ManageSavedExports", false), - new ClaimNavigatorItem("Config.Show", false) - }), - new ClaimNavigatorItem("Job", "Job", "Permissions related to Jobs", false, new List() { - new ClaimNavigatorItem("Job.Actions", "Actions", "Permissions related to Job Actions", false, new List() { - new ClaimNavigatorItem("Job.Actions.AddAttachments", false), - new ClaimNavigatorItem("Job.Actions.AddLogs", false), - new ClaimNavigatorItem("Job.Actions.AddAnyQueues", false), - new ClaimNavigatorItem("Job.Actions.AddOwnQueues", false), - new ClaimNavigatorItem("Job.Actions.Close", false), - new ClaimNavigatorItem("Job.Actions.ConvertHWarToHNWar", false), - new ClaimNavigatorItem("Job.Actions.Create", false), - new ClaimNavigatorItem("Job.Actions.Delete", false), - new ClaimNavigatorItem("Job.Actions.Export", false), - new ClaimNavigatorItem("Job.Actions.ForceClose", false), - new ClaimNavigatorItem("Job.Actions.GenerateDocuments", false), - new ClaimNavigatorItem("Job.Actions.LogInsurance", false), - new ClaimNavigatorItem("Job.Actions.LogRepair", false), - new ClaimNavigatorItem("Job.Actions.LogWarranty", false), - new ClaimNavigatorItem("Job.Actions.RemoveAnyAttachments", false), - new ClaimNavigatorItem("Job.Actions.RemoveAnyLogs", false), - new ClaimNavigatorItem("Job.Actions.RemoveAnyQueues", false), - new ClaimNavigatorItem("Job.Actions.RemoveOwnQueues", false), - new ClaimNavigatorItem("Job.Actions.RemoveOwnAttachments", false), - new ClaimNavigatorItem("Job.Actions.RemoveOwnLogs", false), - new ClaimNavigatorItem("Job.Actions.Reopen", false), - new ClaimNavigatorItem("Job.Actions.UpdateSubTypes", false) - }), - new ClaimNavigatorItem("Job.Properties", "Job Properties", "Permissions related to Job Properties", false, new List() { - new ClaimNavigatorItem("Job.Properties.JobQueueProperties", "Job Queue Properties", "Permissions related to Job Queue Job Properties", false, new List() { - new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditAnyComments", false), - new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditAnyPriority", false), - new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditAnySLA", false), - new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditOwnComments", false), - new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditOwnPriority", false), - new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditOwnSLA", false) - }), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties", "Non Warranty Properties", "Permissions related to Non-Warranty Job Properties", false, new List() { - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.AccountingChargeAdded", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.AccountingChargePaid", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.AccountingChargeRequired", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.AddComponents", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.EditComponents", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.InsuranceDetails", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.InvoiceReceived", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.IsInsuranceClaim", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.PurchaseOrderRaised", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.PurchaseOrderReference", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.PurchaseOrderSent", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairProviderDetails", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairerCompletedDate", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairerLoggedDate", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairerName", false), - new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairerReference", false) - }), - new ClaimNavigatorItem("Job.Properties.WarrantyProperties", "Warranty Properties", "Permissions related to Warranty Job Properties", false, new List() { - new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ExternalCompletedDate", false), - new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ExternalLoggedDate", false), - new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ExternalName", false), - new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ExternalReference", false), - new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ProviderDetails", false), - new ClaimNavigatorItem("Job.Properties.WarrantyProperties.WarrantyCompleted", false) - }), - new ClaimNavigatorItem("Job.Properties.DeviceHeldLocation", false), - new ClaimNavigatorItem("Job.Properties.DeviceHeld", false), - new ClaimNavigatorItem("Job.Properties.DeviceReadyForReturn", false), - new ClaimNavigatorItem("Job.Properties.DeviceReturned", false), - new ClaimNavigatorItem("Job.Properties.ExpectedClosedDate", false), - new ClaimNavigatorItem("Job.Properties.Flags", false), - new ClaimNavigatorItem("Job.Properties.NotWaitingForUserAction", false), - new ClaimNavigatorItem("Job.Properties.WaitingForUserAction", false) - }), - new ClaimNavigatorItem("Job.Lists", "Lists", "Permissions related to Job Lists", false, new List() { - new ClaimNavigatorItem("Job.Lists.AllOpen", false), - new ClaimNavigatorItem("Job.Lists.AwaitingFinanceAgreementBreach", false), - new ClaimNavigatorItem("Job.Lists.AwaitingFinanceCharge", false), - new ClaimNavigatorItem("Job.Lists.AwaitingFinanceInsuranceProcessing", false), - new ClaimNavigatorItem("Job.Lists.AwaitingFinance", false), - new ClaimNavigatorItem("Job.Lists.AwaitingFinancePayment", false), - new ClaimNavigatorItem("Job.Lists.AwaitingTechnicianAction", false), - new ClaimNavigatorItem("Job.Lists.AwaitingUserAction", false), - new ClaimNavigatorItem("Job.Lists.DevicesAwaitingRepair", false), - new ClaimNavigatorItem("Job.Lists.DevicesReadyForReturn", false), - new ClaimNavigatorItem("Job.Lists.JobQueueLists", false), - new ClaimNavigatorItem("Job.Lists.Locations", false), - new ClaimNavigatorItem("Job.Lists.LongRunningJobs", false), - new ClaimNavigatorItem("Job.Lists.MyJobs", false), - new ClaimNavigatorItem("Job.Lists.MyJobsOrphaned", false), - new ClaimNavigatorItem("Job.Lists.RecentlyClosed", false), - new ClaimNavigatorItem("Job.Lists.StaleJobs", false) - }), - new ClaimNavigatorItem("Job.Types", "Types", "Permissions related to Job Types", false, new List() { - new ClaimNavigatorItem("Job.Types.CreateHMisc", false), - new ClaimNavigatorItem("Job.Types.CreateHNWar", false), - new ClaimNavigatorItem("Job.Types.CreateHWar", false), - new ClaimNavigatorItem("Job.Types.CreateSApp", false), - new ClaimNavigatorItem("Job.Types.CreateSOS", false), - new ClaimNavigatorItem("Job.Types.CreateSImg", false), - new ClaimNavigatorItem("Job.Types.CreateUMgmt", false), - new ClaimNavigatorItem("Job.Types.ShowHMisc", false), - new ClaimNavigatorItem("Job.Types.ShowHNWar", false), - new ClaimNavigatorItem("Job.Types.ShowHWar", false), - new ClaimNavigatorItem("Job.Types.ShowSApp", false), - new ClaimNavigatorItem("Job.Types.ShowSOS", false), - new ClaimNavigatorItem("Job.Types.ShowSImg", false), - new ClaimNavigatorItem("Job.Types.ShowUMgmt", false) - }), - new ClaimNavigatorItem("Job.Search", false), - new ClaimNavigatorItem("Job.ShowAttachments", false), - new ClaimNavigatorItem("Job.ShowDailyChart", false), - new ClaimNavigatorItem("Job.ShowFlags", false), - new ClaimNavigatorItem("Job.Show", false), - new ClaimNavigatorItem("Job.ShowJobsQueues", false), - new ClaimNavigatorItem("Job.ShowLogs", false), - new ClaimNavigatorItem("Job.ShowNonWarrantyComponents", false), - new ClaimNavigatorItem("Job.ShowNonWarrantyFinance", false), - new ClaimNavigatorItem("Job.ShowNonWarrantyInsurance", false), - new ClaimNavigatorItem("Job.ShowNonWarrantyRepairs", false), - new ClaimNavigatorItem("Job.ShowWarranty", false) - }), - new ClaimNavigatorItem("Device", "Device", "Permissions related to Devices", false, new List() { - new ClaimNavigatorItem("Device.Actions", "Actions", "Permissions related to Device Actions", false, new List() { - new ClaimNavigatorItem("Device.Actions.AddAttachments", false), - new ClaimNavigatorItem("Device.Actions.AddComments", false), - new ClaimNavigatorItem("Device.Actions.AddFlags", false), - new ClaimNavigatorItem("Device.Actions.AllowUnauthenticatedEnrol", false), - new ClaimNavigatorItem("Device.Actions.AssignUser", false), - new ClaimNavigatorItem("Device.Actions.Decommission", false), - new ClaimNavigatorItem("Device.Actions.Delete", false), - new ClaimNavigatorItem("Device.Actions.EditFlags", false), - new ClaimNavigatorItem("Device.Actions.EnrolDevices", false), - new ClaimNavigatorItem("Device.Actions.Export", false), - new ClaimNavigatorItem("Device.Actions.GenerateDocuments", false), - new ClaimNavigatorItem("Device.Actions.Import", false), - new ClaimNavigatorItem("Device.Actions.Recommission", false), - new ClaimNavigatorItem("Device.Actions.RemoveAnyAttachments", false), - new ClaimNavigatorItem("Device.Actions.RemoveAnyComments", false), - new ClaimNavigatorItem("Device.Actions.RemoveFlags", false), - new ClaimNavigatorItem("Device.Actions.RemoveOwnAttachments", false), - new ClaimNavigatorItem("Device.Actions.RemoveOwnComments", false) - }), - new ClaimNavigatorItem("Device.Properties", "Device Properties", "Permissions related to Device Properties", false, new List() { - new ClaimNavigatorItem("Device.Properties.AssetNumber", false), - new ClaimNavigatorItem("Device.Properties.Details", false), - new ClaimNavigatorItem("Device.Properties.DeviceBatch", false), - new ClaimNavigatorItem("Device.Properties.DeviceProfile", false), - new ClaimNavigatorItem("Device.Properties.Location", false) - }), - new ClaimNavigatorItem("Device.Search", false), - new ClaimNavigatorItem("Device.ShowAssignmentHistory", false), - new ClaimNavigatorItem("Device.ShowAttachments", false), - new ClaimNavigatorItem("Device.ShowCertificates", false), - new ClaimNavigatorItem("Device.ShowComments", false), - new ClaimNavigatorItem("Device.ShowDetails", false), - new ClaimNavigatorItem("Device.ShowFlagAssignments", false), - new ClaimNavigatorItem("Device.Show", false), - new ClaimNavigatorItem("Device.ShowJobs", false) - }), - new ClaimNavigatorItem("User", "User", "Permissions related to Users", false, new List() { - new ClaimNavigatorItem("User.Actions", "Actions", "Permissions related to User Actions", false, new List() { - new ClaimNavigatorItem("User.Actions.AddAttachments", false), - new ClaimNavigatorItem("User.Actions.AddComments", false), - new ClaimNavigatorItem("User.Actions.AddFlags", false), - new ClaimNavigatorItem("User.Actions.EditFlags", false), - new ClaimNavigatorItem("User.Actions.GenerateDocuments", false), - new ClaimNavigatorItem("User.Actions.RemoveAnyAttachments", false), - new ClaimNavigatorItem("User.Actions.RemoveAnyComments", false), - new ClaimNavigatorItem("User.Actions.RemoveOwnAttachments", false), - new ClaimNavigatorItem("User.Actions.RemoveOwnComments", false), - new ClaimNavigatorItem("User.Actions.RemoveFlags", false) - }), - new ClaimNavigatorItem("User.Search", false), - new ClaimNavigatorItem("User.ShowAttachments", false), - new ClaimNavigatorItem("User.ShowComments", false), - new ClaimNavigatorItem("User.ShowAssignmentHistory", false), - new ClaimNavigatorItem("User.ShowAssignments", false), - new ClaimNavigatorItem("User.Show", false), - new ClaimNavigatorItem("User.ShowAuthorization", false), - new ClaimNavigatorItem("User.ShowDetails", false), - new ClaimNavigatorItem("User.ShowFlagAssignments", false), - new ClaimNavigatorItem("User.ShowJobs", false) - }), - new ClaimNavigatorItem("ComputerAccount", true), - new ClaimNavigatorItem("DiscoAdminAccount", true) - }); + _claimNavigator = + new ClaimNavigatorItem("Claims", "Permissions", "Top-level node for all permissions", false, new List() { + new ClaimNavigatorItem("Config", "Configuration", "Permissions related to Disco ICT Configuration", false, new List() { + new ClaimNavigatorItem("Config.DeviceBatch", "Device Batches", "Permissions related to Device Batches", false, new List() { + new ClaimNavigatorItem("Config.DeviceBatch.Configure", false), + new ClaimNavigatorItem("Config.DeviceBatch.Create", false), + new ClaimNavigatorItem("Config.DeviceBatch.Delete", false), + new ClaimNavigatorItem("Config.DeviceBatch.Show", false), + new ClaimNavigatorItem("Config.DeviceBatch.ShowTimeline", false) + }), + new ClaimNavigatorItem("Config.DeviceCertificate", "Device Certificates", "Permissions related to Device Certificates", false, new List() { + new ClaimNavigatorItem("Config.DeviceCertificate.DownloadCertificates", false) + }), + new ClaimNavigatorItem("Config.DeviceFlag", "Device Flags", "Permissions related to Device Flags", false, new List() { + 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() { + new ClaimNavigatorItem("Config.DeviceModel.ConfigureComponents", false), + new ClaimNavigatorItem("Config.DeviceModel.Configure", false), + new ClaimNavigatorItem("Config.DeviceModel.CreateCustom", false), + new ClaimNavigatorItem("Config.DeviceModel.Delete", false), + new ClaimNavigatorItem("Config.DeviceModel.Show", false) + }), + new ClaimNavigatorItem("Config.DeviceProfile", "Device Profiles", "Permissions related to Device Profiles", false, new List() { + new ClaimNavigatorItem("Config.DeviceProfile.ConfigureComputerNameTemplate", false), + new ClaimNavigatorItem("Config.DeviceProfile.ConfigureDefaults", false), + new ClaimNavigatorItem("Config.DeviceProfile.Configure", false), + new ClaimNavigatorItem("Config.DeviceProfile.Create", false), + new ClaimNavigatorItem("Config.DeviceProfile.Delete", false), + new ClaimNavigatorItem("Config.DeviceProfile.Show", false) + }), + new ClaimNavigatorItem("Config.DocumentTemplate", "Document Templates", "Permissions related to Document Templates", false, new List() { + new ClaimNavigatorItem("Config.DocumentTemplate.BulkGenerate", false), + new ClaimNavigatorItem("Config.DocumentTemplate.ConfigureFilterExpression", false), + new ClaimNavigatorItem("Config.DocumentTemplate.Configure", false), + new ClaimNavigatorItem("Config.DocumentTemplate.Create", false), + new ClaimNavigatorItem("Config.DocumentTemplate.Delete", false), + new ClaimNavigatorItem("Config.DocumentTemplate.Export", false), + new ClaimNavigatorItem("Config.DocumentTemplate.UndetectedPages", false), + new ClaimNavigatorItem("Config.DocumentTemplate.ShowStatus", false), + new ClaimNavigatorItem("Config.DocumentTemplate.Show", false), + new ClaimNavigatorItem("Config.DocumentTemplate.Upload", false) + }), + new ClaimNavigatorItem("Config.Enrolment", "Enrolment", "Permissions related to Device Enrolment", false, new List() { + new ClaimNavigatorItem("Config.Enrolment.Configure", false), + new ClaimNavigatorItem("Config.Enrolment.DownloadBootstrapper", false), + new ClaimNavigatorItem("Config.Enrolment.Show", false), + new ClaimNavigatorItem("Config.Enrolment.ShowStatus", false) + }), + new ClaimNavigatorItem("Config.JobPreferences", "Job Preferences", "Permissions related to Job Preferences", false, new List() { + new ClaimNavigatorItem("Config.JobPreferences.Configure", false), + new ClaimNavigatorItem("Config.JobPreferences.Show", false) + }), + new ClaimNavigatorItem("Config.JobQueue", "Job Queues", "Permissions related to Job Queues", false, new List() { + new ClaimNavigatorItem("Config.JobQueue.Configure", false), + new ClaimNavigatorItem("Config.JobQueue.Create", false), + new ClaimNavigatorItem("Config.JobQueue.Delete", false), + new ClaimNavigatorItem("Config.JobQueue.Show", false) + }), + new ClaimNavigatorItem("Config.Logging", "Logging", "Permissions related to Logging", false, new List() { + new ClaimNavigatorItem("Config.Logging.Show", false) + }), + new ClaimNavigatorItem("Config.Organisation", "Organisation Details", "Permissions related to the Organisation Details", false, new List() { + new ClaimNavigatorItem("Config.Organisation.ConfigureAddresses", false), + new ClaimNavigatorItem("Config.Organisation.ConfigureLogo", false), + new ClaimNavigatorItem("Config.Organisation.ConfigureMultiSiteMode", false), + new ClaimNavigatorItem("Config.Organisation.ConfigureName", false), + new ClaimNavigatorItem("Config.Organisation.Show", false) + }), + new ClaimNavigatorItem("Config.Plugin", "Plugin", "Permissions related to Plugins", false, new List() { + new ClaimNavigatorItem("Config.Plugin.Configure", false), + new ClaimNavigatorItem("Config.Plugin.InstallLocal", false), + new ClaimNavigatorItem("Config.Plugin.Install", false), + new ClaimNavigatorItem("Config.Plugin.Show", false), + new ClaimNavigatorItem("Config.Plugin.Uninstall", false) + }), + new ClaimNavigatorItem("Config.System", "System", "Permissions related to System Configuration", false, new List() { + new ClaimNavigatorItem("Config.System.ConfigureActiveDirectory", false), + new ClaimNavigatorItem("Config.System.ConfigureEmail", false), + new ClaimNavigatorItem("Config.System.ConfigureProxy", false), + new ClaimNavigatorItem("Config.System.Show", false) + }), + new ClaimNavigatorItem("Config.UserFlag", "User Flags", "Permissions related to User Flags", false, new List() { + new ClaimNavigatorItem("Config.UserFlag.Configure", false), + new ClaimNavigatorItem("Config.UserFlag.Create", false), + new ClaimNavigatorItem("Config.UserFlag.Delete", false), + new ClaimNavigatorItem("Config.UserFlag.Export", false), + new ClaimNavigatorItem("Config.UserFlag.Show", false) + }), + new ClaimNavigatorItem("Config.ManageSavedExports", false), + new ClaimNavigatorItem("Config.Show", false) + }), + new ClaimNavigatorItem("Job", "Job", "Permissions related to Jobs", false, new List() { + new ClaimNavigatorItem("Job.Actions", "Actions", "Permissions related to Job Actions", false, new List() { + new ClaimNavigatorItem("Job.Actions.AddAttachments", false), + new ClaimNavigatorItem("Job.Actions.AddLogs", false), + new ClaimNavigatorItem("Job.Actions.AddAnyQueues", false), + new ClaimNavigatorItem("Job.Actions.AddOwnQueues", false), + new ClaimNavigatorItem("Job.Actions.Close", false), + new ClaimNavigatorItem("Job.Actions.ConvertHWarToHNWar", false), + new ClaimNavigatorItem("Job.Actions.Create", false), + new ClaimNavigatorItem("Job.Actions.Delete", false), + new ClaimNavigatorItem("Job.Actions.Export", false), + new ClaimNavigatorItem("Job.Actions.ForceClose", false), + new ClaimNavigatorItem("Job.Actions.GenerateDocuments", false), + new ClaimNavigatorItem("Job.Actions.LogInsurance", false), + new ClaimNavigatorItem("Job.Actions.LogRepair", false), + new ClaimNavigatorItem("Job.Actions.LogWarranty", false), + new ClaimNavigatorItem("Job.Actions.RemoveAnyAttachments", false), + new ClaimNavigatorItem("Job.Actions.RemoveAnyLogs", false), + new ClaimNavigatorItem("Job.Actions.RemoveAnyQueues", false), + new ClaimNavigatorItem("Job.Actions.RemoveOwnQueues", false), + new ClaimNavigatorItem("Job.Actions.RemoveOwnAttachments", false), + new ClaimNavigatorItem("Job.Actions.RemoveOwnLogs", false), + new ClaimNavigatorItem("Job.Actions.Reopen", false), + new ClaimNavigatorItem("Job.Actions.UpdateSubTypes", false) + }), + new ClaimNavigatorItem("Job.Properties", "Job Properties", "Permissions related to Job Properties", false, new List() { + new ClaimNavigatorItem("Job.Properties.JobQueueProperties", "Job Queue Properties", "Permissions related to Job Queue Job Properties", false, new List() { + new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditAnyComments", false), + new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditAnyPriority", false), + new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditAnySLA", false), + new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditOwnComments", false), + new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditOwnPriority", false), + new ClaimNavigatorItem("Job.Properties.JobQueueProperties.EditOwnSLA", false) + }), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties", "Non Warranty Properties", "Permissions related to Non-Warranty Job Properties", false, new List() { + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.AccountingChargeAdded", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.AccountingChargePaid", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.AccountingChargeRequired", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.AddComponents", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.EditComponents", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.InsuranceDetails", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.InvoiceReceived", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.IsInsuranceClaim", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.PurchaseOrderRaised", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.PurchaseOrderReference", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.PurchaseOrderSent", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairProviderDetails", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairerCompletedDate", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairerLoggedDate", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairerName", false), + new ClaimNavigatorItem("Job.Properties.NonWarrantyProperties.RepairerReference", false) + }), + new ClaimNavigatorItem("Job.Properties.WarrantyProperties", "Warranty Properties", "Permissions related to Warranty Job Properties", false, new List() { + new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ExternalCompletedDate", false), + new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ExternalLoggedDate", false), + new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ExternalName", false), + new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ExternalReference", false), + new ClaimNavigatorItem("Job.Properties.WarrantyProperties.ProviderDetails", false), + new ClaimNavigatorItem("Job.Properties.WarrantyProperties.WarrantyCompleted", false) + }), + new ClaimNavigatorItem("Job.Properties.DeviceHeldLocation", false), + new ClaimNavigatorItem("Job.Properties.DeviceHeld", false), + new ClaimNavigatorItem("Job.Properties.DeviceReadyForReturn", false), + new ClaimNavigatorItem("Job.Properties.DeviceReturned", false), + new ClaimNavigatorItem("Job.Properties.ExpectedClosedDate", false), + new ClaimNavigatorItem("Job.Properties.Flags", false), + new ClaimNavigatorItem("Job.Properties.NotWaitingForUserAction", false), + new ClaimNavigatorItem("Job.Properties.WaitingForUserAction", false) + }), + new ClaimNavigatorItem("Job.Lists", "Lists", "Permissions related to Job Lists", false, new List() { + new ClaimNavigatorItem("Job.Lists.AllOpen", false), + new ClaimNavigatorItem("Job.Lists.AwaitingFinanceAgreementBreach", false), + new ClaimNavigatorItem("Job.Lists.AwaitingFinanceCharge", false), + new ClaimNavigatorItem("Job.Lists.AwaitingFinanceInsuranceProcessing", false), + new ClaimNavigatorItem("Job.Lists.AwaitingFinance", false), + new ClaimNavigatorItem("Job.Lists.AwaitingFinancePayment", false), + new ClaimNavigatorItem("Job.Lists.AwaitingTechnicianAction", false), + new ClaimNavigatorItem("Job.Lists.AwaitingUserAction", false), + new ClaimNavigatorItem("Job.Lists.DevicesAwaitingRepair", false), + new ClaimNavigatorItem("Job.Lists.DevicesReadyForReturn", false), + new ClaimNavigatorItem("Job.Lists.JobQueueLists", false), + new ClaimNavigatorItem("Job.Lists.Locations", false), + new ClaimNavigatorItem("Job.Lists.LongRunningJobs", false), + new ClaimNavigatorItem("Job.Lists.MyJobs", false), + new ClaimNavigatorItem("Job.Lists.MyJobsOrphaned", false), + new ClaimNavigatorItem("Job.Lists.RecentlyClosed", false), + new ClaimNavigatorItem("Job.Lists.StaleJobs", false) + }), + new ClaimNavigatorItem("Job.Types", "Types", "Permissions related to Job Types", false, new List() { + new ClaimNavigatorItem("Job.Types.CreateHMisc", false), + new ClaimNavigatorItem("Job.Types.CreateHNWar", false), + new ClaimNavigatorItem("Job.Types.CreateHWar", false), + new ClaimNavigatorItem("Job.Types.CreateSApp", false), + new ClaimNavigatorItem("Job.Types.CreateSOS", false), + new ClaimNavigatorItem("Job.Types.CreateSImg", false), + new ClaimNavigatorItem("Job.Types.CreateUMgmt", false), + new ClaimNavigatorItem("Job.Types.ShowHMisc", false), + new ClaimNavigatorItem("Job.Types.ShowHNWar", false), + new ClaimNavigatorItem("Job.Types.ShowHWar", false), + new ClaimNavigatorItem("Job.Types.ShowSApp", false), + new ClaimNavigatorItem("Job.Types.ShowSOS", false), + new ClaimNavigatorItem("Job.Types.ShowSImg", false), + new ClaimNavigatorItem("Job.Types.ShowUMgmt", false) + }), + new ClaimNavigatorItem("Job.Search", false), + new ClaimNavigatorItem("Job.ShowAttachments", false), + new ClaimNavigatorItem("Job.ShowDailyChart", false), + new ClaimNavigatorItem("Job.ShowFlags", false), + new ClaimNavigatorItem("Job.Show", false), + new ClaimNavigatorItem("Job.ShowJobsQueues", false), + new ClaimNavigatorItem("Job.ShowLogs", false), + new ClaimNavigatorItem("Job.ShowNonWarrantyComponents", false), + new ClaimNavigatorItem("Job.ShowNonWarrantyFinance", false), + new ClaimNavigatorItem("Job.ShowNonWarrantyInsurance", false), + new ClaimNavigatorItem("Job.ShowNonWarrantyRepairs", false), + new ClaimNavigatorItem("Job.ShowWarranty", false) + }), + new ClaimNavigatorItem("Device", "Device", "Permissions related to Devices", false, new List() { + new ClaimNavigatorItem("Device.Actions", "Actions", "Permissions related to Device Actions", false, new List() { + new ClaimNavigatorItem("Device.Actions.AddAttachments", false), + new ClaimNavigatorItem("Device.Actions.AddComments", false), + new ClaimNavigatorItem("Device.Actions.AddFlags", false), + new ClaimNavigatorItem("Device.Actions.AllowUnauthenticatedEnrol", false), + new ClaimNavigatorItem("Device.Actions.AssignUser", false), + new ClaimNavigatorItem("Device.Actions.Decommission", false), + new ClaimNavigatorItem("Device.Actions.Delete", false), + new ClaimNavigatorItem("Device.Actions.EditFlags", false), + new ClaimNavigatorItem("Device.Actions.EnrolDevices", false), + new ClaimNavigatorItem("Device.Actions.Export", false), + new ClaimNavigatorItem("Device.Actions.GenerateDocuments", false), + new ClaimNavigatorItem("Device.Actions.Import", false), + new ClaimNavigatorItem("Device.Actions.Recommission", false), + new ClaimNavigatorItem("Device.Actions.RemoveAnyAttachments", false), + new ClaimNavigatorItem("Device.Actions.RemoveAnyComments", false), + new ClaimNavigatorItem("Device.Actions.RemoveFlags", false), + new ClaimNavigatorItem("Device.Actions.RemoveOwnAttachments", false), + new ClaimNavigatorItem("Device.Actions.RemoveOwnComments", false) + }), + new ClaimNavigatorItem("Device.Properties", "Device Properties", "Permissions related to Device Properties", false, new List() { + new ClaimNavigatorItem("Device.Properties.AssetNumber", false), + new ClaimNavigatorItem("Device.Properties.Details", false), + new ClaimNavigatorItem("Device.Properties.DeviceBatch", false), + new ClaimNavigatorItem("Device.Properties.DeviceProfile", false), + new ClaimNavigatorItem("Device.Properties.Location", false) + }), + new ClaimNavigatorItem("Device.Search", false), + new ClaimNavigatorItem("Device.ShowAssignmentHistory", false), + new ClaimNavigatorItem("Device.ShowAttachments", false), + new ClaimNavigatorItem("Device.ShowCertificates", false), + new ClaimNavigatorItem("Device.ShowComments", false), + new ClaimNavigatorItem("Device.ShowDetails", false), + new ClaimNavigatorItem("Device.ShowFlagAssignments", false), + new ClaimNavigatorItem("Device.Show", false), + new ClaimNavigatorItem("Device.ShowJobs", false) + }), + new ClaimNavigatorItem("User", "User", "Permissions related to Users", false, new List() { + new ClaimNavigatorItem("User.Actions", "Actions", "Permissions related to User Actions", false, new List() { + new ClaimNavigatorItem("User.Actions.AddAttachments", false), + new ClaimNavigatorItem("User.Actions.AddComments", false), + new ClaimNavigatorItem("User.Actions.AddFlags", false), + new ClaimNavigatorItem("User.Actions.EditFlags", false), + new ClaimNavigatorItem("User.Actions.GenerateDocuments", false), + new ClaimNavigatorItem("User.Actions.RemoveAnyAttachments", false), + new ClaimNavigatorItem("User.Actions.RemoveAnyComments", false), + new ClaimNavigatorItem("User.Actions.RemoveOwnAttachments", false), + new ClaimNavigatorItem("User.Actions.RemoveOwnComments", false), + new ClaimNavigatorItem("User.Actions.RemoveFlags", false) + }), + new ClaimNavigatorItem("User.Search", false), + new ClaimNavigatorItem("User.ShowAttachments", false), + new ClaimNavigatorItem("User.ShowComments", false), + new ClaimNavigatorItem("User.ShowAssignmentHistory", false), + new ClaimNavigatorItem("User.ShowAssignments", false), + new ClaimNavigatorItem("User.Show", false), + new ClaimNavigatorItem("User.ShowAuthorization", false), + new ClaimNavigatorItem("User.ShowDetails", false), + new ClaimNavigatorItem("User.ShowFlagAssignments", false), + new ClaimNavigatorItem("User.ShowJobs", false) + }), + new ClaimNavigatorItem("ComputerAccount", true), + new ClaimNavigatorItem("DiscoAdminAccount", true) + }); #endregion } - public static ClaimNavigatorItem RoleClaimNavigator - { - get { return _claimNavigator; } - } + public static ClaimNavigatorItem RoleClaimNavigator + { + get { return _claimNavigator; } + } - internal static Tuple, Action, string, string, bool> GetClaimDefinition(string ClaimKey) { - Tuple, Action, string, string, bool> claimDef; + internal static Tuple, Action, string, string, bool> GetClaimDefinition(string ClaimKey) { + if (_roleClaims.TryGetValue(ClaimKey, out var claimDef)) + return claimDef; + throw new ArgumentException("Unknown Claim Key", nameof(ClaimKey)); + } - if (!_roleClaims.TryGetValue(ClaimKey, out claimDef)) - throw new ArgumentException("Unknown Claim Key", "ClaimKey"); + public static Func GetClaimAccessor(string ClaimKey) { + if (_roleClaims.TryGetValue(ClaimKey, out var claimDef)) + return claimDef.Item1; + throw new ArgumentException("Unknown Claim Key", nameof(ClaimKey)); + } - return new Tuple, Action, string, string, bool>(claimDef.Item1, claimDef.Item2, claimDef.Item3, claimDef.Item4, claimDef.Item5); - } + public static Action GetClaimSetter(string ClaimKey) { + if (_roleClaims.TryGetValue(ClaimKey, out var claimDef)) + return claimDef.Item2; + throw new ArgumentException("Unknown Claim Key", nameof(ClaimKey)); + } - public static Func GetClaimAccessor(string ClaimKey) { - Tuple, Action, string, string, bool> claimDef; + public static Tuple GetClaimDetails(string ClaimKey) { + if (_roleClaims.TryGetValue(ClaimKey, out var claimDef)) + return Tuple.Create(claimDef.Item3, claimDef.Item4, claimDef.Item5); + throw new ArgumentException("Unknown Claim Key", "ClaimKey"); + } - if (!_roleClaims.TryGetValue(ClaimKey, out claimDef)) - throw new ArgumentException("Unknown Claim Key", "ClaimKey"); + public static RoleClaims BuildClaims(IEnumerable ClaimKeys){ + var c = new RoleClaims(); + foreach (var claimKey in ClaimKeys) + c.Set(claimKey, true); - return claimDef.Item1; - } + return c; + } - public static Action GetClaimSetter(string ClaimKey) { - Tuple, Action, string, string, bool> claimDef; - - if (!_roleClaims.TryGetValue(ClaimKey, out claimDef)) - throw new ArgumentException("Unknown Claim Key", "ClaimKey"); - - return claimDef.Item2; - } - - public static Tuple GetClaimDetails(string ClaimKey) { - Tuple, Action, string, string, bool> claimDef; - - if (!_roleClaims.TryGetValue(ClaimKey, out claimDef)) - throw new ArgumentException("Unknown Claim Key", "ClaimKey"); - - return new Tuple(claimDef.Item3, claimDef.Item4, claimDef.Item5); - } - - public static RoleClaims BuildClaims(IEnumerable ClaimKeys){ - var c = new RoleClaims(); - foreach (var claimKey in ClaimKeys) - c.Set(claimKey, true); - - return c; - } - - public static List GetClaimKeys(RoleClaims Claims) + public static List GetClaimKeys(RoleClaims Claims) { var claims = Claims; return _roleClaims.Where(rc => rc.Value.Item1(claims)).Select(rc => rc.Key).ToList(); } - public static RoleClaims AdministratorClaims() { - var c = new RoleClaims(); + public static RoleClaims AdministratorClaims() { + var c = new RoleClaims(); #region Set All Administrator Claims - c.Config.DeviceCertificate.DownloadCertificates = true; - c.Config.Enrolment.Configure = true; - c.Config.Enrolment.DownloadBootstrapper = true; - c.Config.Enrolment.Show = true; - c.Config.Enrolment.ShowStatus = true; - c.Config.DeviceBatch.Configure = true; - c.Config.DeviceBatch.Create = true; - c.Config.DeviceBatch.Delete = true; - c.Config.DeviceBatch.Show = 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.Configure = true; - c.Config.DeviceModel.CreateCustom = true; - c.Config.DeviceModel.Delete = true; - c.Config.DeviceModel.Show = true; - c.Config.DeviceProfile.ConfigureComputerNameTemplate = true; - c.Config.DeviceProfile.ConfigureDefaults = true; - c.Config.DeviceProfile.Configure = true; - c.Config.DeviceProfile.Create = true; - c.Config.DeviceProfile.Delete = true; - c.Config.DeviceProfile.Show = true; - c.Config.DocumentTemplate.BulkGenerate = true; - c.Config.DocumentTemplate.ConfigureFilterExpression = true; - c.Config.DocumentTemplate.Configure = true; - c.Config.DocumentTemplate.Create = true; - c.Config.DocumentTemplate.Delete = true; - c.Config.DocumentTemplate.Export = true; - c.Config.DocumentTemplate.UndetectedPages = true; - c.Config.DocumentTemplate.ShowStatus = true; - c.Config.DocumentTemplate.Show = true; - c.Config.DocumentTemplate.Upload = true; - c.Config.Logging.Show = true; - c.Config.Plugin.Configure = true; - c.Config.Plugin.InstallLocal = true; - c.Config.Plugin.Install = true; - c.Config.Plugin.Show = true; - c.Config.Plugin.Uninstall = true; - c.Config.System.ConfigureActiveDirectory = true; - c.Config.System.ConfigureEmail = true; - c.Config.System.ConfigureProxy = true; - c.Config.System.Show = true; - c.Config.Organisation.ConfigureAddresses = true; - c.Config.Organisation.ConfigureLogo = true; - c.Config.Organisation.ConfigureMultiSiteMode = true; - c.Config.Organisation.ConfigureName = true; - c.Config.Organisation.Show = true; - c.Config.JobPreferences.Configure = true; - c.Config.JobPreferences.Show = true; - c.Config.JobQueue.Configure = true; - c.Config.JobQueue.Create = true; - c.Config.JobQueue.Delete = true; - c.Config.JobQueue.Show = true; - c.Config.UserFlag.Configure = true; - c.Config.UserFlag.Create = true; - c.Config.UserFlag.Delete = true; - c.Config.UserFlag.Export = true; - c.Config.UserFlag.Show = true; - c.Config.ManageSavedExports = true; - c.Config.Show = true; - c.Job.Lists.AllOpen = true; - c.Job.Lists.AwaitingFinanceAgreementBreach = true; - c.Job.Lists.AwaitingFinanceCharge = true; - c.Job.Lists.AwaitingFinanceInsuranceProcessing = true; - c.Job.Lists.AwaitingFinance = true; - c.Job.Lists.AwaitingFinancePayment = true; - c.Job.Lists.AwaitingTechnicianAction = true; - c.Job.Lists.AwaitingUserAction = true; - c.Job.Lists.DevicesAwaitingRepair = true; - c.Job.Lists.DevicesReadyForReturn = true; - c.Job.Lists.JobQueueLists = true; - c.Job.Lists.Locations = true; - c.Job.Lists.LongRunningJobs = true; - c.Job.Lists.MyJobs = true; - c.Job.Lists.MyJobsOrphaned = true; - c.Job.Lists.RecentlyClosed = true; - c.Job.Lists.StaleJobs = true; - c.Job.Actions.AddAttachments = true; - c.Job.Actions.AddLogs = true; - c.Job.Actions.AddAnyQueues = true; - c.Job.Actions.AddOwnQueues = true; - c.Job.Actions.Close = true; - c.Job.Actions.ConvertHWarToHNWar = true; - c.Job.Actions.Create = true; - c.Job.Actions.Delete = true; - c.Job.Actions.Export = true; - c.Job.Actions.ForceClose = true; - c.Job.Actions.GenerateDocuments = true; - c.Job.Actions.LogInsurance = true; - c.Job.Actions.LogRepair = true; - c.Job.Actions.LogWarranty = true; - c.Job.Actions.RemoveAnyAttachments = true; - c.Job.Actions.RemoveAnyLogs = true; - c.Job.Actions.RemoveAnyQueues = true; - c.Job.Actions.RemoveOwnQueues = true; - c.Job.Actions.RemoveOwnAttachments = true; - c.Job.Actions.RemoveOwnLogs = true; - c.Job.Actions.Reopen = true; - c.Job.Actions.UpdateSubTypes = true; - c.Job.Properties.WarrantyProperties.ExternalCompletedDate = true; - c.Job.Properties.WarrantyProperties.ExternalLoggedDate = true; - c.Job.Properties.WarrantyProperties.ExternalName = true; - c.Job.Properties.WarrantyProperties.ExternalReference = true; - c.Job.Properties.WarrantyProperties.ProviderDetails = true; - c.Job.Properties.WarrantyProperties.WarrantyCompleted = true; - c.Job.Properties.NonWarrantyProperties.AccountingChargeAdded = true; - c.Job.Properties.NonWarrantyProperties.AccountingChargePaid = true; - c.Job.Properties.NonWarrantyProperties.AccountingChargeRequired = true; - c.Job.Properties.NonWarrantyProperties.AddComponents = true; - c.Job.Properties.NonWarrantyProperties.EditComponents = true; - c.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent = true; - c.Job.Properties.NonWarrantyProperties.InsuranceDetails = true; - c.Job.Properties.NonWarrantyProperties.InvoiceReceived = true; - c.Job.Properties.NonWarrantyProperties.IsInsuranceClaim = true; - c.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised = true; - c.Job.Properties.NonWarrantyProperties.PurchaseOrderReference = true; - c.Job.Properties.NonWarrantyProperties.PurchaseOrderSent = true; - c.Job.Properties.NonWarrantyProperties.RepairProviderDetails = true; - c.Job.Properties.NonWarrantyProperties.RepairerCompletedDate = true; - c.Job.Properties.NonWarrantyProperties.RepairerLoggedDate = true; - c.Job.Properties.NonWarrantyProperties.RepairerName = true; - c.Job.Properties.NonWarrantyProperties.RepairerReference = true; - c.Job.Properties.JobQueueProperties.EditAnyComments = true; - c.Job.Properties.JobQueueProperties.EditAnyPriority = true; - c.Job.Properties.JobQueueProperties.EditAnySLA = true; - c.Job.Properties.JobQueueProperties.EditOwnComments = true; - c.Job.Properties.JobQueueProperties.EditOwnPriority = true; - c.Job.Properties.JobQueueProperties.EditOwnSLA = true; - c.Job.Properties.DeviceHeldLocation = true; - c.Job.Properties.DeviceHeld = true; - c.Job.Properties.DeviceReadyForReturn = true; - c.Job.Properties.DeviceReturned = true; - c.Job.Properties.ExpectedClosedDate = true; - c.Job.Properties.Flags = true; - c.Job.Properties.NotWaitingForUserAction = true; - c.Job.Properties.WaitingForUserAction = true; - c.Job.Types.CreateHMisc = true; - c.Job.Types.CreateHNWar = true; - c.Job.Types.CreateHWar = true; - c.Job.Types.CreateSApp = true; - c.Job.Types.CreateSOS = true; - c.Job.Types.CreateSImg = true; - c.Job.Types.CreateUMgmt = true; - c.Job.Types.ShowHMisc = true; - c.Job.Types.ShowHNWar = true; - c.Job.Types.ShowHWar = true; - c.Job.Types.ShowSApp = true; - c.Job.Types.ShowSOS = true; - c.Job.Types.ShowSImg = true; - c.Job.Types.ShowUMgmt = true; - c.Job.Search = true; - c.Job.ShowAttachments = true; - c.Job.ShowDailyChart = true; - c.Job.ShowFlags = true; - c.Job.Show = true; - c.Job.ShowJobsQueues = true; - c.Job.ShowLogs = true; - c.Job.ShowNonWarrantyComponents = true; - c.Job.ShowNonWarrantyFinance = true; - c.Job.ShowNonWarrantyInsurance = true; - c.Job.ShowNonWarrantyRepairs = true; - c.Job.ShowWarranty = true; - c.Device.Properties.AssetNumber = true; - c.Device.Properties.Details = true; - c.Device.Properties.DeviceBatch = true; - c.Device.Properties.DeviceProfile = true; - c.Device.Properties.Location = true; - c.Device.Actions.AddAttachments = true; - c.Device.Actions.AddComments = true; - c.Device.Actions.AddFlags = true; - c.Device.Actions.AllowUnauthenticatedEnrol = true; - c.Device.Actions.AssignUser = true; - c.Device.Actions.Decommission = true; - c.Device.Actions.Delete = true; - c.Device.Actions.EditFlags = true; - c.Device.Actions.EnrolDevices = true; - c.Device.Actions.Export = true; - c.Device.Actions.GenerateDocuments = true; - c.Device.Actions.Import = true; - c.Device.Actions.Recommission = true; - c.Device.Actions.RemoveAnyAttachments = true; - c.Device.Actions.RemoveAnyComments = true; - c.Device.Actions.RemoveFlags = true; - c.Device.Actions.RemoveOwnAttachments = true; - c.Device.Actions.RemoveOwnComments = true; - c.Device.Search = true; - c.Device.ShowAssignmentHistory = true; - c.Device.ShowAttachments = true; - c.Device.ShowCertificates = true; - c.Device.ShowComments = true; - c.Device.ShowDetails = true; - c.Device.ShowFlagAssignments = true; - c.Device.Show = true; - c.Device.ShowJobs = true; - c.User.Actions.AddAttachments = true; - c.User.Actions.AddComments = true; - c.User.Actions.AddFlags = true; - c.User.Actions.EditFlags = true; - c.User.Actions.GenerateDocuments = true; - c.User.Actions.RemoveAnyAttachments = true; - c.User.Actions.RemoveAnyComments = true; - c.User.Actions.RemoveOwnAttachments = true; - c.User.Actions.RemoveOwnComments = true; - c.User.Actions.RemoveFlags = true; - c.User.Search = true; - c.User.ShowAttachments = true; - c.User.ShowComments = true; - c.User.ShowAssignmentHistory = true; - c.User.ShowAssignments = true; - c.User.Show = true; - c.User.ShowAuthorization = true; - c.User.ShowDetails = true; - c.User.ShowFlagAssignments = true; - c.User.ShowJobs = true; - c.DiscoAdminAccount = true; + c.Config.DeviceCertificate.DownloadCertificates = true; + c.Config.Enrolment.Configure = true; + c.Config.Enrolment.DownloadBootstrapper = true; + c.Config.Enrolment.Show = true; + c.Config.Enrolment.ShowStatus = true; + c.Config.DeviceBatch.Configure = true; + c.Config.DeviceBatch.Create = true; + c.Config.DeviceBatch.Delete = true; + c.Config.DeviceBatch.Show = 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.Configure = true; + c.Config.DeviceModel.CreateCustom = true; + c.Config.DeviceModel.Delete = true; + c.Config.DeviceModel.Show = true; + c.Config.DeviceProfile.ConfigureComputerNameTemplate = true; + c.Config.DeviceProfile.ConfigureDefaults = true; + c.Config.DeviceProfile.Configure = true; + c.Config.DeviceProfile.Create = true; + c.Config.DeviceProfile.Delete = true; + c.Config.DeviceProfile.Show = true; + c.Config.DocumentTemplate.BulkGenerate = true; + c.Config.DocumentTemplate.ConfigureFilterExpression = true; + c.Config.DocumentTemplate.Configure = true; + c.Config.DocumentTemplate.Create = true; + c.Config.DocumentTemplate.Delete = true; + c.Config.DocumentTemplate.Export = true; + c.Config.DocumentTemplate.UndetectedPages = true; + c.Config.DocumentTemplate.ShowStatus = true; + c.Config.DocumentTemplate.Show = true; + c.Config.DocumentTemplate.Upload = true; + c.Config.Logging.Show = true; + c.Config.Plugin.Configure = true; + c.Config.Plugin.InstallLocal = true; + c.Config.Plugin.Install = true; + c.Config.Plugin.Show = true; + c.Config.Plugin.Uninstall = true; + c.Config.System.ConfigureActiveDirectory = true; + c.Config.System.ConfigureEmail = true; + c.Config.System.ConfigureProxy = true; + c.Config.System.Show = true; + c.Config.Organisation.ConfigureAddresses = true; + c.Config.Organisation.ConfigureLogo = true; + c.Config.Organisation.ConfigureMultiSiteMode = true; + c.Config.Organisation.ConfigureName = true; + c.Config.Organisation.Show = true; + c.Config.JobPreferences.Configure = true; + c.Config.JobPreferences.Show = true; + c.Config.JobQueue.Configure = true; + c.Config.JobQueue.Create = true; + c.Config.JobQueue.Delete = true; + c.Config.JobQueue.Show = true; + c.Config.UserFlag.Configure = true; + c.Config.UserFlag.Create = true; + c.Config.UserFlag.Delete = true; + c.Config.UserFlag.Export = true; + c.Config.UserFlag.Show = true; + c.Config.ManageSavedExports = true; + c.Config.Show = true; + c.Job.Lists.AllOpen = true; + c.Job.Lists.AwaitingFinanceAgreementBreach = true; + c.Job.Lists.AwaitingFinanceCharge = true; + c.Job.Lists.AwaitingFinanceInsuranceProcessing = true; + c.Job.Lists.AwaitingFinance = true; + c.Job.Lists.AwaitingFinancePayment = true; + c.Job.Lists.AwaitingTechnicianAction = true; + c.Job.Lists.AwaitingUserAction = true; + c.Job.Lists.DevicesAwaitingRepair = true; + c.Job.Lists.DevicesReadyForReturn = true; + c.Job.Lists.JobQueueLists = true; + c.Job.Lists.Locations = true; + c.Job.Lists.LongRunningJobs = true; + c.Job.Lists.MyJobs = true; + c.Job.Lists.MyJobsOrphaned = true; + c.Job.Lists.RecentlyClosed = true; + c.Job.Lists.StaleJobs = true; + c.Job.Actions.AddAttachments = true; + c.Job.Actions.AddLogs = true; + c.Job.Actions.AddAnyQueues = true; + c.Job.Actions.AddOwnQueues = true; + c.Job.Actions.Close = true; + c.Job.Actions.ConvertHWarToHNWar = true; + c.Job.Actions.Create = true; + c.Job.Actions.Delete = true; + c.Job.Actions.Export = true; + c.Job.Actions.ForceClose = true; + c.Job.Actions.GenerateDocuments = true; + c.Job.Actions.LogInsurance = true; + c.Job.Actions.LogRepair = true; + c.Job.Actions.LogWarranty = true; + c.Job.Actions.RemoveAnyAttachments = true; + c.Job.Actions.RemoveAnyLogs = true; + c.Job.Actions.RemoveAnyQueues = true; + c.Job.Actions.RemoveOwnQueues = true; + c.Job.Actions.RemoveOwnAttachments = true; + c.Job.Actions.RemoveOwnLogs = true; + c.Job.Actions.Reopen = true; + c.Job.Actions.UpdateSubTypes = true; + c.Job.Properties.WarrantyProperties.ExternalCompletedDate = true; + c.Job.Properties.WarrantyProperties.ExternalLoggedDate = true; + c.Job.Properties.WarrantyProperties.ExternalName = true; + c.Job.Properties.WarrantyProperties.ExternalReference = true; + c.Job.Properties.WarrantyProperties.ProviderDetails = true; + c.Job.Properties.WarrantyProperties.WarrantyCompleted = true; + c.Job.Properties.NonWarrantyProperties.AccountingChargeAdded = true; + c.Job.Properties.NonWarrantyProperties.AccountingChargePaid = true; + c.Job.Properties.NonWarrantyProperties.AccountingChargeRequired = true; + c.Job.Properties.NonWarrantyProperties.AddComponents = true; + c.Job.Properties.NonWarrantyProperties.EditComponents = true; + c.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent = true; + c.Job.Properties.NonWarrantyProperties.InsuranceDetails = true; + c.Job.Properties.NonWarrantyProperties.InvoiceReceived = true; + c.Job.Properties.NonWarrantyProperties.IsInsuranceClaim = true; + c.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised = true; + c.Job.Properties.NonWarrantyProperties.PurchaseOrderReference = true; + c.Job.Properties.NonWarrantyProperties.PurchaseOrderSent = true; + c.Job.Properties.NonWarrantyProperties.RepairProviderDetails = true; + c.Job.Properties.NonWarrantyProperties.RepairerCompletedDate = true; + c.Job.Properties.NonWarrantyProperties.RepairerLoggedDate = true; + c.Job.Properties.NonWarrantyProperties.RepairerName = true; + c.Job.Properties.NonWarrantyProperties.RepairerReference = true; + c.Job.Properties.JobQueueProperties.EditAnyComments = true; + c.Job.Properties.JobQueueProperties.EditAnyPriority = true; + c.Job.Properties.JobQueueProperties.EditAnySLA = true; + c.Job.Properties.JobQueueProperties.EditOwnComments = true; + c.Job.Properties.JobQueueProperties.EditOwnPriority = true; + c.Job.Properties.JobQueueProperties.EditOwnSLA = true; + c.Job.Properties.DeviceHeldLocation = true; + c.Job.Properties.DeviceHeld = true; + c.Job.Properties.DeviceReadyForReturn = true; + c.Job.Properties.DeviceReturned = true; + c.Job.Properties.ExpectedClosedDate = true; + c.Job.Properties.Flags = true; + c.Job.Properties.NotWaitingForUserAction = true; + c.Job.Properties.WaitingForUserAction = true; + c.Job.Types.CreateHMisc = true; + c.Job.Types.CreateHNWar = true; + c.Job.Types.CreateHWar = true; + c.Job.Types.CreateSApp = true; + c.Job.Types.CreateSOS = true; + c.Job.Types.CreateSImg = true; + c.Job.Types.CreateUMgmt = true; + c.Job.Types.ShowHMisc = true; + c.Job.Types.ShowHNWar = true; + c.Job.Types.ShowHWar = true; + c.Job.Types.ShowSApp = true; + c.Job.Types.ShowSOS = true; + c.Job.Types.ShowSImg = true; + c.Job.Types.ShowUMgmt = true; + c.Job.Search = true; + c.Job.ShowAttachments = true; + c.Job.ShowDailyChart = true; + c.Job.ShowFlags = true; + c.Job.Show = true; + c.Job.ShowJobsQueues = true; + c.Job.ShowLogs = true; + c.Job.ShowNonWarrantyComponents = true; + c.Job.ShowNonWarrantyFinance = true; + c.Job.ShowNonWarrantyInsurance = true; + c.Job.ShowNonWarrantyRepairs = true; + c.Job.ShowWarranty = true; + c.Device.Properties.AssetNumber = true; + c.Device.Properties.Details = true; + c.Device.Properties.DeviceBatch = true; + c.Device.Properties.DeviceProfile = true; + c.Device.Properties.Location = true; + c.Device.Actions.AddAttachments = true; + c.Device.Actions.AddComments = true; + c.Device.Actions.AddFlags = true; + c.Device.Actions.AllowUnauthenticatedEnrol = true; + c.Device.Actions.AssignUser = true; + c.Device.Actions.Decommission = true; + c.Device.Actions.Delete = true; + c.Device.Actions.EditFlags = true; + c.Device.Actions.EnrolDevices = true; + c.Device.Actions.Export = true; + c.Device.Actions.GenerateDocuments = true; + c.Device.Actions.Import = true; + c.Device.Actions.Recommission = true; + c.Device.Actions.RemoveAnyAttachments = true; + c.Device.Actions.RemoveAnyComments = true; + c.Device.Actions.RemoveFlags = true; + c.Device.Actions.RemoveOwnAttachments = true; + c.Device.Actions.RemoveOwnComments = true; + c.Device.Search = true; + c.Device.ShowAssignmentHistory = true; + c.Device.ShowAttachments = true; + c.Device.ShowCertificates = true; + c.Device.ShowComments = true; + c.Device.ShowDetails = true; + c.Device.ShowFlagAssignments = true; + c.Device.Show = true; + c.Device.ShowJobs = true; + c.User.Actions.AddAttachments = true; + c.User.Actions.AddComments = true; + c.User.Actions.AddFlags = true; + c.User.Actions.EditFlags = true; + c.User.Actions.GenerateDocuments = true; + c.User.Actions.RemoveAnyAttachments = true; + c.User.Actions.RemoveAnyComments = true; + c.User.Actions.RemoveOwnAttachments = true; + c.User.Actions.RemoveOwnComments = true; + c.User.Actions.RemoveFlags = true; + c.User.Search = true; + c.User.ShowAttachments = true; + c.User.ShowComments = true; + c.User.ShowAssignmentHistory = true; + c.User.ShowAssignments = true; + c.User.Show = true; + c.User.ShowAuthorization = true; + c.User.ShowDetails = true; + c.User.ShowFlagAssignments = true; + c.User.ShowJobs = true; + c.DiscoAdminAccount = true; #endregion - return c; - } + return c; + } - public static RoleClaims ComputerAccountClaims() { - return new RoleClaims() { - ComputerAccount = true - }; - } + public static RoleClaims ComputerAccountClaims() { + return new RoleClaims() { + ComputerAccount = true + }; + } #region Role Claim Constants @@ -2112,9 +2100,9 @@ namespace Disco.Services.Authorization /// public const string DiscoAdminAccount = "DiscoAdminAccount"; #endregion - } - public static class ClaimExtensions - { + } + public static class ClaimExtensions + { public static bool Has(this RoleClaims c, string ClaimKey) { Func claimFunc = Claims.GetClaimAccessor(ClaimKey); @@ -2122,17 +2110,17 @@ namespace Disco.Services.Authorization return claimFunc(c); } - public static void Set(this RoleClaims c, string ClaimKey, bool Value) + public static void Set(this RoleClaims c, string ClaimKey, bool Value) { var claimDefinition = Claims.GetClaimDefinition(ClaimKey); - if (!claimDefinition.Item5) - claimDefinition.Item2(c, Value); + if (!claimDefinition.Item5) + claimDefinition.Item2(c, Value); } - public static void SetClaims(this AuthorizationRole role, RoleClaims Claims) + public static void SetClaims(this AuthorizationRole role, RoleClaims Claims) { role.ClaimsJson = Newtonsoft.Json.JsonConvert.SerializeObject(Claims); } - } + } } diff --git a/Disco.Services/Authorization/Claims.tt b/Disco.Services/Authorization/Claims.tt index 3109ce29..f6c0d450 100644 --- a/Disco.Services/Authorization/Claims.tt +++ b/Disco.Services/Authorization/Claims.tt @@ -23,7 +23,7 @@ <# // Get the DTE service from the host EnvDTE.DTE Dte = null; - var serviceProvider = Host as IServiceProvider; + var serviceProvider = Host as IServiceProvider; if (serviceProvider != null) Dte = (EnvDTE.DTE)serviceProvider.GetService(typeof(EnvDTE.DTE)); @@ -31,21 +31,21 @@ if (Dte == null) throw new Exception("T4MVC can only execute through the Visual Studio host"); - List permissions = new List(); - List groups = new List(); + List permissions = new List(); + List groups = new List(); - var piRolePermission = Dte.Solution.FindProjectItem(Host.ResolvePath(@"Roles\RoleClaims.cs")); - var piGroups = FindClaimGroupProjectItems(piRolePermission.ContainingProject.ProjectItems.Item("Authorization").ProjectItems.Item("Roles").ProjectItems.Item("ClaimGroups")).ToList(); + var piRolePermission = Dte.Solution.FindProjectItem(Host.ResolvePath(@"Roles\RoleClaims.cs")); + var piGroups = FindClaimGroupProjectItems(piRolePermission.ContainingProject.ProjectItems.Item("Authorization").ProjectItems.Item("Roles").ProjectItems.Item("ClaimGroups")).ToList(); - ParseProjectItem(piRolePermission, groups, permissions); + ParseProjectItem(piRolePermission, groups, permissions); foreach (ProjectItem piItem in piGroups) - ParseProjectItem(piItem, groups, permissions); + ParseProjectItem(piItem, groups, permissions); - var permissionRoot = BuildHierarchy(groups, permissions); + var permissionRoot = BuildHierarchy(groups, permissions); - + - #> + #> // // This file was generated by a T4 template. // Don't change it directly as your change would get overwritten. Instead, make changes @@ -59,101 +59,89 @@ using System.Linq; namespace Disco.Services.Authorization { - public static class Claims - { - private static Dictionary, Action, string, string, bool>> _roleClaims; - private static ClaimNavigatorItem _claimNavigator; + public static class Claims + { + private static Dictionary, Action, string, string, bool>> _roleClaims; + private static ClaimNavigatorItem _claimNavigator; - static Claims() + static Claims() { #region Role Claim Dictionary _roleClaims = new Dictionary, Action, string, string, bool>>() - { + { <#WriteAccessHashes(permissionRoot);#> - }; + }; #endregion #region Role Claim Navigator - _claimNavigator = + _claimNavigator = <#WriteNavigator(permissionRoot);#>; #endregion } - public static ClaimNavigatorItem RoleClaimNavigator - { - get { return _claimNavigator; } - } + public static ClaimNavigatorItem RoleClaimNavigator + { + get { return _claimNavigator; } + } - internal static Tuple, Action, string, string, bool> GetClaimDefinition(string ClaimKey) { - Tuple, Action, string, string, bool> claimDef; + internal static Tuple, Action, string, string, bool> GetClaimDefinition(string ClaimKey) { + if (_roleClaims.TryGetValue(ClaimKey, out var claimDef)) + return claimDef; + throw new ArgumentException("Unknown Claim Key", nameof(ClaimKey)); + } - if (!_roleClaims.TryGetValue(ClaimKey, out claimDef)) - throw new ArgumentException("Unknown Claim Key", "ClaimKey"); + public static Func GetClaimAccessor(string ClaimKey) { + if (_roleClaims.TryGetValue(ClaimKey, out var claimDef)) + return claimDef.Item1; + throw new ArgumentException("Unknown Claim Key", nameof(ClaimKey)); + } - return new Tuple, Action, string, string, bool>(claimDef.Item1, claimDef.Item2, claimDef.Item3, claimDef.Item4, claimDef.Item5); - } + public static Action GetClaimSetter(string ClaimKey) { + if (_roleClaims.TryGetValue(ClaimKey, out var claimDef)) + return claimDef.Item2; + throw new ArgumentException("Unknown Claim Key", nameof(ClaimKey)); + } - public static Func GetClaimAccessor(string ClaimKey) { - Tuple, Action, string, string, bool> claimDef; + public static Tuple GetClaimDetails(string ClaimKey) { + if (_roleClaims.TryGetValue(ClaimKey, out var claimDef)) + return Tuple.Create(claimDef.Item3, claimDef.Item4, claimDef.Item5); + throw new ArgumentException("Unknown Claim Key", "ClaimKey"); + } - if (!_roleClaims.TryGetValue(ClaimKey, out claimDef)) - throw new ArgumentException("Unknown Claim Key", "ClaimKey"); + public static RoleClaims BuildClaims(IEnumerable ClaimKeys){ + var c = new RoleClaims(); + foreach (var claimKey in ClaimKeys) + c.Set(claimKey, true); - return claimDef.Item1; - } + return c; + } - public static Action GetClaimSetter(string ClaimKey) { - Tuple, Action, string, string, bool> claimDef; - - if (!_roleClaims.TryGetValue(ClaimKey, out claimDef)) - throw new ArgumentException("Unknown Claim Key", "ClaimKey"); - - return claimDef.Item2; - } - - public static Tuple GetClaimDetails(string ClaimKey) { - Tuple, Action, string, string, bool> claimDef; - - if (!_roleClaims.TryGetValue(ClaimKey, out claimDef)) - throw new ArgumentException("Unknown Claim Key", "ClaimKey"); - - return new Tuple(claimDef.Item3, claimDef.Item4, claimDef.Item5); - } - - public static RoleClaims BuildClaims(IEnumerable ClaimKeys){ - var c = new RoleClaims(); - foreach (var claimKey in ClaimKeys) - c.Set(claimKey, true); - - return c; - } - - public static List GetClaimKeys(RoleClaims Claims) + public static List GetClaimKeys(RoleClaims Claims) { var claims = Claims; return _roleClaims.Where(rc => rc.Value.Item1(claims)).Select(rc => rc.Key).ToList(); } - public static RoleClaims AdministratorClaims() { - var c = new RoleClaims(); + public static RoleClaims AdministratorClaims() { + var c = new RoleClaims(); #region Set All Administrator Claims <#WriteAdministratorClaims(permissionRoot);#> #endregion - return c; - } + return c; + } - public static RoleClaims ComputerAccountClaims() { - return new RoleClaims() { - ComputerAccount = true - }; - } + public static RoleClaims ComputerAccountClaims() { + return new RoleClaims() { + ComputerAccount = true + }; + } #region Role Claim Constants <#WritePermissionConsts(permissionRoot);#> #endregion - } - public static class ClaimExtensions - { + } + public static class ClaimExtensions + { public static bool Has(this RoleClaims c, string ClaimKey) { Func claimFunc = Claims.GetClaimAccessor(ClaimKey); @@ -161,198 +149,198 @@ namespace Disco.Services.Authorization return claimFunc(c); } - public static void Set(this RoleClaims c, string ClaimKey, bool Value) + public static void Set(this RoleClaims c, string ClaimKey, bool Value) { var claimDefinition = Claims.GetClaimDefinition(ClaimKey); - if (!claimDefinition.Item5) - claimDefinition.Item2(c, Value); + if (!claimDefinition.Item5) + claimDefinition.Item2(c, Value); } - public static void SetClaims(this AuthorizationRole role, RoleClaims Claims) + public static void SetClaims(this AuthorizationRole role, RoleClaims Claims) { role.ClaimsJson = Newtonsoft.Json.JsonConvert.SerializeObject(Claims); } - } + } } <#+ void DumpPermission(Permission p){ - PushIndent(" "); - WriteLine(p.Name); - foreach (Permission pChild in p.Children) - { - DumpPermission(pChild); - } - PopIndent(); + PushIndent(" "); + WriteLine(p.Name); + foreach (Permission pChild in p.Children) + { + DumpPermission(pChild); + } + PopIndent(); } void WriteNavigator(Permission root){ - PushIndent(" "); - WriteLine("new ClaimNavigatorItem(\"Claims\", \"Permissions\", \"Top-level node for all permissions\", false, new List() {"); - PushIndent(" "); - for (int childIndex = 0; childIndex < root.Children.Count; childIndex++) + PushIndent(" "); + WriteLine("new ClaimNavigatorItem(\"Claims\", \"Permissions\", \"Top-level node for all permissions\", false, new List() {"); + PushIndent(" "); + for (int childIndex = 0; childIndex < root.Children.Count; childIndex++) { - WriteNavigator_Recurse(root.Children[childIndex], string.Empty); - if (childIndex < root.Children.Count -1) - WriteLine(","); + WriteNavigator_Recurse(root.Children[childIndex], string.Empty); + if (childIndex < root.Children.Count -1) + WriteLine(","); } - WriteLine(string.Empty); - PopIndent(); - Write("})"); - PopIndent(); + WriteLine(string.Empty); + PopIndent(); + Write("})"); + PopIndent(); } void WriteNavigator_Recurse(Permission p, string Prefix){ - var key = string.Concat(Prefix, p.Name); + var key = string.Concat(Prefix, p.Name); - if (p.IsGroup){ - var groupPrefix = string.Concat(key, "."); - WriteLine("new ClaimNavigatorItem(\"{0}{1}\", \"{2}\", \"{3}\", {4}, new List() {{", Prefix, p.Name, p.FriendlyName, p.Description, p.Hidden ? "true" : "false"); - PushIndent(" "); - var children = p.Children.OrderBy(c => !c.IsGroup).ThenBy(c => c.FriendlyName).ToList(); - for (int childIndex = 0; childIndex < children.Count; childIndex++) - { - WriteNavigator_Recurse(children[childIndex], groupPrefix); - if (childIndex < children.Count -1) - WriteLine(","); - else - WriteLine(string.Empty); - } - PopIndent(); - Write("})"); + if (p.IsGroup){ + var groupPrefix = string.Concat(key, "."); + WriteLine("new ClaimNavigatorItem(\"{0}{1}\", \"{2}\", \"{3}\", {4}, new List() {{", Prefix, p.Name, p.FriendlyName, p.Description, p.Hidden ? "true" : "false"); + PushIndent(" "); + var children = p.Children.OrderBy(c => !c.IsGroup).ThenBy(c => c.FriendlyName).ToList(); + for (int childIndex = 0; childIndex < children.Count; childIndex++) + { + WriteNavigator_Recurse(children[childIndex], groupPrefix); + if (childIndex < children.Count -1) + WriteLine(","); + else + WriteLine(string.Empty); + } + PopIndent(); + Write("})"); }else{ - Write("new ClaimNavigatorItem(\"{0}{1}\", {2})", Prefix, p.Name, p.Hidden ? "true" : "false"); + Write("new ClaimNavigatorItem(\"{0}{1}\", {2})", Prefix, p.Name, p.Hidden ? "true" : "false"); } } void WriteAdministratorClaims(Permission root){ - PushIndent(" "); - Stack parents = new Stack(); - parents.Push("c"); - foreach (var pChild in root.Children) - WriteAdministratorClaims_Recurse(pChild, parents); - PopIndent(); + PushIndent(" "); + Stack parents = new Stack(); + parents.Push("c"); + foreach (var pChild in root.Children) + WriteAdministratorClaims_Recurse(pChild, parents); + PopIndent(); } void WriteAdministratorClaims_Recurse(Permission p, Stack parents){ - if (p.IsGroup){ - parents.Push(string.Format("{0}.{1}", parents.Peek(), p.Name)); - foreach (var pChild in p.Children) - WriteAdministratorClaims_Recurse(pChild, parents); - parents.Pop(); + if (p.IsGroup){ + parents.Push(string.Format("{0}.{1}", parents.Peek(), p.Name)); + foreach (var pChild in p.Children) + WriteAdministratorClaims_Recurse(pChild, parents); + parents.Pop(); }else{ - if (p.Name != "ComputerAccount") - WriteLine("{0}.{1} = true;", parents.Peek(), p.Name); + if (p.Name != "ComputerAccount") + WriteLine("{0}.{1} = true;", parents.Peek(), p.Name); } } void WriteAccessHashes(Permission root){ - StringBuilder hashes = new StringBuilder(); - Stack parents = new Stack(); - parents.Push("c"); - foreach (var pChild in root.Children) - WriteAccessHashes_Recurse(pChild, string.Empty, parents, hashes); - WriteLine(hashes.ToString().TrimEnd().TrimEnd(',')); + StringBuilder hashes = new StringBuilder(); + Stack parents = new Stack(); + parents.Push("c"); + foreach (var pChild in root.Children) + WriteAccessHashes_Recurse(pChild, string.Empty, parents, hashes); + WriteLine(hashes.ToString().TrimEnd().TrimEnd(',')); } void WriteAccessHashes_Recurse(Permission p, string Prefix, Stack parents, StringBuilder hashes){ - if (p.IsGroup){ - parents.Push(string.Format("{0}.{1}", parents.Peek(), p.Name)); - foreach (var pChild in p.Children) - WriteAccessHashes_Recurse(pChild, string.Concat(Prefix, p.Name, "."), parents, hashes); - parents.Pop(); + if (p.IsGroup){ + parents.Push(string.Format("{0}.{1}", parents.Peek(), p.Name)); + foreach (var pChild in p.Children) + WriteAccessHashes_Recurse(pChild, string.Concat(Prefix, p.Name, "."), parents, hashes); + parents.Pop(); }else{ - var fqn = string.Concat(Prefix, p.Name); - hashes.AppendFormat(" {{ \"{0}\", new Tuple, Action, string, string, bool>(c => {1}.{2}, (c, v) => {1}.{2} = v, \"{3}\", \"{4}\", {5}) }},", fqn, parents.Peek(), p.Name, p.FriendlyName, p.Description, p.Hidden ? "true" : "false"); - hashes.AppendLine(); + var fqn = string.Concat(Prefix, p.Name); + hashes.AppendFormat(" {{ \"{0}\", new Tuple, Action, string, string, bool>(c => {1}.{2}, (c, v) => {1}.{2} = v, \"{3}\", \"{4}\", {5}) }},", fqn, parents.Peek(), p.Name, p.FriendlyName, p.Description, p.Hidden ? "true" : "false"); + hashes.AppendLine(); } } void WritePermissionConsts(Permission root){ - PushIndent(" "); - PushIndent(" "); - foreach (var pChild in root.Children) - WritePermissionConsts_Recurse(pChild, string.Empty); - PopIndent(); - PopIndent(); + PushIndent(" "); + PushIndent(" "); + foreach (var pChild in root.Children) + WritePermissionConsts_Recurse(pChild, string.Empty); + PopIndent(); + PopIndent(); } void WritePermissionConsts_Recurse(Permission p, string Prefix){ - if (p.IsGroup){ - WriteLine(""); - WriteLine("/// {0}", p.FriendlyName); - WriteLine("/// {0}", p.Description); - WriteLine("/// "); - WriteLine("public static class {0}", p.Name); - WriteLine("{"); - PushIndent(" "); + if (p.IsGroup){ + WriteLine(""); + WriteLine("/// {0}", p.FriendlyName); + WriteLine("/// {0}", p.Description); + WriteLine("/// "); + WriteLine("public static class {0}", p.Name); + WriteLine("{"); + PushIndent(" "); foreach (var pChild in p.Children) - WritePermissionConsts_Recurse(pChild, string.Concat(Prefix, p.Name, ".")); - PopIndent(); - WriteLine("}"); - }else{ - WriteLine(""); - WriteLine("/// {0}", p.FriendlyName); - WriteLine("/// {0}", p.Description); - WriteLine("/// "); - WriteLine("public const string {0} = \"{1}{0}\";", p.Name, Prefix); + WritePermissionConsts_Recurse(pChild, string.Concat(Prefix, p.Name, ".")); + PopIndent(); + WriteLine("}"); + }else{ + WriteLine(""); + WriteLine("/// {0}", p.FriendlyName); + WriteLine("/// {0}", p.Description); + WriteLine("/// "); + WriteLine("public const string {0} = \"{1}{0}\";", p.Name, Prefix); } } Permission BuildHierarchy(List groups, List permissions){ - var top = groups[0]; + var top = groups[0]; - // Find Parents + // Find Parents var groupDict = groups.ToDictionary(p => p.FullName); - // Hierarchy + // Hierarchy foreach (var p in permissions.Where(p => p.IsGroup)) { - var g = groupDict[p.Type]; - p.Children = g.Children; - p.FriendlyName = g.FriendlyName; - p.Description = g.Description; + var g = groupDict[p.Type]; + p.Children = g.Children; + p.FriendlyName = g.FriendlyName; + p.Description = g.Description; } - return top; + return top; } void ParseProjectItem(ProjectItem item, List groups, List permissions){ - foreach (var ns in item.FileCodeModel.CodeElements.OfType()) + foreach (var ns in item.FileCodeModel.CodeElements.OfType()) { foreach (var cl in ns.Members.OfType()) { - var g = BuildPermission(cl); - groups.Add(g); + var g = BuildPermission(cl); + groups.Add(g); foreach (var pr in cl.Members.OfType()) { - var p = BuildPermission(pr); - permissions.Add(p); - g.Children.Add(p); + var p = BuildPermission(pr); + permissions.Add(p); + g.Children.Add(p); } - g.Children = g.Children.OrderBy(p => p.IsGroup).OrderBy(p => p.FriendlyName).ToList(); + g.Children = g.Children.OrderBy(p => p.IsGroup).OrderBy(p => p.FriendlyName).ToList(); } } } IEnumerable FindClaimGroupProjectItems(ProjectItem item){ - const string collectionGuid = "{6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C}"; + const string collectionGuid = "{6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C}"; - if (item.Kind == collectionGuid) + if (item.Kind == collectionGuid) foreach (ProjectItem subItem in item.ProjectItems) foreach (var returnItem in FindClaimGroupProjectItems(subItem)) - yield return returnItem; - else - yield return item; + yield return returnItem; + else + yield return item; } Permission BuildPermission(CodeClass2 item){ - return new Permission(item.FullName, item.Name, item.FullName, item.Attributes); + return new Permission(item.FullName, item.Name, item.FullName, item.Attributes); } Permission BuildPermission(CodeProperty2 item){ - return new Permission(item.FullName, item.Name, item.Type.AsFullName, item.Attributes); + return new Permission(item.FullName, item.Name, item.Type.AsFullName, item.Attributes); } [ComImport, Guid("00020400-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] @@ -368,40 +356,40 @@ public interface IDispatch } class Permission { - public string FullName {get;set;} - public string Name {get;set;} - public string Type {get;set;} - public bool Hidden {get;set;} + public string FullName {get;set;} + public string Name {get;set;} + public string Type {get;set;} + public bool Hidden {get;set;} - public bool IsGroup {get { return Type != "System.Boolean"; } } + public bool IsGroup {get { return Type != "System.Boolean"; } } - public List Children {get;set;} - - public string FriendlyName {get;set;} - public string Description {get;set;} + public List Children {get;set;} + + public string FriendlyName {get;set;} + public string Description {get;set;} public Permission(string FullName, string Name, string Type, CodeElements Attributes) { - this.FullName = FullName; - this.Name = Name; - this.Type = Type; - - Children = new List(); + this.FullName = FullName; + this.Name = Name; + this.Type = Type; + + Children = new List(); - if (Attributes.Count > 0){ - CodeAttribute att = (CodeAttribute)Attributes.Item("ClaimDetails"); - - if (att.Children != null){ - - var attChildren = att.Children.OfType().ToArray(); - this.FriendlyName = attChildren[0].Value.Trim('"'); - this.Description = attChildren[1].Value.Trim('"'); + if (Attributes.Count > 0){ + CodeAttribute att = (CodeAttribute)Attributes.Item("ClaimDetails"); + + if (att.Children != null){ + + var attChildren = att.Children.OfType().ToArray(); + this.FriendlyName = attChildren[0].Value.Trim('"'); + this.Description = attChildren[1].Value.Trim('"'); - if (attChildren.Length > 2) { - this.Hidden = bool.Parse(attChildren[2].Value); + if (attChildren.Length > 2) { + this.Hidden = bool.Parse(attChildren[2].Value); } - } - } + } + } } } #> \ No newline at end of file diff --git a/Disco.Services/Devices/DeviceProfileExtensions.cs b/Disco.Services/Devices/DeviceProfileExtensions.cs index d13ff6a7..808a9635 100644 --- a/Disco.Services/Devices/DeviceProfileExtensions.cs +++ b/Disco.Services/Devices/DeviceProfileExtensions.cs @@ -88,8 +88,7 @@ namespace Disco.Services { foreach (var certificateProviderId in dp.CertificateProviders.Split(',')) { - PluginFeatureManifest featureManifest = null; - if (Plugins.Plugins.TryGetPluginFeature(certificateProviderId.Trim(), typeof(CertificateProviderFeature), out featureManifest)) + if (Plugins.Plugins.TryGetPluginFeature(certificateProviderId.Trim(), typeof(CertificateProviderFeature), out var featureManifest)) { yield return featureManifest; } @@ -103,8 +102,7 @@ namespace Disco.Services { foreach (var certificateAuthorityProviderId in dp.CertificateAuthorityProviders.Split(',')) { - PluginFeatureManifest featureManifest = null; - if (Plugins.Plugins.TryGetPluginFeature(certificateAuthorityProviderId.Trim(), typeof(CertificateAuthorityProviderFeature), out featureManifest)) + if (Plugins.Plugins.TryGetPluginFeature(certificateAuthorityProviderId.Trim(), typeof(CertificateAuthorityProviderFeature), out var featureManifest)) { yield return featureManifest; } @@ -118,8 +116,7 @@ namespace Disco.Services { foreach (var wirelessProfileProviderId in dp.WirelessProfileProviders.Split(',')) { - PluginFeatureManifest featureManifest = null; - if (Plugins.Plugins.TryGetPluginFeature(wirelessProfileProviderId.Trim(), typeof(WirelessProfileProviderFeature), out featureManifest)) + if (Plugins.Plugins.TryGetPluginFeature(wirelessProfileProviderId.Trim(), typeof(WirelessProfileProviderFeature), out var featureManifest)) { yield return featureManifest; } diff --git a/Disco.Services/Devices/Enrolment/LogMacAddressImportingTask.cs b/Disco.Services/Devices/Enrolment/LogMacAddressImportingTask.cs index a222f4ab..492e6fe8 100644 --- a/Disco.Services/Devices/Enrolment/LogMacAddressImportingTask.cs +++ b/Disco.Services/Devices/Enrolment/LogMacAddressImportingTask.cs @@ -92,10 +92,9 @@ namespace Disco.Services.Devices.Enrolment var devices = database.Devices.Include("DeviceDetails").ToList(); - Tuple addressResult; foreach (var device in devices) { - if (addresses.TryGetValue(device.SerialNumber.ToLower(), out addressResult)) + if (addresses.TryGetValue(device.SerialNumber.ToLower(), out var addressResult)) { if (!string.IsNullOrEmpty(addressResult.Item1)) device.DeviceDetails.LanMacAddress(device, addressResult.Item1); diff --git a/Disco.Services/Devices/Enrolment/MacDeviceEnrolment.cs b/Disco.Services/Devices/Enrolment/MacDeviceEnrolment.cs index c57722f6..89a4f8a8 100644 --- a/Disco.Services/Devices/Enrolment/MacDeviceEnrolment.cs +++ b/Disco.Services/Devices/Enrolment/MacDeviceEnrolment.cs @@ -73,9 +73,8 @@ namespace Disco.Services.Devices.Enrolment foreach (var node in profilerData.OfType()) { var nodeItems = ((ArrayNode)node["_items"]); - PNode nodeDataType; - if (node.TryGetValue("_dataType", out nodeDataType) && nodeDataType is StringNode) + if (node.TryGetValue("_dataType", out var nodeDataType) && nodeDataType is StringNode) { switch (((StringNode)nodeDataType).Value) { diff --git a/Disco.Services/Devices/Enrolment/WindowsDeviceEnrolment.cs b/Disco.Services/Devices/Enrolment/WindowsDeviceEnrolment.cs index 0b0a416a..70187952 100644 --- a/Disco.Services/Devices/Enrolment/WindowsDeviceEnrolment.cs +++ b/Disco.Services/Devices/Enrolment/WindowsDeviceEnrolment.cs @@ -374,11 +374,10 @@ namespace Disco.Services.Devices.Enrolment else device.DeviceDomainId = $@"{domain.NetBiosName}\{Request.ComputerName}"; - string offlineProvisionDiagnosicInfo; EnrolmentLog.LogSessionTaskProvisioningADAccount(sessionId, device.SerialNumber, device.DeviceDomainId); adMachineAccount = domainController.Value.RetrieveADMachineAccount(device.DeviceDomainId); - response.OfflineDomainJoinManifest = domainController.Value.OfflineDomainJoinProvision(device.DeviceDomainId, device.DeviceProfile.OrganisationalUnit, ref adMachineAccount, out offlineProvisionDiagnosicInfo); + response.OfflineDomainJoinManifest = domainController.Value.OfflineDomainJoinProvision(device.DeviceDomainId, device.DeviceProfile.OrganisationalUnit, ref adMachineAccount, out var offlineProvisionDiagnosicInfo); EnrolmentLog.LogSessionDiagnosticInformation(sessionId, offlineProvisionDiagnosicInfo); @@ -415,8 +414,7 @@ namespace Disco.Services.Devices.Enrolment domain = ActiveDirectory.Context.GetDomainFromDistinguishedName(device.DeviceProfile.OrganisationalUnit); var calculatedComputerName = device.ComputerNameRender(Database, domain); - string calculatedAccountUsername; - ActiveDirectory.ParseDomainAccountId(calculatedComputerName, out calculatedAccountUsername); + ActiveDirectory.ParseDomainAccountId(calculatedComputerName, out string calculatedAccountUsername); if (!Request.ComputerName.Equals(calculatedAccountUsername, StringComparison.OrdinalIgnoreCase)) { @@ -428,9 +426,8 @@ namespace Disco.Services.Devices.Enrolment response.ComputerName = calculatedAccountUsername; // Create New Account - string offlineProvisionDiagnosicInfo; - response.OfflineDomainJoinManifest = domainController.Value.OfflineDomainJoinProvision(device.DeviceDomainId, device.DeviceProfile.OrganisationalUnit, ref adMachineAccount, out offlineProvisionDiagnosicInfo); + response.OfflineDomainJoinManifest = domainController.Value.OfflineDomainJoinProvision(device.DeviceDomainId, device.DeviceProfile.OrganisationalUnit, ref adMachineAccount, out var offlineProvisionDiagnosicInfo); EnrolmentLog.LogSessionDiagnosticInformation(sessionId, offlineProvisionDiagnosicInfo); @@ -510,8 +507,7 @@ namespace Disco.Services.Devices.Enrolment { EnrolmentLog.LogSessionProgress(sessionId, 90, "Provisioning Certificates"); - List provisionedCertificates; - var provisionResult = device.ProvisionCertificates(Database, Request, out provisionedCertificates); + var provisionResult = device.ProvisionCertificates(Database, Request, out var provisionedCertificates); if (provisionedCertificates != null && provisionedCertificates.Count > 0) { diff --git a/Disco.Services/Devices/Importing/BaseDeviceImportContext.cs b/Disco.Services/Devices/Importing/BaseDeviceImportContext.cs index 3a4d89e7..c391dce4 100644 --- a/Disco.Services/Devices/Importing/BaseDeviceImportContext.cs +++ b/Disco.Services/Devices/Importing/BaseDeviceImportContext.cs @@ -113,8 +113,7 @@ namespace Disco.Services.Devices.Importing if (columnsByType == null) throw new ArgumentNullException(nameof(columnsByType)); - DeviceImportColumn column; - if (columnsByType.TryGetValue(FieldType, out column)) + if (columnsByType.TryGetValue(FieldType, out var column)) { return column.Index; } diff --git a/Disco.Services/Devices/Importing/CsvDeviceImportDataReader.cs b/Disco.Services/Devices/Importing/CsvDeviceImportDataReader.cs index d5858f46..bc4ec8a1 100644 --- a/Disco.Services/Devices/Importing/CsvDeviceImportDataReader.cs +++ b/Disco.Services/Devices/Importing/CsvDeviceImportDataReader.cs @@ -102,8 +102,7 @@ namespace Disco.Services.Devices.Importing return rawData.Select(r => r[ColumnIndex]) .All(c => { - int? value; - return TryGetNullableInt(c, out value); + return TryGetNullableInt(c, out var value); }); } @@ -112,8 +111,7 @@ namespace Disco.Services.Devices.Importing return rawData.Select(r => r[ColumnIndex]) .All(c => { - int? value; - return TryGetNullableInt(c, out value) && value.HasValue; + return TryGetNullableInt(c, out var value) && value.HasValue; }); } @@ -122,8 +120,7 @@ namespace Disco.Services.Devices.Importing return rawData.Select(r => r[ColumnIndex]) .All(c => { - bool? value; - return TryGetNullableBool(c, out value); + return TryGetNullableBool(c, out var value); }); } @@ -132,8 +129,7 @@ namespace Disco.Services.Devices.Importing return rawData.Select(r => r[ColumnIndex]) .All(c => { - DateTime? value; - return TryGetNullableDateTime(c, out value); + return TryGetNullableDateTime(c, out var value); }); } @@ -153,8 +149,7 @@ namespace Disco.Services.Devices.Importing { content = content.Trim(); - DateTime valueDateTime; - if (DateTime.TryParse(content, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal, out valueDateTime)) + if (DateTime.TryParse(content, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal, out var valueDateTime)) { value = valueDateTime; return true; @@ -205,8 +200,7 @@ namespace Disco.Services.Devices.Importing } else { - int intValue; - if (int.TryParse(content, out intValue)) + if (int.TryParse(content, out var intValue)) { value = intValue; return true; diff --git a/Disco.Services/Devices/Importing/Fields/DeviceDecommissionedDateImportField.cs b/Disco.Services/Devices/Importing/Fields/DeviceDecommissionedDateImportField.cs index dbe5e0f7..ffa2cdbb 100644 --- a/Disco.Services/Devices/Importing/Fields/DeviceDecommissionedDateImportField.cs +++ b/Disco.Services/Devices/Importing/Fields/DeviceDecommissionedDateImportField.cs @@ -40,8 +40,7 @@ namespace Disco.Services.Devices.Importing.Fields parsedValue = new DateTime((parsedValue.Value.Ticks / 10000000L) * 10000000L); } - string errorMessage; - if (parsedValue.HasValue && !CanDecommissionDevice(ExistingDevice, Context, DataReader, out errorMessage)) + if (parsedValue.HasValue && !CanDecommissionDevice(ExistingDevice, Context, DataReader, out var errorMessage)) return Error(errorMessage); var decommissionReasonIndex = Context.GetColumnByType(DeviceImportFieldTypes.DeviceDecommissionedReason); diff --git a/Disco.Services/Devices/Importing/Fields/DeviceDecommissionedReasonImportField.cs b/Disco.Services/Devices/Importing/Fields/DeviceDecommissionedReasonImportField.cs index ec9451ab..e3cb517a 100644 --- a/Disco.Services/Devices/Importing/Fields/DeviceDecommissionedReasonImportField.cs +++ b/Disco.Services/Devices/Importing/Fields/DeviceDecommissionedReasonImportField.cs @@ -55,8 +55,7 @@ namespace Disco.Services.Devices.Importing.Fields } else { - DecommissionReasons valueReason; - if (!decommissionReasonsMap.Value.TryGetValue(value.Trim(), out valueReason)) + if (!decommissionReasonsMap.Value.TryGetValue(value.Trim(), out var valueReason)) { rawValue = value.Trim(); return Error("Cannot parse the value as a Decommission Reason"); diff --git a/Disco.Services/Devices/Importing/Fields/ModelIdImportField.cs b/Disco.Services/Devices/Importing/Fields/ModelIdImportField.cs index f5cbf255..7a960b35 100644 --- a/Disco.Services/Devices/Importing/Fields/ModelIdImportField.cs +++ b/Disco.Services/Devices/Importing/Fields/ModelIdImportField.cs @@ -24,8 +24,7 @@ namespace Disco.Services.Devices.Importing.Fields public override bool Parse(DiscoDataContext Database, IDeviceImportCache Cache, IDeviceImportContext Context, string DeviceSerialNumber, Device ExistingDevice, List PreviousRecords, IDeviceImportDataReader DataReader, int ColumnIndex) { - int? intValue; - if (DataReader.TryGetNullableInt(ColumnIndex, out intValue)) + if (DataReader.TryGetNullableInt(ColumnIndex, out var intValue)) { if (!intValue.HasValue) { diff --git a/Disco.Services/Devices/Importing/Fields/ProfileIdImportField.cs b/Disco.Services/Devices/Importing/Fields/ProfileIdImportField.cs index 93add70c..66ec5577 100644 --- a/Disco.Services/Devices/Importing/Fields/ProfileIdImportField.cs +++ b/Disco.Services/Devices/Importing/Fields/ProfileIdImportField.cs @@ -24,8 +24,7 @@ namespace Disco.Services.Devices.Importing.Fields public override bool Parse(DiscoDataContext Database, IDeviceImportCache Cache, IDeviceImportContext Context, string DeviceSerialNumber, Device ExistingDevice, List PreviousRecords, IDeviceImportDataReader DataReader, int ColumnIndex) { - int? intValue; - if (DataReader.TryGetNullableInt(ColumnIndex, out intValue)) + if (DataReader.TryGetNullableInt(ColumnIndex, out var intValue)) { if (!intValue.HasValue) { diff --git a/Disco.Services/Devices/Importing/XlsxDeviceImportDataReader.cs b/Disco.Services/Devices/Importing/XlsxDeviceImportDataReader.cs index 1713eb42..6107d983 100644 --- a/Disco.Services/Devices/Importing/XlsxDeviceImportDataReader.cs +++ b/Disco.Services/Devices/Importing/XlsxDeviceImportDataReader.cs @@ -102,8 +102,7 @@ namespace Disco.Services.Devices.Importing return rawData.Select(r => r[ColumnIndex]) .All(c => { - int? value; - return TryGetNullableInt(c, out value); + return TryGetNullableInt(c, out var value); }); } @@ -112,8 +111,7 @@ namespace Disco.Services.Devices.Importing return rawData.Select(r => r[ColumnIndex]) .All(c => { - int? value; - return TryGetNullableInt(c, out value) && value.HasValue; + return TryGetNullableInt(c, out var value) && value.HasValue; }); } @@ -122,8 +120,7 @@ namespace Disco.Services.Devices.Importing return rawData.Select(r => r[ColumnIndex]) .All(c => { - bool? value; - return TryGetNullableBool(c, out value); + return TryGetNullableBool(c, out var value); }); } @@ -132,8 +129,7 @@ namespace Disco.Services.Devices.Importing return rawData.Select(r => r[ColumnIndex]) .All(c => { - DateTime? value; - return TryGetNullableDateTime(c, out value); + return TryGetNullableDateTime(c, out var value); }); } @@ -167,8 +163,7 @@ namespace Disco.Services.Devices.Importing { stringValue = stringValue.Trim(); - DateTime valueDateTime; - if (DateTime.TryParse(stringValue, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal, out valueDateTime)) + if (DateTime.TryParse(stringValue, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal, out var valueDateTime)) { value = valueDateTime; return true; @@ -247,8 +242,7 @@ namespace Disco.Services.Devices.Importing } else { - int intValue; - if (int.TryParse(stringValue, out intValue)) + if (int.TryParse(stringValue, out var intValue)) { value = intValue; return true; diff --git a/Disco.Services/Devices/ManagedGroups/DeviceBatchAssignedUsersManagedGroup.cs b/Disco.Services/Devices/ManagedGroups/DeviceBatchAssignedUsersManagedGroup.cs index 895c56be..00f94a1c 100644 --- a/Disco.Services/Devices/ManagedGroups/DeviceBatchAssignedUsersManagedGroup.cs +++ b/Disco.Services/Devices/ManagedGroups/DeviceBatchAssignedUsersManagedGroup.cs @@ -76,10 +76,9 @@ namespace Disco.Services.Devices.ManagedGroups public static bool TryGetManagedGroup(DeviceBatch DeviceBatch, out DeviceBatchAssignedUsersManagedGroup ManagedGroup) { - ADManagedGroup managedGroup; string key = GetKey(DeviceBatch); - if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup)) + if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out var managedGroup)) { ManagedGroup = (DeviceBatchAssignedUsersManagedGroup)managedGroup; return true; diff --git a/Disco.Services/Devices/ManagedGroups/DeviceBatchDevicesManagedGroup.cs b/Disco.Services/Devices/ManagedGroups/DeviceBatchDevicesManagedGroup.cs index abf91e13..88cf9ad9 100644 --- a/Disco.Services/Devices/ManagedGroups/DeviceBatchDevicesManagedGroup.cs +++ b/Disco.Services/Devices/ManagedGroups/DeviceBatchDevicesManagedGroup.cs @@ -74,10 +74,9 @@ namespace Disco.Services.Devices.ManagedGroups public static bool TryGetManagedGroup(DeviceBatch DeviceBatch, out DeviceBatchDevicesManagedGroup ManagedGroup) { - ADManagedGroup managedGroup; string key = GetKey(DeviceBatch); - if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup)) + if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out var managedGroup)) { ManagedGroup = (DeviceBatchDevicesManagedGroup)managedGroup; return true; diff --git a/Disco.Services/Devices/ManagedGroups/DeviceProfileAssignedUsersManagedGroup.cs b/Disco.Services/Devices/ManagedGroups/DeviceProfileAssignedUsersManagedGroup.cs index 21963a12..ee70b331 100644 --- a/Disco.Services/Devices/ManagedGroups/DeviceProfileAssignedUsersManagedGroup.cs +++ b/Disco.Services/Devices/ManagedGroups/DeviceProfileAssignedUsersManagedGroup.cs @@ -76,10 +76,9 @@ namespace Disco.Services.Devices.ManagedGroups public static bool TryGetManagedGroup(DeviceProfile DeviceProfile, out DeviceProfileAssignedUsersManagedGroup ManagedGroup) { - ADManagedGroup managedGroup; string key = GetKey(DeviceProfile); - if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup)) + if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out var managedGroup)) { ManagedGroup = (DeviceProfileAssignedUsersManagedGroup)managedGroup; return true; diff --git a/Disco.Services/Devices/ManagedGroups/DeviceProfileDevicesManagedGroup.cs b/Disco.Services/Devices/ManagedGroups/DeviceProfileDevicesManagedGroup.cs index 559c84e6..d087ea1e 100644 --- a/Disco.Services/Devices/ManagedGroups/DeviceProfileDevicesManagedGroup.cs +++ b/Disco.Services/Devices/ManagedGroups/DeviceProfileDevicesManagedGroup.cs @@ -75,10 +75,9 @@ namespace Disco.Services.Devices.ManagedGroups public static bool TryGetManagedGroup(DeviceProfile DeviceProfile, out DeviceProfileDevicesManagedGroup ManagedGroup) { - ADManagedGroup managedGroup; string key = GetKey(DeviceProfile); - if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup)) + if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out var managedGroup)) { ManagedGroup = (DeviceProfileDevicesManagedGroup)managedGroup; return true; diff --git a/Disco.Services/Documents/AttachmentImport/ImportPage.cs b/Disco.Services/Documents/AttachmentImport/ImportPage.cs index 5de57b49..7fa36222 100644 --- a/Disco.Services/Documents/AttachmentImport/ImportPage.cs +++ b/Disco.Services/Documents/AttachmentImport/ImportPage.cs @@ -298,8 +298,7 @@ namespace Disco.Services.Documents.AttachmentImport if (qrCodeResult != null && qrCodeResult.ResultPoints.Length == 4) { - float thumbnailScale; - var thumbnailOffset = renderedImage.CalculateResize(renderedThumbnail.Width, renderedThumbnail.Height, out thumbnailScale); + var thumbnailOffset = renderedImage.CalculateResize(renderedThumbnail.Width, renderedThumbnail.Height, out var thumbnailScale); thumbnailScale = thumbnailScale / qrCodeResultScale; using (Graphics thumbnailGraphics = Graphics.FromImage(renderedThumbnail)) diff --git a/Disco.Services/Documents/DocumentTemplateExpressionExtensions.cs b/Disco.Services/Documents/DocumentTemplateExpressionExtensions.cs index 11f2004a..3187217a 100644 --- a/Disco.Services/Documents/DocumentTemplateExpressionExtensions.cs +++ b/Disco.Services/Documents/DocumentTemplateExpressionExtensions.cs @@ -29,11 +29,10 @@ namespace Disco.Services try { var er = compiledExpression.EvaluateFirst(Data, evaluatorVariables); - if (er is bool) + if (er is bool erBool) { - return (bool)er; + return erBool; } - bool erBool; if (bool.TryParse(er.ToString(), out erBool)) { return erBool; diff --git a/Disco.Services/Documents/DocumentTemplatePackageExtensions.cs b/Disco.Services/Documents/DocumentTemplatePackageExtensions.cs index 3da777df..c0cc8f7d 100644 --- a/Disco.Services/Documents/DocumentTemplatePackageExtensions.cs +++ b/Disco.Services/Documents/DocumentTemplatePackageExtensions.cs @@ -91,11 +91,10 @@ namespace Disco.Services try { object er = compiledExpression.EvaluateFirst(Data, evaluatorVariables); - if (er is bool) + if (er is bool erBool) { - return (bool)er; + return erBool; } - bool erBool; if (bool.TryParse(er.ToString(), out erBool)) { return erBool; diff --git a/Disco.Services/Documents/DocumentTemplatePackages.cs b/Disco.Services/Documents/DocumentTemplatePackages.cs index 59c4550b..613b31e4 100644 --- a/Disco.Services/Documents/DocumentTemplatePackages.cs +++ b/Disco.Services/Documents/DocumentTemplatePackages.cs @@ -35,8 +35,7 @@ namespace Disco.Services.Documents public static DocumentTemplatePackage GetPackage(string Id) { - DocumentTemplatePackage package; - if (cache.TryGetValue(Id, out package)) + if (cache.TryGetValue(Id, out var package)) return package; else return null; @@ -142,11 +141,10 @@ namespace Disco.Services.Documents public static DocumentTemplatePackage UpdatePackage(DocumentTemplatePackage Package) { - DocumentTemplatePackage existingPackage; if (string.IsNullOrWhiteSpace(Package.Id)) throw new ArgumentNullException(nameof(Package), "The Package Id is required"); - if (!cache.TryGetValue(Package.Id, out existingPackage)) // Name Unique + if (!cache.TryGetValue(Package.Id, out var existingPackage)) // Name Unique throw new ArgumentException("The Package Id does not exist", nameof(Package)); if (string.IsNullOrWhiteSpace(Package.Description)) throw new ArgumentNullException(nameof(Package), "The Package Description is required"); @@ -162,8 +160,7 @@ namespace Disco.Services.Documents public static void RemovePackage(string Id) { - DocumentTemplatePackage existingPackage; - if (cache.TryRemove(Id, out existingPackage)) + if (cache.TryRemove(Id, out _)) { PersistCache(); } diff --git a/Disco.Services/Documents/DocumentUniqueIdentifier.cs b/Disco.Services/Documents/DocumentUniqueIdentifier.cs index 01223977..780696bb 100644 --- a/Disco.Services/Documents/DocumentUniqueIdentifier.cs +++ b/Disco.Services/Documents/DocumentUniqueIdentifier.cs @@ -312,28 +312,17 @@ namespace Disco.Services.Documents public static DocumentUniqueIdentifier Parse(DiscoDataContext Database, byte[] UniqueIdentifier) { - DocumentUniqueIdentifier identifier; - if (TryParse(Database, UniqueIdentifier, out identifier)) - { + if (TryParse(Database, UniqueIdentifier, out var identifier)) return identifier; - } - else - { - throw new FormatException("Invalid Document Unique Identifier"); - } + throw new FormatException("Invalid Document Unique Identifier"); } public static DocumentUniqueIdentifier Parse(DiscoDataContext Database, string UniqueIdentifier) { - DocumentUniqueIdentifier identifier; - if (TryParse(Database, UniqueIdentifier, out identifier)) - { + if (TryParse(Database, UniqueIdentifier, out var identifier)) return identifier; - } - else - { - throw new FormatException("Invalid Document Unique Identifier"); - } + throw new FormatException("Invalid Document Unique Identifier"); + } public static bool TryParse(DiscoDataContext Database, string UniqueIdentifier, out DocumentUniqueIdentifier Identifier) @@ -417,7 +406,7 @@ namespace Disco.Services.Documents // Has document template id flag if ((flags & 0x8) == 0x8) { - documentTemplateId = DocumentUniqueIdentifierExtensions.BinaryDecode(Data, position, out position); + documentTemplateId = DocumentUniqueIdentifierExtensions.BinaryDecode(Data, position, out _); } AttachmentTypes? attachmentType = null; diff --git a/Disco.Services/Documents/DocumentUniqueIdentifierExtensions.cs b/Disco.Services/Documents/DocumentUniqueIdentifierExtensions.cs index 312f922b..65a4b0c4 100644 --- a/Disco.Services/Documents/DocumentUniqueIdentifierExtensions.cs +++ b/Disco.Services/Documents/DocumentUniqueIdentifierExtensions.cs @@ -24,7 +24,6 @@ namespace Disco.Services if (Data == null) throw new ArgumentNullException(nameof(Data)); - byte[] result; if (Data.Length == 0) { @@ -33,7 +32,7 @@ namespace Disco.Services } // Try Numeric Encode - if (TryBinaryNumericEncode(Data, out result)) + if (TryBinaryNumericEncode(Data, out var result)) { return result; } @@ -88,8 +87,7 @@ namespace Disco.Services // Z = number of leading zeros // Y = number component < 0x0FFFFFFF (268,435,455) - uint number; - if (uint.TryParse(Data, out number) && number <= 0x0FFFFFFF) + if (uint.TryParse(Data, out var number) && number <= 0x0FFFFFFF) { Result = new byte[4]; int leadingZeros = 0; @@ -250,12 +248,10 @@ namespace Disco.Services // A,B,C = character component in // alpha encoded format - short number; - byte[] chars; if (Data.Length == 7 && - short.TryParse(Data.Substring(3), out number) && + short.TryParse(Data.Substring(3), out var number) && number <= 9999 && - TryBinaryAlphaEncode(Data.Substring(0, 3), out chars)) + TryBinaryAlphaEncode(Data.Substring(0, 3), out var chars)) { Result = new byte[4]; Result[0] = (byte)(0x80 | (number >> 8)); diff --git a/Disco.Services/Documents/ManagedGroups/DocumentTemplateDevicesManagedGroup.cs b/Disco.Services/Documents/ManagedGroups/DocumentTemplateDevicesManagedGroup.cs index 8b9116ad..ada15101 100644 --- a/Disco.Services/Documents/ManagedGroups/DocumentTemplateDevicesManagedGroup.cs +++ b/Disco.Services/Documents/ManagedGroups/DocumentTemplateDevicesManagedGroup.cs @@ -109,10 +109,9 @@ namespace Disco.Services.Documents.ManagedGroups public static bool TryGetManagedGroup(DocumentTemplate DocumentTemplate, out DocumentTemplateDevicesManagedGroup ManagedGroup) { - ADManagedGroup managedGroup; string key = GetKey(DocumentTemplate); - if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup)) + if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out var managedGroup)) { ManagedGroup = (DocumentTemplateDevicesManagedGroup)managedGroup; return true; @@ -230,8 +229,7 @@ namespace Disco.Services.Documents.ManagedGroups { var attachment = (DeviceAttachment)e.Entity; - string deviceAccountId; - if (DeviceContainsAttachment(e.Database, attachment.DeviceSerialNumber, out deviceAccountId)) + if (DeviceContainsAttachment(e.Database, attachment.DeviceSerialNumber, out var deviceAccountId)) AddMember(attachment.DeviceSerialNumber, (database) => new string[] { deviceAccountId }); } private void ProcessDeviceAttachmentRemoveEvent(Tuple e) @@ -240,8 +238,7 @@ namespace Disco.Services.Documents.ManagedGroups RemoveMember(deviceSerialNumber, (database) => { - string deviceAccountId; - if (!DeviceContainsAttachment(database, deviceSerialNumber, out deviceAccountId) && deviceAccountId != null) + if (!DeviceContainsAttachment(database, deviceSerialNumber, out var deviceAccountId) && deviceAccountId != null) return new string[] { deviceAccountId }; else return null; @@ -279,9 +276,7 @@ namespace Disco.Services.Documents.ManagedGroups { var attachment = (JobAttachment)e.Entity; - string deviceAccountId; - string deviceSerialNumber; - if (JobsContainAttachment(e.Database, attachment.JobId, out deviceAccountId, out deviceSerialNumber)) + if (JobsContainAttachment(e.Database, attachment.JobId, out var deviceAccountId, out var deviceSerialNumber)) AddMember(deviceSerialNumber, (database) => new string[] { deviceAccountId }); } private void ProcessJobAttachmentRemoveEvent(Tuple e) @@ -293,8 +288,7 @@ namespace Disco.Services.Documents.ManagedGroups { RemoveMember(deviceSerialNumber, (database) => { - string deviceAccountId; - if (!JobsContainAttachment(database, jobId, out deviceAccountId, out deviceSerialNumber) && + if (!JobsContainAttachment(database, jobId, out var deviceAccountId, out deviceSerialNumber) && deviceSerialNumber != null && deviceAccountId != null) return new string[] { deviceAccountId }; else @@ -335,8 +329,7 @@ namespace Disco.Services.Documents.ManagedGroups { var attachment = (UserAttachment)e.Entity; - List> devices; - if (DeviceUserContainAttachment(e.Database, attachment.UserId, out devices) && devices != null) + if (DeviceUserContainAttachment(e.Database, attachment.UserId, out var devices) && devices != null) devices.ForEach(d => AddMember(d.Item2, (database) => new string[] { d.Item1 })); } private void ProcessUserAttachmentRemoveEvent(Tuple e) @@ -345,8 +338,7 @@ namespace Disco.Services.Documents.ManagedGroups RemoveMember(userId, (database) => { - List> devices; - if (!DeviceUserContainAttachment(database, userId, out devices) && devices != null) + if (!DeviceUserContainAttachment(database, userId, out var devices) && devices != null) return devices.Select(d => d.Item1); else return null; diff --git a/Disco.Services/Documents/ManagedGroups/DocumentTemplateUsersManagedGroup.cs b/Disco.Services/Documents/ManagedGroups/DocumentTemplateUsersManagedGroup.cs index a54417ca..5784647b 100644 --- a/Disco.Services/Documents/ManagedGroups/DocumentTemplateUsersManagedGroup.cs +++ b/Disco.Services/Documents/ManagedGroups/DocumentTemplateUsersManagedGroup.cs @@ -104,10 +104,9 @@ namespace Disco.Services.Documents.ManagedGroups public static bool TryGetManagedGroup(DocumentTemplate DocumentTemplate, out DocumentTemplateUsersManagedGroup ManagedGroup) { - ADManagedGroup managedGroup; string key = GetKey(DocumentTemplate); - if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup)) + if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out var managedGroup)) { ManagedGroup = (DocumentTemplateUsersManagedGroup)managedGroup; return true; @@ -217,8 +216,7 @@ namespace Disco.Services.Documents.ManagedGroups { var attachment = (DeviceAttachment)e.Entity; - string userId; - if (DeviceContainsAttachment(e.Database, attachment.DeviceSerialNumber, out userId) && userId != null) + if (DeviceContainsAttachment(e.Database, attachment.DeviceSerialNumber, out var userId) && userId != null) AddMember(userId, (database) => new string[] { userId }); } private void ProcessDeviceAttachmentRemoveEvent(Tuple e) @@ -273,8 +271,7 @@ namespace Disco.Services.Documents.ManagedGroups { var attachment = (JobAttachment)e.Entity; - string userId; - if (JobsContainAttachment(e.Database, attachment.JobId, out userId) && userId != null) + if (JobsContainAttachment(e.Database, attachment.JobId, out var userId) && userId != null) AddMember(userId, (database) => new string[] { userId }); } private void ProcessJobAttachmentRemoveEvent(Tuple e) diff --git a/Disco.Services/Documents/QRCodeBinaryEncoder.cs b/Disco.Services/Documents/QRCodeBinaryEncoder.cs index b457682f..7ba3edd1 100644 --- a/Disco.Services/Documents/QRCodeBinaryEncoder.cs +++ b/Disco.Services/Documents/QRCodeBinaryEncoder.cs @@ -11,8 +11,6 @@ namespace Disco.Services.Documents public static byte[] Encode(string content, ErrorCorrectionLevel ecLevel, out int width, out int height) { var code = Encoder.encode(content, ecLevel, null); - - var array = code.Matrix.Array; width = code.Matrix.Width; height = code.Matrix.Height; @@ -140,11 +138,9 @@ namespace Disco.Services.Documents for (int i = 0; i < numRSBlocks; ++i) { - int numDataBytesInBlock; - int numEcBytesInBlock; getNumDataBytesAndNumECBytesForBlockID( numTotalBytes, numDataBytes, numRSBlocks, i, - out numDataBytesInBlock, out numEcBytesInBlock); + out var numDataBytesInBlock, out var numEcBytesInBlock); byte[] dataBytes = new byte[numDataBytesInBlock]; bits.toBytes(8 * dataBytesOffset, dataBytes, 0, numDataBytesInBlock); diff --git a/Disco.Services/Interop/ActiveDirectory/ADDeviceDescriptionUpdateTask.cs b/Disco.Services/Interop/ActiveDirectory/ADDeviceDescriptionUpdateTask.cs index 82554f62..5207755d 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADDeviceDescriptionUpdateTask.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADDeviceDescriptionUpdateTask.cs @@ -85,8 +85,7 @@ namespace Disco.Services.Interop.ActiveDirectory foreach (var domainGroup in devices.GroupBy(d => d.ComputerDomainName).ToList()) { - ADDomain domain; - if (domainGroup.Key != null && ActiveDirectory.Context.TryGetDomainByNetBiosName(domainGroup.Key, out domain)) + if (domainGroup.Key != null && ActiveDirectory.Context.TryGetDomainByNetBiosName(domainGroup.Key, out var domain)) { var controller = domain.GetAvailableDomainController(RequireWritable: true); diff --git a/Disco.Services/Interop/ActiveDirectory/ADDomainController.cs b/Disco.Services/Interop/ActiveDirectory/ADDomainController.cs index 4eca4240..7db827f7 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADDomainController.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADDomainController.cs @@ -311,8 +311,7 @@ namespace Disco.Services.Interop.ActiveDirectory // Link Children foreach (var ouChildren in indexedChildren) { - ADOrganisationalUnit ouParent; - if (indexedOrganisationalUnits.TryGetValue(ouChildren.Key, out ouParent)) + if (indexedOrganisationalUnits.TryGetValue(ouChildren.Key, out var ouParent)) { ouParent.Children = ouChildren.Value.OrderBy(o => o.Name).ToList(); } diff --git a/Disco.Services/Interop/ActiveDirectory/ADGroup.cs b/Disco.Services/Interop/ActiveDirectory/ADGroup.cs index caba8ea0..aaba2a82 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADGroup.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADGroup.cs @@ -121,8 +121,7 @@ namespace Disco.Services.Interop.ActiveDirectory case "member": return Members.OfType(); default: - object[] adProperty; - if (LoadedProperties.TryGetValue(PropertyName, out adProperty)) + if (LoadedProperties.TryGetValue(PropertyName, out var adProperty)) return adProperty.OfType(); else return Enumerable.Empty(); diff --git a/Disco.Services/Interop/ActiveDirectory/ADMachineAccount.cs b/Disco.Services/Interop/ActiveDirectory/ADMachineAccount.cs index 91927144..bb7c543a 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADMachineAccount.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADMachineAccount.cs @@ -195,8 +195,7 @@ namespace Disco.Services.Interop.ActiveDirectory case "userAccountControl": return new int[] { (int)UserAccountControl }.OfType(); default: - object[] adProperty; - if (LoadedProperties.TryGetValue(PropertyName, out adProperty)) + if (LoadedProperties.TryGetValue(PropertyName, out var adProperty)) return adProperty.OfType(); else return Enumerable.Empty(); diff --git a/Disco.Services/Interop/ActiveDirectory/ADNetworkLogonDatesUpdateTask.cs b/Disco.Services/Interop/ActiveDirectory/ADNetworkLogonDatesUpdateTask.cs index 1e79f0fc..10cfe0b9 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADNetworkLogonDatesUpdateTask.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADNetworkLogonDatesUpdateTask.cs @@ -59,10 +59,8 @@ namespace Disco.Services.Interop.ActiveDirectory if (!string.IsNullOrEmpty(Device.DeviceDomainId) && Device.DeviceDomainId.Contains('\\')) { var context = ActiveDirectory.Context; - string deviceSamAccountName; - ADDomain deviceDomain; - ActiveDirectory.ParseDomainAccountId(Device.DeviceDomainId + "$", out deviceSamAccountName, out deviceDomain); + ActiveDirectory.ParseDomainAccountId(Device.DeviceDomainId + "$", out var deviceSamAccountName, out var deviceDomain); var ldapFilter = string.Format(ldapFilterTemplate, ADHelpers.EscapeLdapQuery(deviceSamAccountName)); IEnumerable domainControllers; @@ -177,8 +175,7 @@ namespace Disco.Services.Interop.ActiveDirectory foreach (Device device in Database.Devices.Where(device => device.DeviceDomainId != null)) { - DateTime lastLogonDate; - if (queryResults.TryGetValue(device.DeviceDomainId.ToUpper(), out lastLogonDate)) + if (queryResults.TryGetValue(device.DeviceDomainId.ToUpper(), out var lastLogonDate)) { if (!device.LastNetworkLogonDate.HasValue) device.LastNetworkLogonDate = lastLogonDate; diff --git a/Disco.Services/Interop/ActiveDirectory/ADUserAccount.cs b/Disco.Services/Interop/ActiveDirectory/ADUserAccount.cs index 1c79b39a..12d4f242 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADUserAccount.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADUserAccount.cs @@ -224,8 +224,7 @@ namespace Disco.Services.Interop.ActiveDirectory case "userAccountControl": return new int[] { (int)UserAccountControl }.OfType(); default: - object[] adProperty; - if (LoadedProperties.TryGetValue(PropertyName, out adProperty)) + if (LoadedProperties.TryGetValue(PropertyName, out var adProperty)) return adProperty.OfType(); else return Enumerable.Empty(); diff --git a/Disco.Services/Interop/ActiveDirectory/ActiveDirectory.cs b/Disco.Services/Interop/ActiveDirectory/ActiveDirectory.cs index cbea9893..0390d410 100644 --- a/Disco.Services/Interop/ActiveDirectory/ActiveDirectory.cs +++ b/Disco.Services/Interop/ActiveDirectory/ActiveDirectory.cs @@ -79,8 +79,7 @@ namespace Disco.Services.Interop.ActiveDirectory if (string.IsNullOrWhiteSpace(Term)) throw new ArgumentNullException("Term"); - ADDomain searchDomain; - var term = RelevantSearchTerm(Term, out searchDomain); + var term = RelevantSearchTerm(Term, out var searchDomain); if (string.IsNullOrWhiteSpace(term)) return Enumerable.Empty(); @@ -139,8 +138,7 @@ namespace Disco.Services.Interop.ActiveDirectory if (string.IsNullOrWhiteSpace(Term)) throw new ArgumentNullException("Term"); - ADDomain searchDomain; - var term = RelevantSearchTerm(Term, out searchDomain); + var term = RelevantSearchTerm(Term, out var searchDomain); if (string.IsNullOrWhiteSpace(term)) return Enumerable.Empty(); @@ -200,10 +198,8 @@ namespace Disco.Services.Interop.ActiveDirectory } public static string ParseDomainAccountId(string AccountId, string AccountDomain) { - string accountUsername; - ADDomain domain; - return ParseDomainAccountId(AccountId, AccountDomain, out accountUsername, out domain); + return ParseDomainAccountId(AccountId, AccountDomain, out _, out _); } public static string ParseDomainAccountId(string AccountId, out string AccountUsername) { @@ -211,9 +207,7 @@ namespace Disco.Services.Interop.ActiveDirectory } public static string ParseDomainAccountId(string AccountId, string AccountDomain, out string AccountUsername) { - ADDomain domain; - - return ParseDomainAccountId(AccountId, AccountDomain, out AccountUsername, out domain); + return ParseDomainAccountId(AccountId, AccountDomain, out AccountUsername, out _); } public static string ParseDomainAccountId(string AccountId, out ADDomain Domain) { @@ -221,9 +215,7 @@ namespace Disco.Services.Interop.ActiveDirectory } public static string ParseDomainAccountId(string AccountId, string AccountDomain, out ADDomain Domain) { - string accountUsername; - - return ParseDomainAccountId(AccountId, AccountDomain, out accountUsername, out Domain); + return ParseDomainAccountId(AccountId, AccountDomain, out _, out Domain); } public static string ParseDomainAccountId(string AccountId, out string AccountUsername, out ADDomain Domain) { @@ -258,22 +250,15 @@ namespace Disco.Services.Interop.ActiveDirectory public static bool IsValidDomainAccountId(string AccountId) { - string accountUsername; - ADDomain domain; - - return IsValidDomainAccountId(AccountId, out accountUsername, out domain); + return IsValidDomainAccountId(AccountId, out _, out _); } public static bool IsValidDomainAccountId(string AccountId, out string AccountUsername) { - ADDomain domain; - - return IsValidDomainAccountId(AccountId, out AccountUsername, out domain); + return IsValidDomainAccountId(AccountId, out AccountUsername, out _); } public static bool IsValidDomainAccountId(string AccountId, out ADDomain Domain) { - string accountUsername; - - return IsValidDomainAccountId(AccountId, out accountUsername, out Domain); + return IsValidDomainAccountId(AccountId, out _, out Domain); } public static bool IsValidDomainAccountId(string AccountId, out string AccountUsername, out ADDomain Domain) { diff --git a/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryContext.cs b/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryContext.cs index 8392fae7..29c310bb 100644 --- a/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryContext.cs +++ b/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryContext.cs @@ -137,8 +137,7 @@ namespace Disco.Services.Interop.ActiveDirectory } public ADDomain GetDomainFromDistinguishedName(string DistinguishedName) { - ADDomain domain; - if (!TryGetDomainFromDistinguishedName(DistinguishedName, out domain)) + if (!TryGetDomainFromDistinguishedName(DistinguishedName, out var domain)) throw new ArgumentException($"The distinguished name is from an unknown domain: [{DistinguishedName}]", "DistinguishedName"); return domain; } @@ -150,8 +149,7 @@ namespace Disco.Services.Interop.ActiveDirectory } public ADDomain GetDomainByNetBiosName(string NetBiosName) { - ADDomain domain; - if (!TryGetDomainByNetBiosName(NetBiosName, out domain)) + if (!TryGetDomainByNetBiosName(NetBiosName, out var domain)) throw new ArgumentException($"The domain for specified NetBios name is unknown [{NetBiosName}]", "NetBiosName"); return domain; } @@ -163,8 +161,7 @@ namespace Disco.Services.Interop.ActiveDirectory } public ADDomain GetDomainByName(string Name) { - ADDomain domain; - if (!TryGetDomainByName(Name, out domain)) + if (!TryGetDomainByName(Name, out var domain)) throw new ArgumentException($"The domain for specified DNS name is unknown [{Name}]", "Name"); return domain; } @@ -176,8 +173,7 @@ namespace Disco.Services.Interop.ActiveDirectory } public ADDomain GetDomainFromSecurityIdentifier(SecurityIdentifier SecurityIdentifier) { - ADDomain domain; - if (!TryGetDomainFromSecurityIdentifier(SecurityIdentifier, out domain)) + if (!TryGetDomainFromSecurityIdentifier(SecurityIdentifier, out var domain)) throw new ArgumentException($"The domain for specified Security Identifier is unknown [{SecurityIdentifier.ToString()}]", "SecurityIdentifier"); return domain; } @@ -328,8 +324,7 @@ namespace Disco.Services.Interop.ActiveDirectory .Distinct() .Select(c => { - ADDomain d; - if (TryGetDomainFromDistinguishedName(c, out d)) + if (TryGetDomainFromDistinguishedName(c, out var d)) return Tuple.Create(d, c); else return null; diff --git a/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryGroupCache.cs b/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryGroupCache.cs index 9f3cc8cd..f7da4093 100644 --- a/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryGroupCache.cs +++ b/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryGroupCache.cs @@ -104,30 +104,28 @@ namespace Disco.Services.Interop.ActiveDirectory private Tuple TryDistinguishedNameCache(string DistinguishedName) { - Tuple groupRecord; - if (distinguishedNameCache.TryGetValue(DistinguishedName, out groupRecord)) + if (distinguishedNameCache.TryGetValue(DistinguishedName, out var groupRecord)) { if (groupRecord.Item2 > DateTime.Now) return groupRecord; else { if (distinguishedNameCache.TryRemove(DistinguishedName, out groupRecord)) - securityIdentifierCache.TryRemove(groupRecord.Item1.SecurityIdentifier, out groupRecord); + securityIdentifierCache.TryRemove(groupRecord.Item1.SecurityIdentifier, out _); } } return null; } private Tuple TrySecurityIdentifierCache(SecurityIdentifier SecurityIdentifier) { - Tuple groupRecord; - if (securityIdentifierCache.TryGetValue(SecurityIdentifier, out groupRecord)) + if (securityIdentifierCache.TryGetValue(SecurityIdentifier, out var groupRecord)) { if (groupRecord.Item2 > DateTime.Now) return groupRecord; else { if (securityIdentifierCache.TryRemove(SecurityIdentifier, out groupRecord)) - distinguishedNameCache.TryRemove(groupRecord.Item1.DistinguishedName, out groupRecord); + distinguishedNameCache.TryRemove(groupRecord.Item1.DistinguishedName, out _); } } return null; @@ -191,12 +189,11 @@ namespace Disco.Services.Interop.ActiveDirectory var dnKeys = distinguishedNameCache.Keys.ToArray(); foreach (var dnKey in dnKeys) { - Tuple groupRecord; - if (distinguishedNameCache.TryGetValue(dnKey, out groupRecord)) + if (distinguishedNameCache.TryGetValue(dnKey, out var groupRecord)) { if (groupRecord.Item2 <= now) { - distinguishedNameCache.TryRemove(dnKey, out groupRecord); + distinguishedNameCache.TryRemove(dnKey, out _); } } } @@ -205,12 +202,11 @@ namespace Disco.Services.Interop.ActiveDirectory var siKeys = securityIdentifierCache.Keys.ToArray(); foreach (var siKey in siKeys) { - Tuple groupRecord; - if (securityIdentifierCache.TryGetValue(siKey, out groupRecord)) + if (securityIdentifierCache.TryGetValue(siKey, out var groupRecord)) { if (groupRecord.Item2 <= now) { - securityIdentifierCache.TryRemove(siKey, out groupRecord); + securityIdentifierCache.TryRemove(siKey, out _); } } } diff --git a/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryManagedGroups.cs b/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryManagedGroups.cs index 13e3946c..98561cab 100644 --- a/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryManagedGroups.cs +++ b/Disco.Services/Interop/ActiveDirectory/ActiveDirectoryManagedGroups.cs @@ -51,9 +51,8 @@ namespace Disco.Services.Interop.ActiveDirectory } public bool Remove(string Key) { - ADManagedGroup item; - if (managedGroups.TryRemove(Key, out item)) + if (managedGroups.TryRemove(Key, out var item)) { item.Dispose(); return true; @@ -123,8 +122,7 @@ namespace Disco.Services.Interop.ActiveDirectory .GroupBy(a => a.ManagedGroup) .Where(g => { - ADManagedGroup item; - if (managedGroups.TryGetValue(g.Key.Key, out item)) + if (managedGroups.TryGetValue(g.Key.Key, out var item)) return item == g.Key; else return false; @@ -171,12 +169,9 @@ namespace Disco.Services.Interop.ActiveDirectory // Discard non-existent users var actionItems = actionGroup.Item2.Select(a => { - string distinguishedName; - if (!accountDNCache.TryGetValue(a.MemberId, out distinguishedName)) + if (!accountDNCache.TryGetValue(a.MemberId, out var distinguishedName)) { - string memberUsername; - ADDomain memberDomain; - if (!ActiveDirectory.IsValidDomainAccountId(a.MemberId, out memberUsername, out memberDomain)) + if (!ActiveDirectory.IsValidDomainAccountId(a.MemberId, out var memberUsername, out var memberDomain)) { accountDNCache[a.MemberId] = null; // Add to cache (avoid retries) return null; @@ -333,12 +328,9 @@ namespace Disco.Services.Interop.ActiveDirectory g.Item1, g.Item2.Select(a => { - Tuple definition; - if (!accountDNCache.TryGetValue(a.MemberId, out definition)) + if (!accountDNCache.TryGetValue(a.MemberId, out var definition)) { - string memberUsername; - ADDomain memberDomain; - if (!ActiveDirectory.IsValidDomainAccountId(a.MemberId, out memberUsername, out memberDomain)) + if (!ActiveDirectory.IsValidDomainAccountId(a.MemberId, out var memberUsername, out var memberDomain)) { accountDNCache[a.MemberId] = null; // Add to cache (avoid retries) return null; diff --git a/Disco.Services/Interop/DiscoServices/PluginLibrary.cs b/Disco.Services/Interop/DiscoServices/PluginLibrary.cs index f37a8079..13d08848 100644 --- a/Disco.Services/Interop/DiscoServices/PluginLibrary.cs +++ b/Disco.Services/Interop/DiscoServices/PluginLibrary.cs @@ -122,9 +122,7 @@ namespace Disco.Services.Interop.DiscoServices public static bool IsCompatible(this PluginLibraryIncompatibility IncompatibilityLibrary, PluginLibraryItemReleaseV2 Release) { - PluginIncompatibility incompatibility; - - return IsCompatible(IncompatibilityLibrary, Release, out incompatibility); + return IsCompatible(IncompatibilityLibrary, Release, out _); } public static bool IsCompatible(this PluginLibraryIncompatibility IncompatibilityLibrary, PluginLibraryItemReleaseV2 Release, out PluginIncompatibility Incompatibility) @@ -134,9 +132,7 @@ namespace Disco.Services.Interop.DiscoServices public static bool IsCompatible(this PluginLibraryIncompatibility IncompatibilityLibrary, string PluginId, Version Version) { - PluginIncompatibility incompatibility; - - return IsCompatible(IncompatibilityLibrary, PluginId, Version, out incompatibility); + return IsCompatible(IncompatibilityLibrary, PluginId, Version, out _); } public static bool IsCompatible(this PluginLibraryIncompatibility IncompatibilityLibrary, string PluginId, Version Version, out PluginIncompatibility Incompatibility) diff --git a/Disco.Services/Jobs/JobActionExtensions.cs b/Disco.Services/Jobs/JobActionExtensions.cs index 1bf0f8ab..5af81622 100644 --- a/Disco.Services/Jobs/JobActionExtensions.cs +++ b/Disco.Services/Jobs/JobActionExtensions.cs @@ -705,9 +705,7 @@ namespace Disco.Services #region Force Close public static bool CanCloseForced(this Job j) { - List reasons; - - return CanCloseForced(j, out reasons); + return CanCloseForced(j, out _); } public static bool CanCloseForced(this Job j, out List Reasons) { diff --git a/Disco.Services/Jobs/JobQueues/Cache.cs b/Disco.Services/Jobs/JobQueues/Cache.cs index abc224a8..d3113ad8 100644 --- a/Disco.Services/Jobs/JobQueues/Cache.cs +++ b/Disco.Services/Jobs/JobQueues/Cache.cs @@ -76,9 +76,8 @@ namespace Disco.Services.Jobs.JobQueues public JobQueueToken UpdateQueue(JobQueue JobQueue) { var token = JobQueueToken.FromJobQueue(JobQueue); - JobQueueToken existingToken; - if (_Cache.TryGetValue(JobQueue.Id, out existingToken)) + if (_Cache.TryGetValue(JobQueue.Id, out var existingToken)) { if (_Cache.TryUpdate(JobQueue.Id, token, existingToken)) { @@ -103,8 +102,7 @@ namespace Disco.Services.Jobs.JobQueues } public bool RemoveQueue(int JobQueueId) { - JobQueueToken token; - if (_Cache.TryRemove(JobQueueId, out token)) + if (_Cache.TryRemove(JobQueueId, out _)) { CalculateSubjectCache(); return true; @@ -116,8 +114,7 @@ namespace Disco.Services.Jobs.JobQueues } public JobQueueToken GetQueue(int JobQueueId) { - JobQueueToken token; - if (_Cache.TryGetValue(JobQueueId, out token)) + if (_Cache.TryGetValue(JobQueueId, out var token)) return token; else return null; @@ -128,8 +125,7 @@ namespace Disco.Services.Jobs.JobQueues } private IEnumerable GetQueuesForSubject(string SubjectId) { - List tokens; - if (_SubjectCache.TryGetValue(SubjectId, out tokens)) + if (_SubjectCache.TryGetValue(SubjectId, out var tokens)) return tokens; else return Enumerable.Empty(); diff --git a/Disco.Services/Jobs/JobQueues/JobQueueService.cs b/Disco.Services/Jobs/JobQueues/JobQueueService.cs index 9c24c431..8180197e 100644 --- a/Disco.Services/Jobs/JobQueues/JobQueueService.cs +++ b/Disco.Services/Jobs/JobQueues/JobQueueService.cs @@ -14,7 +14,7 @@ namespace Disco.Services.Jobs.JobQueues { public static class JobQueueService { - private const string _cacheHttpRequestKey = "Disco_UserQueuesToken_{0}"; + private const string _cacheHttpRequestKey = "Disco_UserQueuesToken"; private static Cache _cache; public static void Initialize(DiscoDataContext Database) @@ -168,21 +168,19 @@ namespace Disco.Services.Jobs.JobQueues } public static ReadOnlyCollection UsersQueues(AuthorizationToken UserAuthorization) { - string cacheKey = string.Format(_cacheHttpRequestKey, UserAuthorization.User.UserId); ReadOnlyCollection tokens = null; // Check for ASP.NET if (HttpContext.Current != null) - { tokens = (ReadOnlyCollection)HttpContext.Current.Items[_cacheHttpRequestKey]; - } if (tokens == null) { var subjectIds = (new string[] { UserAuthorization.User.UserId }).Concat(UserAuthorization.GroupMembership); tokens = _cache.GetQueuesForSubject(subjectIds); - HttpContext.Current.Items[_cacheHttpRequestKey] = tokens; + if (HttpContext.Current != null) + HttpContext.Current.Items[_cacheHttpRequestKey] = tokens; } return tokens; diff --git a/Disco.Services/Jobs/JobUpdatesHub.cs b/Disco.Services/Jobs/JobUpdatesHub.cs index ef4a1403..413e2644 100644 --- a/Disco.Services/Jobs/JobUpdatesHub.cs +++ b/Disco.Services/Jobs/JobUpdatesHub.cs @@ -53,14 +53,13 @@ namespace Disco.Services.Jobs public override Task OnConnected() { - int jobId; string jobIdParam; jobIdParam = Context.QueryString["JobId"]; if (string.IsNullOrWhiteSpace(jobIdParam)) throw new ArgumentNullException("JobId"); - if (!int.TryParse(jobIdParam, out jobId)) + if (!int.TryParse(jobIdParam, out var jobId)) throw new ArgumentException("An integer was expected", "JobId"); var userAuth = UserService.GetAuthorization(Context.User.Identity.Name); diff --git a/Disco.Services/Jobs/Noticeboards/HeldDevices.cs b/Disco.Services/Jobs/Noticeboards/HeldDevices.cs index 6cff6396..5769096e 100644 --- a/Disco.Services/Jobs/Noticeboards/HeldDevices.cs +++ b/Disco.Services/Jobs/Noticeboards/HeldDevices.cs @@ -198,8 +198,7 @@ namespace Disco.Services.Jobs.Noticeboards .ToDictionary(dsn => dsn, dsn => { - IHeldDeviceItem item; - items.TryGetValue(dsn, out item); + items.TryGetValue(dsn, out var item); return item; }); diff --git a/Disco.Services/Jobs/Noticeboards/HeldDevicesForUsers.cs b/Disco.Services/Jobs/Noticeboards/HeldDevicesForUsers.cs index 86aaa90c..0c9989e7 100644 --- a/Disco.Services/Jobs/Noticeboards/HeldDevicesForUsers.cs +++ b/Disco.Services/Jobs/Noticeboards/HeldDevicesForUsers.cs @@ -27,8 +27,7 @@ namespace Disco.Services.Jobs.Noticeboards .ToDictionary(userId => userId, userId => { - IHeldDeviceItem item; - items.TryGetValue(userId, out item); + items.TryGetValue(userId, out var item); return item; }); diff --git a/Disco.Services/Logging/LogContext.cs b/Disco.Services/Logging/LogContext.cs index 3f9241b6..e7183c91 100644 --- a/Disco.Services/Logging/LogContext.cs +++ b/Disco.Services/Logging/LogContext.cs @@ -72,8 +72,7 @@ namespace Disco.Services.Logging foreach (var module in LogModules) { // Update/Insert Module - Models.LogModule dbModule; - if (existingModules.TryGetValue(module.Key, out dbModule)) + if (existingModules.TryGetValue(module.Key, out var dbModule)) { // Update if (dbModule.Name != module.Value.ModuleName) @@ -96,8 +95,7 @@ namespace Disco.Services.Logging Dictionary existingEventTypes = (dbModule.EventTypes == null) ? new Dictionary() : dbModule.EventTypes.ToDictionary(et => et.Id); foreach (var eventType in module.Value.EventTypes) { - Models.LogEventType dbEventType; - if (existingEventTypes.TryGetValue(eventType.Key, out dbEventType)) + if (existingEventTypes.TryGetValue(eventType.Key, out var dbEventType)) { // Update if (dbEventType.Name != eventType.Value.Name) @@ -253,11 +251,9 @@ namespace Disco.Services.Logging public void Log(int ModuleId, int EventTypeId, params object[] Args) { - LogBase logModule; - if (LogModules.TryGetValue(ModuleId, out logModule)) + if (LogModules.TryGetValue(ModuleId, out var logModule)) { - Models.LogEventType eventType; - if (logModule.EventTypes.TryGetValue(EventTypeId, out eventType)) + if (logModule.EventTypes.TryGetValue(EventTypeId, out var eventType)) { var eventTimestamp = DateTime.Now; if (eventType.UseLive) diff --git a/Disco.Services/Logging/ReadLogContext.cs b/Disco.Services/Logging/ReadLogContext.cs index 033a0cf5..bb224d47 100644 --- a/Disco.Services/Logging/ReadLogContext.cs +++ b/Disco.Services/Logging/ReadLogContext.cs @@ -103,8 +103,7 @@ namespace Disco.Services.Logging List logYears = new List(); foreach (var directoryName in logDirectoryBaseInfo.GetDirectories()) { - int directoryYear; - if (int.TryParse(directoryName.Name, out directoryYear)) + if (int.TryParse(directoryName.Name, out _)) { logYears.Add(directoryName.Name); } diff --git a/Disco.Services/Plugins/Features/UIExtension/UIExtensions.cs b/Disco.Services/Plugins/Features/UIExtension/UIExtensions.cs index 337a21d3..e2d3d442 100644 --- a/Disco.Services/Plugins/Features/UIExtension/UIExtensions.cs +++ b/Disco.Services/Plugins/Features/UIExtension/UIExtensions.cs @@ -17,8 +17,7 @@ namespace Disco.Services.Plugins.Features.UIExtension private static List GetUIModelRegistrations() where UIModel : BaseUIModel { Type uiModelType = typeof(UIModel); - List modelRegistrations; - if (!_registrations.TryGetValue(uiModelType, out modelRegistrations)) + if (!_registrations.TryGetValue(uiModelType, out var modelRegistrations)) { lock (_registrations) { diff --git a/Disco.Services/Plugins/InstallPluginTask.cs b/Disco.Services/Plugins/InstallPluginTask.cs index 6e93f3de..9ca76f5f 100644 --- a/Disco.Services/Plugins/InstallPluginTask.cs +++ b/Disco.Services/Plugins/InstallPluginTask.cs @@ -88,8 +88,7 @@ namespace Disco.Services.Plugins // Check for Compatibility var libraryIncompatibility = PluginLibrary.LoadManifest(database).LoadIncompatibilityData(); - PluginIncompatibility incompatibility; - if (!libraryIncompatibility.IsCompatible(packageManifest.Id, packageManifest.Version, out incompatibility)) + if (!libraryIncompatibility.IsCompatible(packageManifest.Id, packageManifest.Version, out var incompatibility)) throw new InvalidOperationException($"The plugin [{packageManifest.Id} v{packageManifest.VersionFormatted}] is not compatible: {incompatibility.Reason}"); // Force Delete of Existing Folder diff --git a/Disco.Services/Plugins/PluginManifest.cs b/Disco.Services/Plugins/PluginManifest.cs index 768cc5ae..bc769891 100644 --- a/Disco.Services/Plugins/PluginManifest.cs +++ b/Disco.Services/Plugins/PluginManifest.cs @@ -512,9 +512,8 @@ namespace Disco.Services.Plugins var resourcePath = Path.Combine(PluginLocation, "WebResources", Resource.Replace(@"/", @"\")); - Tuple resourceHash; string resourceKey = $"{Name}://{Resource}"; - if (WebResourceHashes.TryGetValue(resourceKey, out resourceHash)) + if (WebResourceHashes.TryGetValue(resourceKey, out var resourceHash)) { #if DEBUG var fileDateCheck = System.IO.File.GetLastWriteTime(resourcePath); diff --git a/Disco.Services/Plugins/Plugins.cs b/Disco.Services/Plugins/Plugins.cs index b777eb52..43efc4e6 100644 --- a/Disco.Services/Plugins/Plugins.cs +++ b/Disco.Services/Plugins/Plugins.cs @@ -49,9 +49,7 @@ namespace Disco.Services.Plugins { if (_PluginManifests == null) throw new InvalidOperationException("Plugins have not been initialized"); - - PluginManifest manifest; - return _PluginManifests.TryGetValue(PluginId, out manifest); + return _PluginManifests.TryGetValue(PluginId, out _); } public static PluginManifest GetPlugin(string PluginId, Type ContainsCategoryType) @@ -59,8 +57,7 @@ namespace Disco.Services.Plugins if (_PluginManifests == null) throw new InvalidOperationException("Plugins have not been initialized"); - PluginManifest manifest; - if (_PluginManifests.TryGetValue(PluginId, out manifest)) + if (_PluginManifests.TryGetValue(PluginId, out var manifest)) { if (ContainsCategoryType == null) return manifest; @@ -87,8 +84,7 @@ namespace Disco.Services.Plugins if (_PluginManifests == null) return false; - PluginManifest manifest; - if (_PluginManifests.TryGetValue(PluginId, out manifest)) + if (_PluginManifests.TryGetValue(PluginId, out var manifest)) { if (ContainsCategoryType == null) { @@ -123,8 +119,7 @@ namespace Disco.Services.Plugins if (_PluginAssemblyManifests == null) throw new InvalidOperationException("Plugins have not been initialized"); - PluginManifest manifest; - if (_PluginAssemblyManifests.TryGetValue(PluginAssembly, out manifest)) + if (_PluginAssemblyManifests.TryGetValue(PluginAssembly, out var manifest)) { return manifest; } @@ -135,19 +130,14 @@ namespace Disco.Services.Plugins } public static bool TryGetPlugin(Assembly PluginAssembly, out PluginManifest PluginManifest) { - PluginManifest = null; - - if (_PluginAssemblyManifests == null) - return false; - - PluginManifest manifest; - if (_PluginAssemblyManifests.TryGetValue(PluginAssembly, out manifest)) + if (_PluginAssemblyManifests?.TryGetValue(PluginAssembly, out var manifest) ?? false) { PluginManifest = manifest; return true; } else { + PluginManifest = null; return false; } } @@ -252,8 +242,7 @@ namespace Disco.Services.Plugins if (FeatureCategoryType == null) throw new ArgumentNullException("FeatureType"); - string displayName; - if (FeatureCategoryDisplayNames.TryGetValue(FeatureCategoryType, out displayName)) + if (FeatureCategoryDisplayNames.TryGetValue(FeatureCategoryType, out var displayName)) return displayName; else throw new InvalidOperationException($"Unknown Plugin Feature Category Type: [{FeatureCategoryType.Name}]"); diff --git a/Disco.Services/Plugins/UpdatePluginTask.cs b/Disco.Services/Plugins/UpdatePluginTask.cs index ff9238f2..c96c0fa5 100644 --- a/Disco.Services/Plugins/UpdatePluginTask.cs +++ b/Disco.Services/Plugins/UpdatePluginTask.cs @@ -96,7 +96,6 @@ namespace Disco.Services.Plugins public static List OfflineInstalledPlugins(DiscoDataContext Database) { string pluginsLocation = Database.DiscoConfiguration.PluginsLocation; - string pluginsStorageLocation = Database.DiscoConfiguration.PluginStorageLocation; List installedPluginManifests = new List(); @@ -245,8 +244,7 @@ namespace Disco.Services.Plugins { // Check for Compatibility var incompatibilityLibrary = PluginLibrary.LoadManifest(database).LoadIncompatibilityData(); - PluginIncompatibility incompatibility; - if (!incompatibilityLibrary.IsCompatible(updateManifest.Id, updateManifest.Version, out incompatibility)) + if (!incompatibilityLibrary.IsCompatible(updateManifest.Id, updateManifest.Version, out var incompatibility)) throw new InvalidOperationException($"The plugin [{updateManifest.Id} v{updateManifest.VersionFormatted}] is not compatible: {incompatibility.Reason}"); var updatePluginPath = Path.Combine(database.DiscoConfiguration.PluginsLocation, $"{updateManifest.Id}.discoPlugin"); diff --git a/Disco.Services/Searching/Search.cs b/Disco.Services/Searching/Search.cs index 79e11904..3254668a 100644 --- a/Disco.Services/Searching/Search.cs +++ b/Disco.Services/Searching/Search.cs @@ -17,13 +17,12 @@ namespace Disco.Services.Searching #region Jobs public static List SearchJobs(DiscoDataContext Database, string Term, int? LimitCount = ActiveDirectory.DefaultSearchResultLimit) { - int termInt = default(int); IQueryable query = default(IQueryable); string userIdTerm = Term.Contains('\\') ? Term : ActiveDirectory.ParseDomainAccountId(Term); - if (int.TryParse(Term, out termInt)) + if (int.TryParse(Term, out var termInt)) { // Term is a Number (int) query = Database.Jobs.Where(j => @@ -198,8 +197,7 @@ namespace Disco.Services.Searching // Update DB Results dbResults.ForEach(u => { - UserSearchResultItem adResult; - if (adResultsIndexed.TryGetValue(u.Id, out adResult)) + if (adResultsIndexed.TryGetValue(u.Id, out var adResult)) { u.Surname = adResult.Surname; u.GivenName = adResult.GivenName; diff --git a/Disco.Services/Users/Cache.cs b/Disco.Services/Users/Cache.cs index b55c982b..a796e3d9 100644 --- a/Disco.Services/Users/Cache.cs +++ b/Disco.Services/Users/Cache.cs @@ -143,13 +143,12 @@ namespace Disco.Services.Users { var cache = _Cache; - Tuple record; - if (cache.TryGetValue(UserId, out record)) + if (cache.TryGetValue(UserId, out var record)) { if (record.Item3 > DateTime.Now) return record; else - cache.TryRemove(UserId, out record); + cache.TryRemove(UserId, out _); } return null; } @@ -158,11 +157,10 @@ namespace Disco.Services.Users { var cache = _Cache; - Tuple record = new Tuple(Record.Item1, Record.Item2, DateTime.Now.AddTicks(CacheTimeoutTicks)); + var record = new Tuple(Record.Item1, Record.Item2, DateTime.Now.AddTicks(CacheTimeoutTicks)); if (cache.ContainsKey(UserId)) { - Tuple oldRecord; - if (cache.TryGetValue(UserId, out oldRecord)) + if (cache.TryGetValue(UserId, out var oldRecord)) { cache.TryUpdate(UserId, record, oldRecord); return record; @@ -174,8 +172,7 @@ namespace Disco.Services.Users internal static bool InvalidateRecord(string UserId) { - Tuple userRecord; - return _Cache.TryRemove(UserId, out userRecord); + return _Cache.TryRemove(UserId, out _); } internal static void CleanStaleCache() @@ -185,11 +182,10 @@ namespace Disco.Services.Users var userIds = cache.Keys.ToArray(); foreach (string userId in userIds) { - Tuple record; - if (cache.TryGetValue(userId, out record)) + if (cache.TryGetValue(userId, out var record)) { if (record.Item3 <= DateTime.Now) - cache.TryRemove(userId, out record); + cache.TryRemove(userId, out _); } } } diff --git a/Disco.Services/Users/UserFlags/Cache.cs b/Disco.Services/Users/UserFlags/Cache.cs index 69864273..984b0c0d 100644 --- a/Disco.Services/Users/UserFlags/Cache.cs +++ b/Disco.Services/Users/UserFlags/Cache.cs @@ -31,8 +31,7 @@ namespace Disco.Services.Users.UserFlags public UserFlag GetUserFlag(int UserFlagId) { - UserFlag item; - if (_Cache.TryGetValue(UserFlagId, out item)) + if (_Cache.TryGetValue(UserFlagId, out var item)) return item; else return null; @@ -49,8 +48,7 @@ namespace Disco.Services.Users.UserFlags public UserFlag Remove(int UserFlagId) { - UserFlag item; - if (_Cache.TryRemove(UserFlagId, out item)) + if (_Cache.TryRemove(UserFlagId, out var item)) return item; else return null; diff --git a/Disco.Services/Users/UserFlags/UserFlagUserDevicesManagedGroup.cs b/Disco.Services/Users/UserFlags/UserFlagUserDevicesManagedGroup.cs index 0bb85d34..6949b604 100644 --- a/Disco.Services/Users/UserFlags/UserFlagUserDevicesManagedGroup.cs +++ b/Disco.Services/Users/UserFlags/UserFlagUserDevicesManagedGroup.cs @@ -57,10 +57,9 @@ namespace Disco.Services.Users.UserFlags public static bool TryGetManagedGroup(UserFlag UserFlag, out UserFlagUserDevicesManagedGroup ManagedGroup) { - ADManagedGroup managedGroup; string key = GetKey(UserFlag); - if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup)) + if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out var managedGroup)) { ManagedGroup = (UserFlagUserDevicesManagedGroup)managedGroup; return true; diff --git a/Disco.Services/Users/UserFlags/UserFlagUsersManagedGroup.cs b/Disco.Services/Users/UserFlags/UserFlagUsersManagedGroup.cs index 397c1553..d19c6322 100644 --- a/Disco.Services/Users/UserFlags/UserFlagUsersManagedGroup.cs +++ b/Disco.Services/Users/UserFlags/UserFlagUsersManagedGroup.cs @@ -57,10 +57,9 @@ namespace Disco.Services.Users.UserFlags public static bool TryGetManagedGroup(UserFlag UserFlag, out UserFlagUsersManagedGroup ManagedGroup) { - ADManagedGroup managedGroup; string key = GetKey(UserFlag); - if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out managedGroup)) + if (ActiveDirectory.Context.ManagedGroups.TryGetValue(key, out var managedGroup)) { ManagedGroup = (UserFlagUsersManagedGroup)managedGroup; return true; diff --git a/Disco.Services/Web/Bundles/FileBundle.cs b/Disco.Services/Web/Bundles/FileBundle.cs index 95d7fdda..a8b0c16d 100644 --- a/Disco.Services/Web/Bundles/FileBundle.cs +++ b/Disco.Services/Web/Bundles/FileBundle.cs @@ -43,9 +43,7 @@ namespace Disco.Services.Web.Bundles throw new ArgumentNullException("Url"); if (string.IsNullOrWhiteSpace(File)) throw new ArgumentNullException("File"); - - Uri fileUri; - if (!Uri.TryCreate(File, UriKind.Absolute, out fileUri)) + if (!Uri.TryCreate(File, UriKind.Absolute, out _)) { File = HttpContext.Current.Server.MapPath(File); } diff --git a/Disco.Web/Areas/API/Controllers/DeviceBatchController.cs b/Disco.Web/Areas/API/Controllers/DeviceBatchController.cs index 9072c8f4..0b413de5 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceBatchController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceBatchController.cs @@ -295,8 +295,7 @@ namespace Disco.Web.Areas.API.Controllers throw new ArgumentNullException("PurchaseDate", "A Device Batch Purchase Date is required"); else { - DateTime ecd; - if (DateTime.TryParse(PurchaseDate, out ecd)) + if (DateTime.TryParse(PurchaseDate, out var ecd)) { deviceBatch.PurchaseDate = ecd.Date; } @@ -329,8 +328,7 @@ namespace Disco.Web.Areas.API.Controllers deviceBatch.UnitCost = null; else { - decimal unitCost; - if (decimal.TryParse(UnitCost, out unitCost)) + if (decimal.TryParse(UnitCost, out var unitCost)) { deviceBatch.UnitCost = unitCost; } @@ -347,8 +345,7 @@ namespace Disco.Web.Areas.API.Controllers deviceBatch.UnitQuantity = null; else { - int unitQuantity; - if (int.TryParse(UnitQuantity, out unitQuantity)) + if (int.TryParse(UnitQuantity, out var unitQuantity)) { deviceBatch.UnitQuantity = unitQuantity; } @@ -363,8 +360,7 @@ namespace Disco.Web.Areas.API.Controllers { if (!string.IsNullOrEmpty(DefaultDeviceModelId)) { - int bId; - if (int.TryParse(DefaultDeviceModelId, out bId)) + if (int.TryParse(DefaultDeviceModelId, out var bId)) { var dm = Database.DeviceModels.Find(bId); if (dm != null) @@ -394,8 +390,7 @@ namespace Disco.Web.Areas.API.Controllers deviceBatch.WarrantyValidUntil = null; else { - DateTime ecd; - if (DateTime.TryParse(WarrantyValidUntil, out ecd)) + if (DateTime.TryParse(WarrantyValidUntil, out var ecd)) { deviceBatch.WarrantyValidUntil = ecd.Date; } @@ -420,8 +415,7 @@ namespace Disco.Web.Areas.API.Controllers deviceBatch.InsuredDate = null; else { - DateTime ecd; - if (DateTime.TryParse(InsuredDate, out ecd)) + if (DateTime.TryParse(InsuredDate, out var ecd)) { deviceBatch.InsuredDate = ecd.Date; } @@ -446,8 +440,7 @@ namespace Disco.Web.Areas.API.Controllers deviceBatch.InsuredUntil = null; else { - DateTime ecd; - if (DateTime.TryParse(InsuredUntil, out ecd)) + if (DateTime.TryParse(InsuredUntil, out var ecd)) { deviceBatch.InsuredUntil = ecd.Date; } diff --git a/Disco.Web/Areas/API/Controllers/DeviceController.cs b/Disco.Web/Areas/API/Controllers/DeviceController.cs index b1e336b1..9c762614 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceController.cs @@ -220,8 +220,7 @@ namespace Disco.Web.Areas.API.Controllers { if (!string.IsNullOrEmpty(DeviceProfileId)) { - int pId; - if (int.TryParse(DeviceProfileId, out pId)) + if (int.TryParse(DeviceProfileId, out var pId)) { var p = Database.DeviceProfiles.Find(pId); if (p != null) @@ -248,8 +247,7 @@ namespace Disco.Web.Areas.API.Controllers { if (!string.IsNullOrEmpty(DeviceBatchId)) { - int bId; - if (int.TryParse(DeviceBatchId, out bId)) + if (int.TryParse(DeviceBatchId, out var bId)) { var b = Database.DeviceBatches.Find(bId); if (b != null) @@ -306,8 +304,7 @@ namespace Disco.Web.Areas.API.Controllers } private void UpdateAllowUnauthenticatedEnrol(Device device, string AllowUnauthenticatedEnrol) { - bool bAllowUnauthenticatedEnrol; - if (string.IsNullOrEmpty(AllowUnauthenticatedEnrol) || !bool.TryParse(AllowUnauthenticatedEnrol, out bAllowUnauthenticatedEnrol)) + if (string.IsNullOrEmpty(AllowUnauthenticatedEnrol) || !bool.TryParse(AllowUnauthenticatedEnrol, out var bAllowUnauthenticatedEnrol)) { throw new Exception("Invalid AllowUnauthenticatedEnrol Value"); } diff --git a/Disco.Web/Areas/API/Controllers/DeviceModelController.cs b/Disco.Web/Areas/API/Controllers/DeviceModelController.cs index d57926bf..50f7de3f 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceModelController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceModelController.cs @@ -158,8 +158,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(DefaultPurchaseDate, out d)) + if (DateTime.TryParse(DefaultPurchaseDate, out var d)) { deviceModel.DefaultPurchaseDate = d; } @@ -327,12 +326,11 @@ namespace Disco.Web.Areas.API.Controllers } } - decimal cost = 0; if (string.IsNullOrEmpty(Description)) Description = "?"; if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$")) Cost = Cost.Substring(Cost.IndexOf("$") + 1); - decimal.TryParse(Cost, out cost); + decimal.TryParse(Cost, out var cost); var dc = new DeviceComponent() { @@ -381,13 +379,12 @@ namespace Disco.Web.Areas.API.Controllers var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault(); if (dc != null) { - decimal cost = 0; if (string.IsNullOrEmpty(Description)) Description = "?"; if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$")) Cost = Cost.Substring(Cost.IndexOf("$") + 1); - decimal.TryParse(Cost, out cost); + decimal.TryParse(Cost, out var cost); dc.Description = Description; dc.Cost = cost; diff --git a/Disco.Web/Areas/API/Controllers/DeviceProfileController.cs b/Disco.Web/Areas/API/Controllers/DeviceProfileController.cs index 717b0071..60f624c1 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceProfileController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceProfileController.cs @@ -442,8 +442,7 @@ namespace Disco.Web.Areas.API.Controllers private void UpdateDistributionType(DeviceProfile deviceProfile, string DistributionType) { - int iDt; - if (int.TryParse(DistributionType, out iDt)) + if (int.TryParse(DistributionType, out var iDt)) { deviceProfile.DistributionType = (DeviceProfile.DistributionTypes)iDt; Database.SaveChanges(); @@ -581,8 +580,7 @@ namespace Disco.Web.Areas.API.Controllers else { // Validate - int daoId; - if (int.TryParse(DefaultOrganisationAddress, out daoId)) + if (int.TryParse(DefaultOrganisationAddress, out var daoId)) { var oa = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(daoId); if (oa != null) @@ -606,8 +604,7 @@ namespace Disco.Web.Areas.API.Controllers private void UpdateEnforceComputerNameConvention(DeviceProfile deviceProfile, string EnforceComputerNameConvention) { - bool bValue; - if (bool.TryParse(EnforceComputerNameConvention, out bValue)) + if (bool.TryParse(EnforceComputerNameConvention, out var bValue)) { deviceProfile.EnforceComputerNameConvention = bValue; @@ -619,8 +616,7 @@ namespace Disco.Web.Areas.API.Controllers private void UpdateEnforceOrganisationalUnit(DeviceProfile deviceProfile, string EnforceOrganisationalUnit) { - bool bValue; - if (bool.TryParse(EnforceOrganisationalUnit, out bValue)) + if (bool.TryParse(EnforceOrganisationalUnit, out var bValue)) { deviceProfile.EnforceOrganisationalUnit = bValue; @@ -632,8 +628,7 @@ namespace Disco.Web.Areas.API.Controllers private void UpdateProvisionADAccount(DeviceProfile deviceProfile, string ProvisionADAccount) { - bool bValue; - if (bool.TryParse(ProvisionADAccount, out bValue)) + if (bool.TryParse(ProvisionADAccount, out var bValue)) { deviceProfile.ProvisionADAccount = bValue; @@ -645,8 +640,7 @@ namespace Disco.Web.Areas.API.Controllers private void UpdateAssignedUserLocalAdmin(DeviceProfile deviceProfile, string AssignedUserLocalAdmin) { - bool bValue; - if (bool.TryParse(AssignedUserLocalAdmin, out bValue)) + if (bool.TryParse(AssignedUserLocalAdmin, out var bValue)) { deviceProfile.AssignedUserLocalAdmin = bValue; @@ -658,8 +652,7 @@ namespace Disco.Web.Areas.API.Controllers private void UpdateAllowUntrustedReimageJobEnrolment(DeviceProfile deviceProfile, string AllowUntrustedReimageJobEnrolment) { - bool bValue; - if (bool.TryParse(AllowUntrustedReimageJobEnrolment, out bValue)) + if (bool.TryParse(AllowUntrustedReimageJobEnrolment, out var bValue)) { deviceProfile.AllowUntrustedReimageJobEnrolment = bValue; diff --git a/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs b/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs index 994aa050..af5fcb91 100644 --- a/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs +++ b/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs @@ -404,8 +404,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - bool ff = default(bool); - if (bool.TryParse(FlattenForm, out ff)) + if (bool.TryParse(FlattenForm, out var ff)) documentTemplate.FlattenForm = ff; else throw new Exception("Invalid Boolean Format"); @@ -421,8 +420,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - bool value = default(bool); - if (bool.TryParse(IsHidden, out value)) + if (bool.TryParse(IsHidden, out var value)) documentTemplate.IsHidden = value; else throw new Exception("Invalid Boolean Format"); diff --git a/Disco.Web/Areas/API/Controllers/DocumentTemplatePackageController.cs b/Disco.Web/Areas/API/Controllers/DocumentTemplatePackageController.cs index 26ff9802..c2a60768 100644 --- a/Disco.Web/Areas/API/Controllers/DocumentTemplatePackageController.cs +++ b/Disco.Web/Areas/API/Controllers/DocumentTemplatePackageController.cs @@ -235,8 +235,7 @@ namespace Disco.Web.Areas.API.Controllers } private void UpdateScope(DocumentTemplatePackage Package, string Scope) { - AttachmentTypes scope; - if (!Enum.TryParse(Scope, true, out scope)) + if (!Enum.TryParse(Scope, true, out var scope)) throw new ArgumentException("Invalid Scope", nameof(Scope)); if (Package.Scope != scope) diff --git a/Disco.Web/Areas/API/Controllers/JobController.cs b/Disco.Web/Areas/API/Controllers/JobController.cs index 83fc3fb7..53d6d2b3 100644 --- a/Disco.Web/Areas/API/Controllers/JobController.cs +++ b/Disco.Web/Areas/API/Controllers/JobController.cs @@ -514,8 +514,7 @@ namespace Disco.Web.Areas.API.Controllers { if (!string.IsNullOrEmpty(ExpectedClosedDate)) { - DateTime ecd; - if (DateTime.TryParse(ExpectedClosedDate, out ecd)) + if (DateTime.TryParse(ExpectedClosedDate, out var ecd)) { ecd = job.ValidateDateAfterOpened(ecd); job.ExpectedClosedDate = ecd; @@ -574,8 +573,7 @@ namespace Disco.Web.Areas.API.Controllers flags = 0; foreach (var fs in Flags.Split(',')) { - long fi; - if (!long.TryParse(fs, out fi)) + if (!long.TryParse(fs, out var fi)) throw new Exception("Invalid Int64 Format"); else flags = flags | fi; @@ -614,8 +612,7 @@ namespace Disco.Web.Areas.API.Controllers { throw new Exception("This property can only be set for Hardware NonWarranty Jobs"); } - bool bIsInsuranceClaim; - if (string.IsNullOrEmpty(IsInsuranceClaim) || !bool.TryParse(IsInsuranceClaim, out bIsInsuranceClaim)) + if (string.IsNullOrEmpty(IsInsuranceClaim) || !bool.TryParse(IsInsuranceClaim, out var bIsInsuranceClaim)) { throw new Exception("Invalid IsInsuranceClaim Value"); } @@ -660,8 +657,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(AccountingChargeRequiredDate, out d)) + if (DateTime.TryParse(AccountingChargeRequiredDate, out var d)) { d = job.ValidateDateAfterOpened(d); job.JobMetaNonWarranty.AccountingChargeRequiredDate = d; @@ -694,8 +690,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(AccountingChargeAddedDate, out d)) + if (DateTime.TryParse(AccountingChargeAddedDate, out var d)) { d = job.ValidateDateAfterOpened(d); job.JobMetaNonWarranty.AccountingChargeAddedDate = d; @@ -728,8 +723,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(AccountingChargePaidDate, out d)) + if (DateTime.TryParse(AccountingChargePaidDate, out var d)) { d = job.ValidateDateAfterOpened(d); job.JobMetaNonWarranty.AccountingChargePaidDate = d; @@ -762,8 +756,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(PurchaseOrderRaisedDate, out d)) + if (DateTime.TryParse(PurchaseOrderRaisedDate, out var d)) { d = job.ValidateDateAfterOpened(d); job.JobMetaNonWarranty.PurchaseOrderRaisedDate = d; @@ -805,8 +798,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(PurchaseOrderSentDate, out d)) + if (DateTime.TryParse(PurchaseOrderSentDate, out var d)) { d = job.ValidateDateAfterOpened(d); job.JobMetaNonWarranty.PurchaseOrderSentDate = d; @@ -839,8 +831,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(InvoiceReceivedDate, out d)) + if (DateTime.TryParse(InvoiceReceivedDate, out var d)) { d = job.ValidateDateAfterOpened(d); job.JobMetaNonWarranty.InvoiceReceivedDate = d; @@ -898,8 +889,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(RepairerLoggedDate, out d)) + if (DateTime.TryParse(RepairerLoggedDate, out var d)) { job.JobMetaNonWarranty.RepairerLoggedDate = d; } @@ -949,8 +939,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(RepairerCompletedDate, out d)) + if (DateTime.TryParse(RepairerCompletedDate, out var d)) { job.JobMetaNonWarranty.RepairerCompletedDate = d; } @@ -987,8 +976,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(ClaimFormSentDate, out d)) + if (DateTime.TryParse(ClaimFormSentDate, out var d)) { d = job.ValidateDateAfterOpened(d); job.JobMetaInsurance.ClaimFormSentDate = d; @@ -1023,8 +1011,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime dt; - if (!DateTime.TryParse(DateOfPurchase, out dt)) + if (!DateTime.TryParse(DateOfPurchase, out var dt)) { throw new Exception("Invalid DateTime Value"); } @@ -1104,8 +1091,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime dt; - if (!DateTime.TryParse(PoliceNotifiedDate, out dt)) + if (!DateTime.TryParse(PoliceNotifiedDate, out var dt)) { throw new Exception("Invalid DateTime Value"); } @@ -1141,8 +1127,7 @@ namespace Disco.Web.Areas.API.Controllers throw new Exception("This property can only be set for Hardware NonWarranty Jobs"); } - bool b; - if (string.IsNullOrEmpty(PoliceNotified) || !bool.TryParse(PoliceNotified, out b)) + if (string.IsNullOrEmpty(PoliceNotified) || !bool.TryParse(PoliceNotified, out var b)) { throw new Exception("Invalid Boolean Value"); } @@ -1165,8 +1150,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(PropertyLastSeenDate, out d)) + if (DateTime.TryParse(PropertyLastSeenDate, out var d)) { job.JobMetaInsurance.PropertyLastSeenDate = d; } @@ -1262,8 +1246,7 @@ namespace Disco.Web.Areas.API.Controllers throw new Exception("This property can only be set for Hardware NonWarranty Jobs"); } - bool b; - if (string.IsNullOrEmpty(ThirdPartyCaused) || !bool.TryParse(ThirdPartyCaused, out b)) + if (string.IsNullOrEmpty(ThirdPartyCaused) || !bool.TryParse(ThirdPartyCaused, out var b)) { throw new Exception("Invalid Boolean Value"); } @@ -1324,8 +1307,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(LossOrDamageDate, out d)) + if (DateTime.TryParse(LossOrDamageDate, out var d)) { job.JobMetaInsurance.LossOrDamageDate = d; } @@ -1372,8 +1354,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(ExternalLoggedDate, out d)) + if (DateTime.TryParse(ExternalLoggedDate, out var d)) { job.JobMetaWarranty.ExternalLoggedDate = d; } @@ -1424,8 +1405,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - DateTime d; - if (DateTime.TryParse(ExternalCompletedDate, out d)) + if (DateTime.TryParse(ExternalCompletedDate, out var d)) { job.JobMetaWarranty.ExternalCompletedDate = d; } @@ -1495,8 +1475,7 @@ namespace Disco.Web.Areas.API.Controllers var flag = Flag.Value; var validFlags = job.ValidFlags(); - Tuple flagStatus; - if (validFlags.TryGetValue((flag < 0 ? flag * -1 : flag), out flagStatus)) + if (validFlags.TryGetValue(flag < 0 ? flag * -1 : flag, out var flagStatus)) { if (flag < 0) { // Remove Flag @@ -2067,12 +2046,11 @@ namespace Disco.Web.Areas.API.Controllers var j = Database.Jobs.Find(id); if (j != null) { - decimal cost = 0; if (string.IsNullOrEmpty(Description)) Description = "?"; if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$")) Cost = Cost.Substring(Cost.IndexOf("$") + 1); - decimal.TryParse(Cost, out cost); + decimal.TryParse(Cost, out var cost); var jc = new JobComponent() { @@ -2095,13 +2073,12 @@ namespace Disco.Web.Areas.API.Controllers var jc = Database.JobComponents.Find(id); if (jc != null) { - decimal cost = 0; if (string.IsNullOrEmpty(Description)) Description = "?"; if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$")) Cost = Cost.Substring(Cost.IndexOf("$") + 1); - decimal.TryParse(Cost, out cost); + decimal.TryParse(Cost, out var cost); jc.Description = Description; jc.Cost = cost; diff --git a/Disco.Web/Areas/API/Controllers/JobQueueController.cs b/Disco.Web/Areas/API/Controllers/JobQueueController.cs index 9d6980a4..325feb8d 100644 --- a/Disco.Web/Areas/API/Controllers/JobQueueController.cs +++ b/Disco.Web/Areas/API/Controllers/JobQueueController.cs @@ -247,9 +247,8 @@ namespace Disco.Web.Areas.API.Controllers private void UpdatePriority(JobQueue jobQueue, string Priority) { - JobQueuePriority priority; - if (!Enum.TryParse(Priority, out priority)) + if (!Enum.TryParse(Priority, out var priority)) throw new ArgumentException("Invalid Priority Value", "Priority"); jobQueue.Priority = priority; @@ -262,9 +261,8 @@ namespace Disco.Web.Areas.API.Controllers if (!string.IsNullOrEmpty(DefaultSLAExpiry)) { - int intValue; - if (!int.TryParse(DefaultSLAExpiry, out intValue)) + if (!int.TryParse(DefaultSLAExpiry, out var intValue)) throw new ArgumentException("Invalid Default SLA Expiry Value", "DefaultSLAPriority"); if (intValue < 0) diff --git a/Disco.Web/Areas/API/Controllers/JobQueueJobController.cs b/Disco.Web/Areas/API/Controllers/JobQueueJobController.cs index 7726067a..e365e288 100644 --- a/Disco.Web/Areas/API/Controllers/JobQueueJobController.cs +++ b/Disco.Web/Areas/API/Controllers/JobQueueJobController.cs @@ -142,8 +142,7 @@ namespace Disco.Web.Areas.API.Controllers if (!string.IsNullOrEmpty(Sla)) { - DateTime SLADate; - if (DateTime.TryParse(Sla, out SLADate)) + if (DateTime.TryParse(Sla, out var SLADate)) { jobQueueJob.OnEditSla(SLADate); Database.SaveChanges(); @@ -164,9 +163,8 @@ namespace Disco.Web.Areas.API.Controllers if (!jobQueueJob.CanEditPriority()) throw new InvalidOperationException("Editing Priority for job queue job is Denied"); - JobQueuePriority priority; - if (!Enum.TryParse(Priority, out priority)) + if (!Enum.TryParse(Priority, out var priority)) throw new ArgumentException("Invalid Priority Value", "Priority"); jobQueueJob.OnEditPriority(priority); diff --git a/Disco.Web/Areas/API/Controllers/SystemController.cs b/Disco.Web/Areas/API/Controllers/SystemController.cs index e6171907..b7d9b93a 100644 --- a/Disco.Web/Areas/API/Controllers/SystemController.cs +++ b/Disco.Web/Areas/API/Controllers/SystemController.cs @@ -344,9 +344,8 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorizeAny(Claims.Config.UserFlag.Configure)] public virtual ActionResult SyncActiveDirectoryManagedGroup(string id, string redirectUrl = null) { - ADManagedGroup managedGroup; - if (!ActiveDirectory.Context.ManagedGroups.TryGetValue(id, out managedGroup)) + if (!ActiveDirectory.Context.ManagedGroups.TryGetValue(id, out var managedGroup)) throw new ArgumentException("Unknown Managed Group Key"); var taskStatus = ADManagedGroupsSyncTask.ScheduleSync(managedGroup); diff --git a/Disco.Web/Areas/API/Controllers/UserFlagController.cs b/Disco.Web/Areas/API/Controllers/UserFlagController.cs index 14cd8570..5b6ee2df 100644 --- a/Disco.Web/Areas/API/Controllers/UserFlagController.cs +++ b/Disco.Web/Areas/API/Controllers/UserFlagController.cs @@ -313,8 +313,7 @@ namespace Disco.Web.Areas.API.Controllers if (UserFlag.UsersLinkedGroup != null) { // Sync Group - UserFlagUsersManagedGroup managedGroup; - if (UserFlagUsersManagedGroup.TryGetManagedGroup(UserFlag, out managedGroup)) + if (UserFlagUsersManagedGroup.TryGetManagedGroup(UserFlag, out var managedGroup)) { return ADManagedGroupsSyncTask.ScheduleSync(managedGroup); } @@ -335,8 +334,7 @@ namespace Disco.Web.Areas.API.Controllers if (UserFlag.UserDevicesLinkedGroup != null) { // Sync Group - UserFlagUserDevicesManagedGroup managedGroup; - if (UserFlagUserDevicesManagedGroup.TryGetManagedGroup(UserFlag, out managedGroup)) + if (UserFlagUserDevicesManagedGroup.TryGetManagedGroup(UserFlag, out var managedGroup)) { return ADManagedGroupsSyncTask.ScheduleSync(managedGroup); } diff --git a/Disco.Web/Areas/Config/Controllers/DeviceBatchController.cs b/Disco.Web/Areas/Config/Controllers/DeviceBatchController.cs index ef1aeaba..8e7f4927 100644 --- a/Disco.Web/Areas/Config/Controllers/DeviceBatchController.cs +++ b/Disco.Web/Areas/Config/Controllers/DeviceBatchController.cs @@ -41,11 +41,9 @@ namespace Disco.Web.Areas.Config.Controllers DeviceDecommissionedCount = dG.Count(d => d.DecommissionedDate.HasValue) }).ToArray().Cast().ToList(); - DeviceBatchAssignedUsersManagedGroup assignedUsersManagedGroup; - if (DeviceBatchAssignedUsersManagedGroup.TryGetManagedGroup(m.DeviceBatch, out assignedUsersManagedGroup)) + if (DeviceBatchAssignedUsersManagedGroup.TryGetManagedGroup(m.DeviceBatch, out var assignedUsersManagedGroup)) m.AssignedUsersLinkedGroup = assignedUsersManagedGroup; - DeviceBatchDevicesManagedGroup devicesManagedGroup; - if (DeviceBatchDevicesManagedGroup.TryGetManagedGroup(m.DeviceBatch, out devicesManagedGroup)) + if (DeviceBatchDevicesManagedGroup.TryGetManagedGroup(m.DeviceBatch, out var devicesManagedGroup)) m.DevicesLinkedGroup = devicesManagedGroup; m.CanDelete = m.DeviceBatch.CanDelete(Database); diff --git a/Disco.Web/Areas/Config/Controllers/DeviceProfileController.cs b/Disco.Web/Areas/Config/Controllers/DeviceProfileController.cs index cc869834..5bf4c632 100644 --- a/Disco.Web/Areas/Config/Controllers/DeviceProfileController.cs +++ b/Disco.Web/Areas/Config/Controllers/DeviceProfileController.cs @@ -39,11 +39,9 @@ namespace Disco.Web.Areas.Config.Controllers if (m.DeviceProfile.DefaultOrganisationAddress.HasValue) m.DefaultOrganisationAddress = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(m.DeviceProfile.DefaultOrganisationAddress.Value); - DeviceProfileAssignedUsersManagedGroup assignedUsersManagedGroup; - if (DeviceProfileAssignedUsersManagedGroup.TryGetManagedGroup(m.DeviceProfile, out assignedUsersManagedGroup)) + if (DeviceProfileAssignedUsersManagedGroup.TryGetManagedGroup(m.DeviceProfile, out var assignedUsersManagedGroup)) m.AssignedUsersLinkedGroup = assignedUsersManagedGroup; - DeviceProfileDevicesManagedGroup devicesManagedGroup; - if (DeviceProfileDevicesManagedGroup.TryGetManagedGroup(m.DeviceProfile, out devicesManagedGroup)) + if (DeviceProfileDevicesManagedGroup.TryGetManagedGroup(m.DeviceProfile, out var devicesManagedGroup)) m.DevicesLinkedGroup = devicesManagedGroup; // Ensure Specified OU Exists diff --git a/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs b/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs index ffdb7626..03791514 100644 --- a/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs +++ b/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs @@ -61,11 +61,9 @@ namespace Disco.Web.Areas.Config.Controllers m.TemplateExpressions = m.DocumentTemplate.ExtractPdfExpressions(Database); m.UpdateModel(Database); - DocumentTemplateDevicesManagedGroup devicesManagedGroup; - if (DocumentTemplateDevicesManagedGroup.TryGetManagedGroup(m.DocumentTemplate, out devicesManagedGroup)) + if (DocumentTemplateDevicesManagedGroup.TryGetManagedGroup(m.DocumentTemplate, out var devicesManagedGroup)) m.DevicesLinkedGroup = devicesManagedGroup; - DocumentTemplateUsersManagedGroup usersManagedGroup; - if (DocumentTemplateUsersManagedGroup.TryGetManagedGroup(m.DocumentTemplate, out usersManagedGroup)) + if (DocumentTemplateUsersManagedGroup.TryGetManagedGroup(m.DocumentTemplate, out var usersManagedGroup)) m.UsersLinkedGroup = usersManagedGroup; m.BulkGenerateDownloadId = bulkGenerateId; diff --git a/Disco.Web/Areas/Config/Controllers/UserFlagController.cs b/Disco.Web/Areas/Config/Controllers/UserFlagController.cs index 4b09c87f..dc2e84ef 100644 --- a/Disco.Web/Areas/Config/Controllers/UserFlagController.cs +++ b/Disco.Web/Areas/Config/Controllers/UserFlagController.cs @@ -36,11 +36,9 @@ namespace Disco.Web.Areas.Config.Controllers if (m == null) throw new ArgumentException("Invalid User Flag Id"); - UserFlagUsersManagedGroup assignedUsersManagedGroup; - if (UserFlagUsersManagedGroup.TryGetManagedGroup(m.UserFlag, out assignedUsersManagedGroup)) + if (UserFlagUsersManagedGroup.TryGetManagedGroup(m.UserFlag, out var assignedUsersManagedGroup)) m.UsersLinkedGroup = assignedUsersManagedGroup; - UserFlagUserDevicesManagedGroup assignedUserDevicesManagedGroup; - if (UserFlagUserDevicesManagedGroup.TryGetManagedGroup(m.UserFlag, out assignedUserDevicesManagedGroup)) + if (UserFlagUserDevicesManagedGroup.TryGetManagedGroup(m.UserFlag, out var assignedUserDevicesManagedGroup)) m.UserDevicesLinkedGroup = assignedUserDevicesManagedGroup; if (Authorization.Has(Claims.Config.UserFlag.Configure)) diff --git a/Disco.Web/Areas/Services/Controllers/ClientController.cs b/Disco.Web/Areas/Services/Controllers/ClientController.cs index 893e88a0..4a8bd02a 100644 --- a/Disco.Web/Areas/Services/Controllers/ClientController.cs +++ b/Disco.Web/Areas/Services/Controllers/ClientController.cs @@ -37,8 +37,7 @@ namespace Disco.Web.Areas.Services.Controllers // Ensure supported version if (Request.UserAgent.StartsWith(@"Disco-Client/", StringComparison.OrdinalIgnoreCase)) { - Version clientVersion; - if (Version.TryParse(Request.UserAgent.Substring(13), out clientVersion)) + if (Version.TryParse(Request.UserAgent.Substring(13), out var clientVersion)) { if (clientVersion < new Version(2, 2)) { @@ -110,8 +109,7 @@ namespace Disco.Web.Areas.Services.Controllers // Ensure supported version if (Request.UserAgent.StartsWith(@"Disco-Client/", StringComparison.OrdinalIgnoreCase)) { - Version clientVersion; - if (Version.TryParse(Request.UserAgent.Substring(13), out clientVersion)) + if (Version.TryParse(Request.UserAgent.Substring(13), out var clientVersion)) { if (clientVersion < new Version(2, 2)) { diff --git a/Disco.Web/Controllers/SearchController.cs b/Disco.Web/Controllers/SearchController.cs index 545c8ac8..a90fdebd 100644 --- a/Disco.Web/Controllers/SearchController.cs +++ b/Disco.Web/Controllers/SearchController.cs @@ -17,8 +17,7 @@ namespace Disco.Web.Controllers public virtual ActionResult Query(string term, string limit = null, bool searchDetails = false, bool includeDecommissioned = false) { term = term.Trim(); - int termInt; - if (!int.TryParse(term, out termInt)) + if (!int.TryParse(term, out var termInt)) termInt = -1; var m = new Models.Search.QueryModel() { Term = term }; @@ -77,8 +76,7 @@ namespace Disco.Web.Controllers { case "devicemodel": Authorization.Require(Claims.Device.Search); - int deviceModelId; - if (int.TryParse(term, out deviceModelId)) + if (int.TryParse(term, out var deviceModelId)) { var vm = Database.DeviceModels.Find(deviceModelId); if (vm != null) @@ -94,8 +92,7 @@ namespace Disco.Web.Controllers break; case "deviceprofile": Authorization.Require(Claims.Device.Search); - int deviceProfileId; - if (int.TryParse(term, out deviceProfileId)) + if (int.TryParse(term, out var deviceProfileId)) { var dp = Database.DeviceProfiles.Find(deviceProfileId); if (dp != null) @@ -111,8 +108,7 @@ namespace Disco.Web.Controllers break; case "devicebatch": Authorization.Require(Claims.Device.Search); - int deviceBatchId; - if (int.TryParse(term, out deviceBatchId)) + if (int.TryParse(term, out var deviceBatchId)) { var db = Database.DeviceBatches.Find(deviceBatchId); if (db != null) @@ -233,8 +229,7 @@ namespace Disco.Web.Controllers } case "userflag": Authorization.RequireAll(Claims.User.Search, Claims.User.ShowFlagAssignments); - int userFlagId; - if (int.TryParse(term, out userFlagId)) + if (int.TryParse(term, out var userFlagId)) { var flag = Database.UserFlags.Find(userFlagId); if (flag != null) @@ -250,8 +245,7 @@ namespace Disco.Web.Controllers break; case "deviceflag": Authorization.RequireAll(Claims.Device.Search, Claims.Device.ShowFlagAssignments); - int deviceFlagId; - if (int.TryParse(term, out deviceFlagId)) + if (int.TryParse(term, out var deviceFlagId)) { var flag = Database.DeviceFlags.Find(deviceFlagId); if (flag != null) diff --git a/Disco.Web/Extensions/HtmlExtensions.cs b/Disco.Web/Extensions/HtmlExtensions.cs index f4ea9d45..18ccf8e1 100644 --- a/Disco.Web/Extensions/HtmlExtensions.cs +++ b/Disco.Web/Extensions/HtmlExtensions.cs @@ -124,8 +124,7 @@ namespace Disco.Web // Job Matches markdown = htmlCommentJobRegex.Value.Replace(markdown, match => { - int jobId; - if (int.TryParse(match.Groups[2].Value, out jobId)) + if (int.TryParse(match.Groups[2].Value, out var jobId)) return $"{match.Value}"; else return match.Value; diff --git a/Disco.Web/Models/InitialConfig/FileStoreModel.cs b/Disco.Web/Models/InitialConfig/FileStoreModel.cs index 2d4ffb63..0818f338 100644 --- a/Disco.Web/Models/InitialConfig/FileStoreModel.cs +++ b/Disco.Web/Models/InitialConfig/FileStoreModel.cs @@ -23,12 +23,11 @@ namespace Disco.Web.Models.InitialConfig { var branches = FileStoreLocation.ToUpper().Split(Path.DirectorySeparatorChar); var branchesCase = FileStoreLocation.Split(Path.DirectorySeparatorChar); - FileStoreDirectoryModel branchModel; FileStoreDirectoryModel branchParent = DirectoryModel; for (int i = 0; i < branches.Length; i++) { var branch = branches[i]; - if (branchParent.SubDirectories.TryGetValue(branch, out branchModel)) + if (branchParent.SubDirectories.TryGetValue(branch, out var branchModel)) { branchModel.ExpandSubDirectories(); }