Tidy: Sort/remove usings, simplify names
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization
|
||||
{
|
||||
@@ -13,21 +9,21 @@ namespace Disco.Services.Authorization
|
||||
|
||||
public AccessDeniedException(string Message, string Resource)
|
||||
{
|
||||
this.message = Message;
|
||||
this.resource = Resource;
|
||||
message = Message;
|
||||
resource = Resource;
|
||||
}
|
||||
|
||||
public override string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.message == null)
|
||||
if (message == null)
|
||||
{
|
||||
return "Your account does not have the required permission to access this Disco feature.";
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.message;
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +32,7 @@ namespace Disco.Services.Authorization
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.resource;
|
||||
return resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Logging;
|
||||
using Disco.Services.Logging.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization
|
||||
{
|
||||
|
||||
@@ -5,9 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
|
||||
namespace Disco.Services.Authorization
|
||||
{
|
||||
|
||||
@@ -3,8 +3,6 @@ using Disco.Services.Authorization.Roles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization
|
||||
{
|
||||
@@ -26,9 +24,9 @@ namespace Disco.Services.Authorization
|
||||
{
|
||||
this.Key = Key;
|
||||
var details = Claims.GetClaimDetails(Key);
|
||||
this.Name = details.Item1;
|
||||
this.Description = details.Item2;
|
||||
this.accessor = Claims.GetClaimAccessor(Key);
|
||||
Name = details.Item1;
|
||||
Description = details.Item2;
|
||||
accessor = Claims.GetClaimAccessor(Key);
|
||||
this.Hidden = Hidden;
|
||||
}
|
||||
|
||||
@@ -52,13 +50,13 @@ namespace Disco.Services.Authorization
|
||||
{
|
||||
return new ClaimNavigatorItem()
|
||||
{
|
||||
Key = this.Key,
|
||||
Name = this.Name,
|
||||
Description = this.Description,
|
||||
Hidden = this.Hidden,
|
||||
accessor = this.accessor,
|
||||
Value = this.accessor == null ? (bool?)null : this.accessor(RoleClaims),
|
||||
Children = this.Children == null ? null : this.Children.Cast<ClaimNavigatorItem>().Select(c => c.BuildClaimTree(RoleClaims)).ToList()
|
||||
Key = Key,
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
Hidden = Hidden,
|
||||
accessor = accessor,
|
||||
Value = accessor == null ? (bool?)null : accessor(RoleClaims),
|
||||
Children = Children == null ? null : Children.Cast<ClaimNavigatorItem>().Select(c => c.BuildClaimTree(RoleClaims)).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -66,19 +64,19 @@ namespace Disco.Services.Authorization
|
||||
{
|
||||
return new ClaimNavigatorItem()
|
||||
{
|
||||
Key = this.Key,
|
||||
Name = this.Name,
|
||||
Description = this.Description,
|
||||
Hidden = this.Hidden,
|
||||
accessor = this.accessor,
|
||||
Value = this.accessor == null ? (bool?)null : RoleClaims.Any(rc => this.accessor(rc)),
|
||||
Children = this.Children == null ? null : this.Children.Cast<ClaimNavigatorItem>().Select(c => c.BuildClaimTree(RoleClaims)).ToList()
|
||||
Key = Key,
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
Hidden = Hidden,
|
||||
accessor = accessor,
|
||||
Value = accessor == null ? (bool?)null : RoleClaims.Any(rc => accessor(rc)),
|
||||
Children = Children == null ? null : Children.Cast<ClaimNavigatorItem>().Select(c => c.BuildClaimTree(RoleClaims)).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}: {1}={2}", this.Name, this.Key, this.Value);
|
||||
return string.Format("{0}: {1}={2}", Name, Key, Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using System;
|
||||
|
||||
namespace Disco.Services.Authorization
|
||||
{
|
||||
@@ -17,7 +11,7 @@ namespace Disco.Services.Authorization
|
||||
if (AuthorisedClaims == null || AuthorisedClaims.Length == 0)
|
||||
throw new ArgumentNullException("AuthorisedClaims");
|
||||
|
||||
this.authorizedClaims = AuthorisedClaims;
|
||||
authorizedClaims = AuthorisedClaims;
|
||||
}
|
||||
|
||||
public override bool IsAuthorized(System.Web.HttpContextBase httpContext)
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using System;
|
||||
|
||||
namespace Disco.Services.Authorization
|
||||
{
|
||||
@@ -17,7 +11,7 @@ namespace Disco.Services.Authorization
|
||||
if (AuthorisedClaims == null || AuthorisedClaims.Length == 0)
|
||||
throw new ArgumentNullException("AuthorisedClaims");
|
||||
|
||||
this.authorizedClaims = AuthorisedClaims;
|
||||
authorizedClaims = AuthorisedClaims;
|
||||
}
|
||||
|
||||
public override bool IsAuthorized(System.Web.HttpContextBase httpContext)
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Services.Authorization
|
||||
{
|
||||
@@ -16,7 +10,7 @@ namespace Disco.Services.Authorization
|
||||
|
||||
public DiscoAuthorizeAttribute(string AuthorisedClaim)
|
||||
{
|
||||
this.authorizedClaim = AuthorisedClaim;
|
||||
authorizedClaim = AuthorisedClaim;
|
||||
}
|
||||
|
||||
public override bool IsAuthorized(System.Web.HttpContextBase httpContext)
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Services.Authorization
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles
|
||||
namespace Disco.Services.Authorization.Roles
|
||||
{
|
||||
public abstract class BaseRoleClaimGroup
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles
|
||||
{
|
||||
|
||||
@@ -19,19 +19,19 @@ namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
|
||||
{
|
||||
public ConfigClaims()
|
||||
{
|
||||
this.DeviceCertificate = new DeviceCertificateClaims();
|
||||
this.Enrolment = new EnrolmentClaims();
|
||||
this.DeviceBatch = new DeviceBatchClaims();
|
||||
this.DeviceModel = new DeviceModelClaims();
|
||||
this.DeviceProfile = new DeviceProfileClaims();
|
||||
this.DocumentTemplate = new DocumentTemplateClaims();
|
||||
this.Logging = new LoggingClaims();
|
||||
this.Plugin = new PluginClaims();
|
||||
this.System = new SystemClaims();
|
||||
this.Organisation = new OrganisationClaims();
|
||||
this.JobPreferences = new JobPreferencesClaims();
|
||||
this.JobQueue = new JobQueueClaims();
|
||||
this.UserFlag = new UserFlagClaims();
|
||||
DeviceCertificate = new DeviceCertificateClaims();
|
||||
Enrolment = new EnrolmentClaims();
|
||||
DeviceBatch = new DeviceBatchClaims();
|
||||
DeviceModel = new DeviceModelClaims();
|
||||
DeviceProfile = new DeviceProfileClaims();
|
||||
DocumentTemplate = new DocumentTemplateClaims();
|
||||
Logging = new LoggingClaims();
|
||||
Plugin = new PluginClaims();
|
||||
System = new SystemClaims();
|
||||
Organisation = new OrganisationClaims();
|
||||
JobPreferences = new JobPreferencesClaims();
|
||||
JobQueue = new JobQueueClaims();
|
||||
UserFlag = new UserFlagClaims();
|
||||
}
|
||||
|
||||
[ClaimDetails("Show Configuration", "Can show the configuration menu")]
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceBatch
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceBatch
|
||||
{
|
||||
[ClaimDetails("Device Batches", "Permissions related to Device Batches")]
|
||||
public class DeviceBatchClaims : BaseRoleClaimGroup
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceCertificate
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceCertificate
|
||||
{
|
||||
[ClaimDetails("Device Certificates", "Permissions related to Device Certificates")]
|
||||
public class DeviceCertificateClaims : BaseRoleClaimGroup
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceModel
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceModel
|
||||
{
|
||||
[ClaimDetails("Device Models", "Permissions related to Device Models")]
|
||||
public class DeviceModelClaims : BaseRoleClaimGroup
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceProfile
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceProfile
|
||||
{
|
||||
[ClaimDetails("Device Profiles", "Permissions related to Device Profiles")]
|
||||
public class DeviceProfileClaims : BaseRoleClaimGroup
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DocumentTemplate
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DocumentTemplate
|
||||
{
|
||||
[ClaimDetails("Document Templates", "Permissions related to Document Templates")]
|
||||
public class DocumentTemplateClaims : BaseRoleClaimGroup
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Enrolment
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Enrolment
|
||||
{
|
||||
[ClaimDetails("Enrolment", "Permissions related to Device Enrolment")]
|
||||
public class EnrolmentClaims
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.JobQueue
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.JobQueue
|
||||
{
|
||||
[ClaimDetails("Job Queues", "Permissions related to Job Queues")]
|
||||
public class JobQueueClaims : BaseRoleClaimGroup
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Logging
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Logging
|
||||
{
|
||||
[ClaimDetails("Logging", "Permissions related to Logging")]
|
||||
public class LoggingClaims : BaseRoleClaimGroup
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Origanisation
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Origanisation
|
||||
{
|
||||
[ClaimDetails("Organisation Details", "Permissions related to the Organisation Details")]
|
||||
public class OrganisationClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Plugin
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Plugin
|
||||
{
|
||||
[ClaimDetails("Plugin", "Permissions related to Plugins")]
|
||||
public class PluginClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.System
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.System
|
||||
{
|
||||
[ClaimDetails("System", "Permissions related to System Configuration")]
|
||||
public class SystemClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Device
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Device
|
||||
{
|
||||
[ClaimDetails("Actions", "Permissions related to Device Actions")]
|
||||
public class DeviceActionsClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Device
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Device
|
||||
{
|
||||
[ClaimDetails("Device", "Permissions related to Devices")]
|
||||
public class DeviceClaims : BaseRoleClaimGroup
|
||||
{
|
||||
public DeviceClaims()
|
||||
{
|
||||
this.Properties = new DevicePropertiesClaims();
|
||||
this.Actions = new DeviceActionsClaims();
|
||||
Properties = new DevicePropertiesClaims();
|
||||
Actions = new DeviceActionsClaims();
|
||||
}
|
||||
|
||||
[ClaimDetails("Search Devices", "Can search devices")]
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Device
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Device
|
||||
{
|
||||
[ClaimDetails("Device Properties", "Permissions related to Device Properties")]
|
||||
public class DevicePropertiesClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
{
|
||||
[ClaimDetails("Actions", "Permissions related to Job Actions")]
|
||||
public class JobActionsClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
{
|
||||
[ClaimDetails("Job", "Permissions related to Jobs")]
|
||||
public class JobClaims : BaseRoleClaimGroup
|
||||
{
|
||||
public JobClaims()
|
||||
{
|
||||
this.Lists = new JobListsClaims();
|
||||
this.Actions = new JobActionsClaims();
|
||||
this.Properties = new JobPropertiesClaims();
|
||||
this.Types = new JobTypesClaims();
|
||||
Lists = new JobListsClaims();
|
||||
Actions = new JobActionsClaims();
|
||||
Properties = new JobPropertiesClaims();
|
||||
Types = new JobTypesClaims();
|
||||
}
|
||||
|
||||
[ClaimDetails("Search Jobs", "Can search jobs")]
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
{
|
||||
[ClaimDetails("Lists", "Permissions related to Job Lists")]
|
||||
public class JobListsClaims : BaseRoleClaimGroup
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
{
|
||||
[ClaimDetails("Non Warranty Properties", "Permissions related to Non-Warranty Job Properties")]
|
||||
public class JobNonWarrantyPropertiesClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
{
|
||||
[ClaimDetails("Job Properties", "Permissions related to Job Properties")]
|
||||
public class JobPropertiesClaims : BaseRoleClaimGroup
|
||||
{
|
||||
public JobPropertiesClaims()
|
||||
{
|
||||
this.WarrantyProperties = new JobWarrantyPropertiesClaims();
|
||||
this.NonWarrantyProperties = new JobNonWarrantyPropertiesClaims();
|
||||
this.JobQueueProperties = new JobQueuePropertiesClaims();
|
||||
WarrantyProperties = new JobWarrantyPropertiesClaims();
|
||||
NonWarrantyProperties = new JobNonWarrantyPropertiesClaims();
|
||||
JobQueueProperties = new JobQueuePropertiesClaims();
|
||||
}
|
||||
|
||||
public JobWarrantyPropertiesClaims WarrantyProperties { get; set; }
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
{
|
||||
[ClaimDetails("Job Queue Properties", "Permissions related to Job Queue Job Properties")]
|
||||
public class JobQueuePropertiesClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
{
|
||||
[ClaimDetails("Types", "Permissions related to Job Types")]
|
||||
public class JobTypesClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.Job
|
||||
{
|
||||
[ClaimDetails("Warranty Properties", "Permissions related to Warranty Job Properties")]
|
||||
public class JobWarrantyPropertiesClaims : BaseRoleClaimGroup
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.User
|
||||
namespace Disco.Services.Authorization.Roles.ClaimGroups.User
|
||||
{
|
||||
[ClaimDetails("User", "Permissions related to Users")]
|
||||
public class UserClaims : BaseRoleClaimGroup
|
||||
{
|
||||
public UserClaims()
|
||||
{
|
||||
this.Actions = new UserActionsClaims();
|
||||
Actions = new UserActionsClaims();
|
||||
}
|
||||
|
||||
[ClaimDetails("Search Users", "Can search users")]
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
using Disco.Models.Services.Authorization;
|
||||
using Disco.Models.Repository;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using Disco.Services.Authorization.Roles.ClaimGroups;
|
||||
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration;
|
||||
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration;
|
||||
using Disco.Services.Authorization.Roles.ClaimGroups.Device;
|
||||
using Disco.Services.Authorization.Roles.ClaimGroups.Job;
|
||||
using Disco.Services.Authorization.Roles.ClaimGroups.User;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles
|
||||
{
|
||||
@@ -15,11 +9,11 @@ namespace Disco.Services.Authorization.Roles
|
||||
{
|
||||
public RoleClaims()
|
||||
{
|
||||
this.Config = new ConfigClaims();
|
||||
Config = new ConfigClaims();
|
||||
|
||||
this.Job = new JobClaims();
|
||||
this.Device = new DeviceClaims();
|
||||
this.User = new UserClaims();
|
||||
Job = new JobClaims();
|
||||
Device = new DeviceClaims();
|
||||
User = new UserClaims();
|
||||
}
|
||||
|
||||
[ClaimDetails("Computer Account", "Represents a computer account", true)]
|
||||
|
||||
@@ -4,8 +4,6 @@ using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Authorization.Roles
|
||||
{
|
||||
|
||||
@@ -10,8 +10,6 @@ using Exceptionless;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services
|
||||
{
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace Disco.Services.Devices.Enrolment
|
||||
if (domain == null)
|
||||
domain = ActiveDirectory.Context.GetDomainByName(Request.DNSDomainName);
|
||||
|
||||
if (!authenticatedToken.User.UserId.Equals(string.Format(@"{0}\{1}$", domain.NetBiosName, Request.ComputerName), System.StringComparison.OrdinalIgnoreCase))
|
||||
if (!authenticatedToken.User.UserId.Equals(string.Format(@"{0}\{1}$", domain.NetBiosName, Request.ComputerName), StringComparison.OrdinalIgnoreCase))
|
||||
throw new EnrolmentSafeException(string.Format("Connection not correctly authenticated (SN: {0}; Auth User: {1})", Request.SerialNumber, authenticatedToken.User.UserId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Devices.Enrolment
|
||||
namespace Disco.Services.Devices.Enrolment
|
||||
{
|
||||
public enum EnrolmentTypes
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Disco.Services.Devices.Enrolment
|
||||
var trigger = TriggerBuilder.Create()
|
||||
.StartAt(DateTimeOffset.Now.AddMinutes(5));
|
||||
|
||||
this.ScheduleTask(trigger);
|
||||
ScheduleTask(trigger);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Services.Devices.Exporting;
|
||||
using Disco.Models.Services.Devices.Exporting;
|
||||
using Disco.Services.Tasks;
|
||||
using Quartz;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Services.Devices.Exporting
|
||||
@@ -34,13 +30,13 @@ namespace Disco.Services.Devices.Exporting
|
||||
|
||||
protected override void ExecuteTask()
|
||||
{
|
||||
var context = (DeviceExportTaskContext)this.ExecutionContext.JobDetail.JobDataMap[JobDataMapContext];
|
||||
var context = (DeviceExportTaskContext)ExecutionContext.JobDetail.JobDataMap[JobDataMapContext];
|
||||
|
||||
Status.UpdateStatus(10, "Exporting Device Records", "Starting...");
|
||||
|
||||
using (DiscoDataContext Database = new DiscoDataContext())
|
||||
{
|
||||
context.Result = DeviceExport.GenerateExport(Database, context.Options, this.Status);
|
||||
context.Result = DeviceExport.GenerateExport(Database, context.Options, Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Disco.Models.Services.Devices.Exporting;
|
||||
using Disco.Services.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace Disco.Services.Devices.Exporting
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.Services.Devices.Importing;
|
||||
using Disco.Services.Tasks;
|
||||
using Quartz;
|
||||
using System;
|
||||
@@ -13,10 +14,10 @@ namespace Disco.Services.Devices.Importing
|
||||
public override bool SingleInstanceTask { get { return false; } }
|
||||
public override bool CancelInitiallySupported { get { return false; } }
|
||||
|
||||
public static ScheduledTaskStatus ScheduleNow(DeviceImportContext Context)
|
||||
public static ScheduledTaskStatus ScheduleNow(IDeviceImportContext Context)
|
||||
{
|
||||
if (Context == null)
|
||||
throw new ArgumentNullException("Context");
|
||||
throw new ArgumentNullException(nameof(Context));
|
||||
|
||||
// Build Data Map
|
||||
var task = new DeviceImportApplyTask();
|
||||
@@ -28,14 +29,14 @@ namespace Disco.Services.Devices.Importing
|
||||
|
||||
protected override void ExecuteTask()
|
||||
{
|
||||
var context = (DeviceImportContext)this.ExecutionContext.JobDetail.JobDataMap[JobDataMapContext];
|
||||
var context = (IDeviceImportContext)ExecutionContext.JobDetail.JobDataMap[JobDataMapContext];
|
||||
|
||||
using (DiscoDataContext Database = new DiscoDataContext())
|
||||
{
|
||||
context.AffectedRecords = context.ApplyRecords(Database, this.Status);
|
||||
context.AffectedRecords = context.ApplyRecords(Database, Status);
|
||||
}
|
||||
|
||||
Status.SetFinishedMessage(string.Format("Successfully imported/updated {0} device{1}", context.AffectedRecords, context.AffectedRecords == 1 ? null : "s"));
|
||||
Status.SetFinishedMessage($"Successfully imported/updated {context.AffectedRecords} device{(context.AffectedRecords == 1 ? null : "s")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using Disco.Models.Services.Devices.Importing;
|
||||
using System;
|
||||
|
||||
namespace Disco.Services.Devices.Importing
|
||||
{
|
||||
public class DeviceImportColumn : IDeviceImportColumn
|
||||
{
|
||||
public int Index { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DeviceImportFieldTypes Type { get; set; }
|
||||
public Type Handler { get; set; }
|
||||
|
||||
public IDeviceImportField GetHandlerInstance()
|
||||
{
|
||||
if (Handler == null)
|
||||
throw new InvalidOperationException($"No field handler available for this type {Type.ToString()}.");
|
||||
|
||||
return (IDeviceImportField)Activator.CreateInstance(Handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,10 @@ namespace Disco.Services.Devices.Importing
|
||||
{
|
||||
this.Database = Database;
|
||||
|
||||
this.devices = new Lazy<IEnumerable<Device>>(() => Database.Devices.Include("DeviceDetails").ToList());
|
||||
this.deviceModels = new Lazy<IEnumerable<DeviceModel>>(() => Database.DeviceModels.ToList());
|
||||
this.deviceProfiles = new Lazy<IEnumerable<DeviceProfile>>(() => Database.DeviceProfiles.ToList());
|
||||
this.deviceBatches = new Lazy<IEnumerable<DeviceBatch>>(() => Database.DeviceBatches.ToList());
|
||||
devices = new Lazy<IEnumerable<Device>>(() => Database.Devices.Include("DeviceDetails").ToList());
|
||||
deviceModels = new Lazy<IEnumerable<DeviceModel>>(() => Database.DeviceModels.ToList());
|
||||
deviceProfiles = new Lazy<IEnumerable<DeviceProfile>>(() => Database.DeviceProfiles.ToList());
|
||||
deviceBatches = new Lazy<IEnumerable<DeviceBatch>>(() => Database.DeviceBatches.ToList());
|
||||
}
|
||||
|
||||
public Device FindDevice(string DeviceSerialNumber)
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
private DeviceBatchAssignedUsersManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DeviceBatch DeviceBatch)
|
||||
: base(Key, Configuration)
|
||||
{
|
||||
this.DeviceBatchId = DeviceBatch.Id;
|
||||
this.DeviceBatchName = DeviceBatch.Name;
|
||||
DeviceBatchId = DeviceBatch.Id;
|
||||
DeviceBatchName = DeviceBatch.Name;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -125,7 +125,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
public override IEnumerable<string> DetermineMembers(DiscoDataContext Database)
|
||||
{
|
||||
return Database.Devices
|
||||
.Where(d => d.DeviceBatchId == this.DeviceBatchId)
|
||||
.Where(d => d.DeviceBatchId == DeviceBatchId)
|
||||
.Where(d => d.AssignedUserId != null)
|
||||
.Select(d => d.AssignedUserId);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
AddMember(device.AssignedUserId);
|
||||
break;
|
||||
case RepositoryMonitorEventType.Modified:
|
||||
if (device.DeviceBatchId == this.DeviceBatchId)
|
||||
if (device.DeviceBatchId == DeviceBatchId)
|
||||
{
|
||||
if (device.AssignedUserId != null)
|
||||
AddMember(device.AssignedUserId);
|
||||
@@ -152,7 +152,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
{
|
||||
if (previousUserId != null)
|
||||
RemoveMember(previousUserId, (database) =>
|
||||
!database.Devices.Any(d => d.DeviceBatchId == this.DeviceBatchId && d.AssignedUserId == previousUserId)
|
||||
!database.Devices.Any(d => d.DeviceBatchId == DeviceBatchId && d.AssignedUserId == previousUserId)
|
||||
? new string[] { previousUserId }
|
||||
: null);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
{
|
||||
if (previousUserId != null)
|
||||
RemoveMember(previousUserId, (database) =>
|
||||
!database.Devices.Any(d => d.DeviceBatchId == this.DeviceBatchId && d.AssignedUserId == previousUserId)
|
||||
!database.Devices.Any(d => d.DeviceBatchId == DeviceBatchId && d.AssignedUserId == previousUserId)
|
||||
? new string[] { previousUserId }
|
||||
: null);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
case RepositoryMonitorEventType.Deleted:
|
||||
if (previousUserId != null)
|
||||
RemoveMember(previousUserId, (database) =>
|
||||
!database.Devices.Any(d => d.DeviceBatchId == this.DeviceBatchId && d.AssignedUserId == previousUserId)
|
||||
!database.Devices.Any(d => d.DeviceBatchId == DeviceBatchId && d.AssignedUserId == previousUserId)
|
||||
? new string[] { previousUserId }
|
||||
: null);
|
||||
break;
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
private DeviceBatchDevicesManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DeviceBatch DeviceBatch)
|
||||
: base(Key, Configuration)
|
||||
{
|
||||
this.DeviceBatchId = DeviceBatch.Id;
|
||||
this.DeviceBatchName = DeviceBatch.Name;
|
||||
DeviceBatchId = DeviceBatch.Id;
|
||||
DeviceBatchName = DeviceBatch.Name;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -123,7 +123,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
public override IEnumerable<string> DetermineMembers(DiscoDataContext Database)
|
||||
{
|
||||
return Database.Devices
|
||||
.Where(d => d.DeviceBatchId == this.DeviceBatchId)
|
||||
.Where(d => d.DeviceBatchId == DeviceBatchId)
|
||||
.Where(d => d.DeviceDomainId != null)
|
||||
.Select(d => d.DeviceDomainId)
|
||||
.ToList()
|
||||
@@ -144,7 +144,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
AddMember(device.DeviceDomainId + "$");
|
||||
break;
|
||||
case RepositoryMonitorEventType.Modified:
|
||||
if (device.DeviceBatchId == this.DeviceBatchId)
|
||||
if (device.DeviceBatchId == DeviceBatchId)
|
||||
{
|
||||
if (ActiveDirectory.IsValidDomainAccountId(device.DeviceDomainId))
|
||||
AddMember(device.DeviceDomainId + "$");
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
private DeviceProfileAssignedUsersManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DeviceProfile DeviceProfile)
|
||||
: base(Key, Configuration)
|
||||
{
|
||||
this.DeviceProfileId = DeviceProfile.Id;
|
||||
this.DeviceProfileName = DeviceProfile.Name;
|
||||
DeviceProfileId = DeviceProfile.Id;
|
||||
DeviceProfileName = DeviceProfile.Name;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -125,7 +125,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
public override IEnumerable<string> DetermineMembers(DiscoDataContext Database)
|
||||
{
|
||||
return Database.Devices
|
||||
.Where(d => d.DeviceProfileId == this.DeviceProfileId)
|
||||
.Where(d => d.DeviceProfileId == DeviceProfileId)
|
||||
.Where(d => d.AssignedUserId != null)
|
||||
.Select(d => d.AssignedUserId);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
AddMember(device.AssignedUserId);
|
||||
break;
|
||||
case RepositoryMonitorEventType.Modified:
|
||||
if (device.DeviceProfileId == this.DeviceProfileId)
|
||||
if (device.DeviceProfileId == DeviceProfileId)
|
||||
{
|
||||
if (device.AssignedUserId != null)
|
||||
AddMember(device.AssignedUserId);
|
||||
@@ -152,7 +152,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
{
|
||||
if (previousUserId != null)
|
||||
RemoveMember(previousUserId, (database) =>
|
||||
!database.Devices.Any(d => d.DeviceProfileId == this.DeviceProfileId && d.AssignedUserId == previousUserId)
|
||||
!database.Devices.Any(d => d.DeviceProfileId == DeviceProfileId && d.AssignedUserId == previousUserId)
|
||||
? new string[] { previousUserId }
|
||||
: null);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
{
|
||||
if (previousUserId != null)
|
||||
RemoveMember(previousUserId, (database) =>
|
||||
!database.Devices.Any(d => d.DeviceProfileId == this.DeviceProfileId && d.AssignedUserId == previousUserId)
|
||||
!database.Devices.Any(d => d.DeviceProfileId == DeviceProfileId && d.AssignedUserId == previousUserId)
|
||||
? new string[] { previousUserId }
|
||||
: null);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
case RepositoryMonitorEventType.Deleted:
|
||||
if (previousUserId != null)
|
||||
RemoveMember(previousUserId, (database) =>
|
||||
!database.Devices.Any(d => d.DeviceProfileId == this.DeviceProfileId && d.AssignedUserId == previousUserId)
|
||||
!database.Devices.Any(d => d.DeviceProfileId == DeviceProfileId && d.AssignedUserId == previousUserId)
|
||||
? new string[] { previousUserId }
|
||||
: null);
|
||||
break;
|
||||
|
||||
@@ -46,8 +46,8 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
private DeviceProfileDevicesManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DeviceProfile DeviceProfile)
|
||||
: base(Key, Configuration)
|
||||
{
|
||||
this.DeviceProfileId = DeviceProfile.Id;
|
||||
this.DeviceProfileName = DeviceProfile.Name;
|
||||
DeviceProfileId = DeviceProfile.Id;
|
||||
DeviceProfileName = DeviceProfile.Name;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -124,7 +124,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
public override IEnumerable<string> DetermineMembers(DiscoDataContext Database)
|
||||
{
|
||||
return Database.Devices
|
||||
.Where(d => d.DeviceProfileId == this.DeviceProfileId)
|
||||
.Where(d => d.DeviceProfileId == DeviceProfileId)
|
||||
.Where(d => d.DeviceDomainId != null)
|
||||
.Select(d => d.DeviceDomainId)
|
||||
.ToList()
|
||||
@@ -145,7 +145,7 @@ namespace Disco.Services.Devices.ManagedGroups
|
||||
AddMember(device.DeviceDomainId + "$");
|
||||
break;
|
||||
case RepositoryMonitorEventType.Modified:
|
||||
if (device.DeviceProfileId == this.DeviceProfileId)
|
||||
if (device.DeviceProfileId == DeviceProfileId)
|
||||
{
|
||||
if (ActiveDirectory.IsValidDomainAccountId(device.DeviceDomainId))
|
||||
AddMember(device.DeviceDomainId + "$");
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Disco.Services.Documents.AttachmentImport
|
||||
|
||||
public void ScheduleCurrentFiles(int ImportDelay)
|
||||
{
|
||||
foreach (var filename in Directory.GetFiles(this.MonitorLocation, "*.pdf"))
|
||||
foreach (var filename in Directory.GetFiles(MonitorLocation, "*.pdf"))
|
||||
{
|
||||
ScheduleImport(filename, ImportDelay);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services.Logging;
|
||||
using Disco.Services.Tasks;
|
||||
using Quartz;
|
||||
using System;
|
||||
@@ -20,7 +19,7 @@ namespace Disco.Services.Documents.AttachmentImport
|
||||
// Trigger Daily @ 12:30am
|
||||
TriggerBuilder triggerBuilder = TriggerBuilder.Create().WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(0, 30));
|
||||
|
||||
this.ScheduleTask(triggerBuilder);
|
||||
ScheduleTask(triggerBuilder);
|
||||
}
|
||||
|
||||
protected override void ExecuteTask()
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Disco.Services.Documents.AttachmentImport
|
||||
var trigger = TriggerBuilder.Create()
|
||||
.StartAt(DateTimeOffset.Now.AddMinutes(5));
|
||||
|
||||
this.ScheduleTask(trigger);
|
||||
ScheduleTask(trigger);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,11 +137,11 @@ namespace Disco.Services.Documents
|
||||
|
||||
private DocumentUniqueIdentifier(DiscoDataContext Database, int Version, short DeploymentChecksum, string DocumentTemplateId, string TargetId, string CreatorId, DateTime TimeStamp, int PageIndex, AttachmentTypes? AttachmentType)
|
||||
{
|
||||
this.database = Database;
|
||||
database = Database;
|
||||
this.Version = Version;
|
||||
this.DeploymentChecksum = DeploymentChecksum;
|
||||
this.DocumentTemplateId = DocumentTemplateId;
|
||||
this.attachmentType = AttachmentType;
|
||||
attachmentType = AttachmentType;
|
||||
this.TargetId = TargetId;
|
||||
this.CreatorId = ActiveDirectory.ParseDomainAccountId(CreatorId);
|
||||
this.TimeStamp = TimeStamp;
|
||||
@@ -440,7 +440,7 @@ namespace Disco.Services.Documents
|
||||
|
||||
public static bool IsDocumentUniqueIdentifier(string Identifier)
|
||||
{
|
||||
return Identifier != null && Identifier.StartsWith("Disco|", System.StringComparison.OrdinalIgnoreCase);
|
||||
return Identifier != null && Identifier.StartsWith("Disco|", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public static bool IsDocumentUniqueIdentifier(byte[] Identifier)
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Documents;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services
|
||||
{
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
private DocumentTemplateDevicesManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DocumentTemplate DocumentTemplate)
|
||||
: base(Key, Configuration)
|
||||
{
|
||||
this.DocumentTemplateId = DocumentTemplate.Id;
|
||||
this.DocumentTemplateDescription = DocumentTemplate.Description;
|
||||
this.DocumentTemplateScope = DocumentTemplate.Scope;
|
||||
DocumentTemplateId = DocumentTemplate.Id;
|
||||
DocumentTemplateDescription = DocumentTemplate.Description;
|
||||
DocumentTemplateScope = DocumentTemplate.Scope;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -160,7 +160,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
return Database.Devices
|
||||
.Where(d => d.DeviceDomainId != null && d.DeviceAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(d => d.DeviceDomainId != null && d.DeviceAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Select(d => d.DeviceDomainId)
|
||||
.ToList()
|
||||
.Where(ActiveDirectory.IsValidDomainAccountId)
|
||||
@@ -169,7 +169,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
else
|
||||
{
|
||||
return Database.Devices
|
||||
.Where(d => d.DeviceDomainId != null && d.DeviceAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(d => d.DeviceDomainId != null && d.DeviceAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId))
|
||||
.Select(d => d.DeviceDomainId)
|
||||
.ToList()
|
||||
.Where(ActiveDirectory.IsValidDomainAccountId)
|
||||
@@ -179,7 +179,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
return Database.Jobs
|
||||
.Where(j => j.Device.DeviceDomainId != null && j.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(j => j.Device.DeviceDomainId != null && j.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Select(j => j.Device.DeviceDomainId)
|
||||
.Distinct()
|
||||
.ToList()
|
||||
@@ -189,7 +189,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
else
|
||||
{
|
||||
return Database.Jobs
|
||||
.Where(j => j.Device.DeviceDomainId != null && j.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(j => j.Device.DeviceDomainId != null && j.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId))
|
||||
.Select(j => j.Device.DeviceDomainId)
|
||||
.Distinct()
|
||||
.ToList()
|
||||
@@ -200,7 +200,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
return Database.Users
|
||||
.Where(u => u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(u => u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.SelectMany(u => u.DeviceUserAssignments.Where(dua => !dua.UnassignedDate.HasValue && dua.Device.DeviceDomainId != null), (u, dua) => dua.Device.DeviceDomainId)
|
||||
.ToList()
|
||||
.Where(ActiveDirectory.IsValidDomainAccountId)
|
||||
@@ -209,7 +209,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
else
|
||||
{
|
||||
return Database.Users
|
||||
.Where(u => u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(u => u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId))
|
||||
.SelectMany(u => u.DeviceUserAssignments.Where(dua => !dua.UnassignedDate.HasValue && dua.Device.DeviceDomainId != null), (u, dua) => dua.Device.DeviceDomainId)
|
||||
.ToList()
|
||||
.Where(ActiveDirectory.IsValidDomainAccountId)
|
||||
@@ -229,14 +229,14 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
{
|
||||
result = Database.Devices
|
||||
.Where(d => d.SerialNumber == DeviceSerialNumber && d.DeviceDomainId != null)
|
||||
.Select(d => Tuple.Create(d.DeviceDomainId, d.DeviceAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate)))
|
||||
.Select(d => Tuple.Create(d.DeviceDomainId, d.DeviceAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate)))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Database.Devices
|
||||
.Where(d => d.SerialNumber == DeviceSerialNumber && d.DeviceDomainId != null)
|
||||
.Select(d => Tuple.Create(d.DeviceDomainId, d.DeviceAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId)))
|
||||
.Select(d => Tuple.Create(d.DeviceDomainId, d.DeviceAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId)))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
.Select(j => new Tuple<string, string, bool>(
|
||||
j.Device.DeviceDomainId,
|
||||
j.Device.SerialNumber,
|
||||
j.Device.Jobs.Any(dj => dj.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))))
|
||||
j.Device.Jobs.Any(dj => dj.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
@@ -305,7 +305,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
.Select(j => new Tuple<string, string, bool>(
|
||||
j.Device.DeviceDomainId,
|
||||
j.Device.SerialNumber,
|
||||
j.Device.Jobs.Any(dj => dj.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId))))
|
||||
j.Device.Jobs.Any(dj => dj.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId))))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
result = Database.Users
|
||||
.Where(u => u.UserId == UserId)
|
||||
.Select(u => Tuple.Create(
|
||||
u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate),
|
||||
u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate),
|
||||
u.DeviceUserAssignments
|
||||
.Where(dua => !dua.UnassignedDate.HasValue && dua.Device.DeviceDomainId != null)
|
||||
.Select(dua => new Tuple<string, string>(dua.Device.DeviceDomainId, dua.Device.SerialNumber))))
|
||||
@@ -383,7 +383,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
result = Database.Users
|
||||
.Where(u => u.UserId == UserId)
|
||||
.Select(u => Tuple.Create(
|
||||
u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId),
|
||||
u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId),
|
||||
u.DeviceUserAssignments
|
||||
.Where(dua => !dua.UnassignedDate.HasValue && dua.Device.DeviceDomainId != null)
|
||||
.Select(dua => new Tuple<string, string>(dua.Device.DeviceDomainId, dua.Device.SerialNumber))))
|
||||
@@ -458,13 +458,13 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
{
|
||||
jobsHaveTemplate = e.Database.Jobs
|
||||
.Where(j => j.DeviceSerialNumber == deviceSerialNumber)
|
||||
.Any(j => j.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate));
|
||||
.Any(j => j.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate));
|
||||
}
|
||||
else
|
||||
{
|
||||
jobsHaveTemplate = e.Database.Jobs
|
||||
.Where(j => j.DeviceSerialNumber == deviceSerialNumber)
|
||||
.Any(j => j.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId));
|
||||
.Any(j => j.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId));
|
||||
}
|
||||
|
||||
if (jobsHaveTemplate)
|
||||
@@ -482,14 +482,14 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
userHasTemplate = e.Database.Devices
|
||||
.Where(d => d.SerialNumber == deviceSerialNumber)
|
||||
.Select(d => d.AssignedUser)
|
||||
.Any(u => u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate));
|
||||
.Any(u => u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate));
|
||||
}
|
||||
else
|
||||
{
|
||||
userHasTemplate = e.Database.Devices
|
||||
.Where(d => d.SerialNumber == deviceSerialNumber)
|
||||
.Select(d => d.AssignedUser)
|
||||
.Any(u => u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId));
|
||||
.Any(u => u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId));
|
||||
}
|
||||
|
||||
if (userHasTemplate)
|
||||
@@ -526,13 +526,13 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
previousUserHasTemplate = e.Database.Users
|
||||
.Where(u => u.UserId == devicePreviousAssignedUserId && u.UserAttachments.Any(ua => ua.DocumentTemplateId == this.DocumentTemplateId && ua.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(u => u.UserId == devicePreviousAssignedUserId && u.UserAttachments.Any(ua => ua.DocumentTemplateId == DocumentTemplateId && ua.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Any();
|
||||
}
|
||||
else
|
||||
{
|
||||
previousUserHasTemplate = e.Database.Users
|
||||
.Where(u => u.UserId == devicePreviousAssignedUserId && u.UserAttachments.Any(ua => ua.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(u => u.UserId == devicePreviousAssignedUserId && u.UserAttachments.Any(ua => ua.DocumentTemplateId == DocumentTemplateId))
|
||||
.Any();
|
||||
}
|
||||
}
|
||||
@@ -542,13 +542,13 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
currentUserHasTemplate = e.Database.Users
|
||||
.Where(u => u.UserId == deviceCurrentAssignedUserId && u.UserAttachments.Any(ua => ua.DocumentTemplateId == this.DocumentTemplateId && ua.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(u => u.UserId == deviceCurrentAssignedUserId && u.UserAttachments.Any(ua => ua.DocumentTemplateId == DocumentTemplateId && ua.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Any();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentUserHasTemplate = e.Database.Users
|
||||
.Where(u => u.UserId == deviceCurrentAssignedUserId && u.UserAttachments.Any(ua => ua.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(u => u.UserId == deviceCurrentAssignedUserId && u.UserAttachments.Any(ua => ua.DocumentTemplateId == DocumentTemplateId))
|
||||
.Any();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
private DocumentTemplateUsersManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DocumentTemplate DocumentTemplate)
|
||||
: base(Key, Configuration)
|
||||
{
|
||||
this.DocumentTemplateId = DocumentTemplate.Id;
|
||||
this.DocumentTemplateDescription = DocumentTemplate.Description;
|
||||
this.DocumentTemplateScope = DocumentTemplate.Scope;
|
||||
DocumentTemplateId = DocumentTemplate.Id;
|
||||
DocumentTemplateDescription = DocumentTemplate.Description;
|
||||
DocumentTemplateScope = DocumentTemplate.Scope;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -155,27 +155,27 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
return Database.Devices
|
||||
.Where(d => d.AssignedUserId != null && d.DeviceAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(d => d.AssignedUserId != null && d.DeviceAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Select(d => d.AssignedUserId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Database.Devices
|
||||
.Where(d => d.AssignedUserId != null && d.DeviceAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(d => d.AssignedUserId != null && d.DeviceAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId))
|
||||
.Select(d => d.AssignedUserId);
|
||||
}
|
||||
case DocumentTemplate.DocumentTemplateScopes.Job:
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
return Database.Jobs
|
||||
.Where(j => j.UserId != null && j.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(j => j.UserId != null && j.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Select(j => j.UserId)
|
||||
.Distinct();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Database.Jobs
|
||||
.Where(j => j.UserId != null && j.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(j => j.UserId != null && j.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId))
|
||||
.Select(j => j.UserId)
|
||||
.Distinct();
|
||||
}
|
||||
@@ -183,13 +183,13 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
return Database.Users
|
||||
.Where(u => u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(u => u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Select(u => u.UserId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Database.Users
|
||||
.Where(u => u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(u => u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId))
|
||||
.Select(u => u.UserId);
|
||||
}
|
||||
default:
|
||||
@@ -208,7 +208,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
.Where(d => d.SerialNumber == DeviceSerialNumber && d.AssignedUser != null)
|
||||
.Select(d => Tuple.Create(
|
||||
d.AssignedUserId,
|
||||
d.DeviceAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate)))
|
||||
d.DeviceAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate)))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
@@ -217,7 +217,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
.Where(d => d.SerialNumber == DeviceSerialNumber && d.AssignedUser != null)
|
||||
.Select(d => Tuple.Create(
|
||||
d.AssignedUserId,
|
||||
d.DeviceAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId)))
|
||||
d.DeviceAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId)))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
.Where(j => j.Id == JobId && j.UserId != null)
|
||||
.Select(j => Tuple.Create(
|
||||
j.UserId,
|
||||
j.User.Jobs.Any(uj => uj.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))))
|
||||
j.User.Jobs.Any(uj => uj.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate))))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
@@ -279,7 +279,7 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
.Where(j => j.Id == JobId && j.UserId != null)
|
||||
.Select(j => Tuple.Create(
|
||||
j.UserId,
|
||||
j.User.Jobs.Any(uj => uj.JobAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId))))
|
||||
j.User.Jobs.Any(uj => uj.JobAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId))))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
@@ -328,13 +328,13 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
{
|
||||
return Database.Users
|
||||
.Where(u => u.UserId == UserId)
|
||||
.Any(u => u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate));
|
||||
.Any(u => u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId && a.Timestamp >= Configuration.FilterBeginDate));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Database.Users
|
||||
.Where(u => u.UserId == UserId)
|
||||
.Any(u => u.UserAttachments.Any(a => a.DocumentTemplateId == this.DocumentTemplateId));
|
||||
.Any(u => u.UserAttachments.Any(a => a.DocumentTemplateId == DocumentTemplateId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,13 +369,13 @@ namespace Disco.Services.Documents.ManagedGroups
|
||||
if (Configuration.FilterBeginDate.HasValue)
|
||||
{
|
||||
relevantDevice = Event.Database.Devices
|
||||
.Where(d => d.SerialNumber == deviceSerialNumber && d.DeviceAttachments.Any(ja => ja.DocumentTemplateId == this.DocumentTemplateId && ja.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Where(d => d.SerialNumber == deviceSerialNumber && d.DeviceAttachments.Any(ja => ja.DocumentTemplateId == DocumentTemplateId && ja.Timestamp >= Configuration.FilterBeginDate))
|
||||
.Any();
|
||||
}
|
||||
else
|
||||
{
|
||||
relevantDevice = Event.Database.Devices
|
||||
.Where(d => d.SerialNumber == deviceSerialNumber && d.DeviceAttachments.Any(ja => ja.DocumentTemplateId == this.DocumentTemplateId))
|
||||
.Where(d => d.SerialNumber == deviceSerialNumber && d.DeviceAttachments.Any(ja => ja.DocumentTemplateId == DocumentTemplateId))
|
||||
.Any();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Disco.Services.Expressions
|
||||
return null;
|
||||
else
|
||||
if (_EvaluateParseException == null)
|
||||
_EvaluateParseException = EvaluateExpressionParseException.FromRecognitionException(_ExpressionParseException, this.Source);
|
||||
_EvaluateParseException = EvaluateExpressionParseException.FromRecognitionException(_ExpressionParseException, Source);
|
||||
return _EvaluateParseException;
|
||||
}
|
||||
}
|
||||
@@ -44,38 +44,38 @@ namespace Disco.Services.Expressions
|
||||
|
||||
public EvaluateExpressionPart(string Source)
|
||||
{
|
||||
this.RawSource = Source;
|
||||
RawSource = Source;
|
||||
|
||||
if (Source.StartsWith("{") && Source.EndsWith("}"))
|
||||
Source = Source.Substring(1, Source.Length - 2);
|
||||
|
||||
if (Source[0] == '~')
|
||||
{
|
||||
this.ErrorsAllowed = true;
|
||||
ErrorsAllowed = true;
|
||||
this.Source = Source.Substring(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ErrorsAllowed = false;
|
||||
ErrorsAllowed = false;
|
||||
this.Source = Source;
|
||||
}
|
||||
try
|
||||
{
|
||||
this._Expression = Spring.Expressions.Expression.Parse(this.Source);
|
||||
_Expression = Spring.Expressions.Expression.Parse(this.Source);
|
||||
|
||||
}
|
||||
catch (RecognitionException ex)
|
||||
{
|
||||
this._ExpressionParseException = ex;
|
||||
_ExpressionParseException = ex;
|
||||
}
|
||||
}
|
||||
object IExpressionPart.Evaluate(object ExpressionContext, IDictionary Variables)
|
||||
{
|
||||
if (this._ExpressionParseException == null)
|
||||
if (_ExpressionParseException == null)
|
||||
{
|
||||
return this._Expression.GetValue(ExpressionContext, Variables);
|
||||
return _Expression.GetValue(ExpressionContext, Variables);
|
||||
}
|
||||
throw this._ExpressionParseException;
|
||||
throw _ExpressionParseException;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Disco.Services.Expressions
|
||||
public T EvaluateFirst<T>(object ExpressionContext, IDictionary Variables)
|
||||
{
|
||||
T result = default(T);
|
||||
if (this.Count > 0)
|
||||
if (Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Disco.Services.Expressions
|
||||
// Run in Background 5 Second after Scheduled (on App Startup)
|
||||
TriggerBuilder triggerBuilder = TriggerBuilder.Create().StartAt(new DateTimeOffset(DateTime.Now).AddSeconds(5));
|
||||
|
||||
this.ScheduleTask(triggerBuilder);
|
||||
ScheduleTask(triggerBuilder);
|
||||
}
|
||||
|
||||
protected override void ExecuteTask()
|
||||
|
||||
+7
-7
@@ -15,10 +15,10 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
|
||||
public BaseImageExpressionResult()
|
||||
{
|
||||
this.LosslessFormat = false;
|
||||
this.Quality = 90;
|
||||
this.ShowField = false;
|
||||
this.BackgroundPreferTransparent = true;
|
||||
LosslessFormat = false;
|
||||
Quality = 90;
|
||||
ShowField = false;
|
||||
BackgroundPreferTransparent = true;
|
||||
}
|
||||
|
||||
public abstract Stream GetImage(int Width, int Height);
|
||||
@@ -35,10 +35,10 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
Brush backgroundBrush = null;
|
||||
if (!LosslessFormat || !BackgroundPreferTransparent)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.BackgroundColour))
|
||||
if (string.IsNullOrEmpty(BackgroundColour))
|
||||
backgroundBrush = Brushes.White;
|
||||
else
|
||||
backgroundBrush = new SolidBrush(ColorTranslator.FromHtml(this.BackgroundColour));
|
||||
backgroundBrush = new SolidBrush(ColorTranslator.FromHtml(BackgroundColour));
|
||||
}
|
||||
|
||||
using (Image resizedImage = SourceImage.ResizeImage(Width, Height, backgroundBrush))
|
||||
@@ -56,7 +56,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
}
|
||||
else
|
||||
{ // Lossy Format - JPG
|
||||
byte quality = Math.Min((byte)100, Math.Max((byte)1, this.Quality));
|
||||
byte quality = Math.Min((byte)100, Math.Max((byte)1, Quality));
|
||||
SourceImage.SaveJpg(quality, imageStream);
|
||||
}
|
||||
imageStream.Position = 0;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
|
||||
public override Stream GetImage(int Width, int Height)
|
||||
{
|
||||
return this.RenderImage(this.Image, Width, Height);
|
||||
return RenderImage(Image, Width, Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,9 +20,9 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
|
||||
public override Stream GetImage(int Width, int Height)
|
||||
{
|
||||
using (Image SourceImage = Bitmap.FromFile(this.AbsoluteFilePath))
|
||||
using (Image SourceImage = Bitmap.FromFile(AbsoluteFilePath))
|
||||
{
|
||||
return this.RenderImage(SourceImage, Width, Height);
|
||||
return RenderImage(SourceImage, Width, Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+17
-17
@@ -23,8 +23,8 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
throw new ArgumentException("AbsoluteFilePaths is empty", "AbsoluteFilePaths");
|
||||
|
||||
this.AbsoluteFilePaths = AbsoluteFilePaths;
|
||||
this.MontageTableLayout = true;
|
||||
this.Padding = 4;
|
||||
MontageTableLayout = true;
|
||||
Padding = 4;
|
||||
}
|
||||
|
||||
public override Stream GetImage(int Width, int Height)
|
||||
@@ -33,7 +33,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
try
|
||||
{
|
||||
// Load Images
|
||||
foreach (string imageFilePath in this.AbsoluteFilePaths)
|
||||
foreach (string imageFilePath in AbsoluteFilePaths)
|
||||
Images.Add(Bitmap.FromFile(imageFilePath));
|
||||
|
||||
// Build Montage
|
||||
@@ -49,21 +49,21 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
if (!LosslessFormat || !BackgroundPreferTransparent)
|
||||
{
|
||||
Brush backgroundBrush = Brushes.White;
|
||||
if (!string.IsNullOrEmpty(this.BackgroundColour))
|
||||
backgroundBrush = new SolidBrush(ColorTranslator.FromHtml(this.BackgroundColour));
|
||||
if (!string.IsNullOrEmpty(BackgroundColour))
|
||||
backgroundBrush = new SolidBrush(ColorTranslator.FromHtml(BackgroundColour));
|
||||
montageGraphics.FillRectangle(backgroundBrush, montageGraphics.VisibleClipBounds);
|
||||
}
|
||||
|
||||
if (this.MontageHorizontalLayout)
|
||||
if (MontageHorizontalLayout)
|
||||
DoHorizontalLayout(Images, montageGraphics);
|
||||
else
|
||||
if (this.MontageVerticalLayout)
|
||||
if (MontageVerticalLayout)
|
||||
DoVirticalLayout(Images, montageGraphics);
|
||||
else
|
||||
DoTableLayout(Images, montageGraphics);
|
||||
}
|
||||
|
||||
return this.OutputImage(montageImage);
|
||||
return OutputImage(montageImage);
|
||||
}
|
||||
}
|
||||
catch (Exception) { throw; }
|
||||
@@ -83,7 +83,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
float imagePosition = 0;
|
||||
int imagesWidthTotal = Images.Sum(i => i.Width);
|
||||
int imagesHeightMax = Images.Max(i => i.Height);
|
||||
int imagesPadding = ((Images.Count - 1) * this.Padding);
|
||||
int imagesPadding = ((Images.Count - 1) * Padding);
|
||||
|
||||
imageScale = (float)(MontageGraphics.VisibleClipBounds.Width - imagesPadding) / (float)imagesWidthTotal;
|
||||
if ((MontageGraphics.VisibleClipBounds.Height / (float)imagesHeightMax) < imageScale)
|
||||
@@ -91,7 +91,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
foreach (Image image in Images)
|
||||
{
|
||||
MontageGraphics.DrawImageResized(image, imageScale, imagePosition, 0);
|
||||
imagePosition += (imageScale * image.Width) + this.Padding;
|
||||
imagePosition += (imageScale * image.Width) + Padding;
|
||||
}
|
||||
}
|
||||
private void DoVirticalLayout(List<Image> Images, Graphics MontageGraphics)
|
||||
@@ -100,7 +100,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
float imagePosition = 0;
|
||||
int imagesWidthMax = Images.Max(i => i.Width);
|
||||
int imagesHeightTotal = Images.Sum(i => i.Height);
|
||||
int imagesPadding = ((Images.Count - 1) * this.Padding);
|
||||
int imagesPadding = ((Images.Count - 1) * Padding);
|
||||
|
||||
imageScale = (float)(MontageGraphics.VisibleClipBounds.Height - imagesPadding) / (float)imagesHeightTotal;
|
||||
if ((MontageGraphics.VisibleClipBounds.Width / (float)imagesWidthMax) < imageScale)
|
||||
@@ -108,7 +108,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
foreach (Image image in Images)
|
||||
{
|
||||
MontageGraphics.DrawImageResized(image, imageScale, 0, imagePosition);
|
||||
imagePosition += (imageScale * image.Height) + this.Padding;
|
||||
imagePosition += (imageScale * image.Height) + Padding;
|
||||
}
|
||||
}
|
||||
private void DoTableLayout(List<Image> Images, Graphics MontageGraphics)
|
||||
@@ -118,8 +118,8 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
|
||||
var calculatedLayout = CalculateColumnCount(stageSize, itemAverageSize, Images.Count);
|
||||
|
||||
SizeF cellSize = new SizeF((MontageGraphics.VisibleClipBounds.Width - ((calculatedLayout.Item1 - 1) * this.Padding)) / calculatedLayout.Item1,
|
||||
(MontageGraphics.VisibleClipBounds.Height - ((calculatedLayout.Item2 - 1) * this.Padding)) / calculatedLayout.Item2);
|
||||
SizeF cellSize = new SizeF((MontageGraphics.VisibleClipBounds.Width - ((calculatedLayout.Item1 - 1) * Padding)) / calculatedLayout.Item1,
|
||||
(MontageGraphics.VisibleClipBounds.Height - ((calculatedLayout.Item2 - 1) * Padding)) / calculatedLayout.Item2);
|
||||
|
||||
int imageIndex = 0;
|
||||
for (int rowIndex = 0; rowIndex < calculatedLayout.Item2; rowIndex++)
|
||||
@@ -129,7 +129,7 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
if (imageIndex < Images.Count)
|
||||
{
|
||||
var image = Images[imageIndex];
|
||||
var cellPoint = new PointF((cellSize.Width * columnIndex) + (this.Padding * columnIndex), (cellSize.Height * rowIndex) + (this.Padding * rowIndex));
|
||||
var cellPoint = new PointF((cellSize.Width * columnIndex) + (Padding * columnIndex), (cellSize.Height * rowIndex) + (Padding * rowIndex));
|
||||
MontageGraphics.Clip = new Region(new RectangleF(cellPoint, cellSize));
|
||||
MontageGraphics.DrawImageResized(image);
|
||||
imageIndex++;
|
||||
@@ -151,8 +151,8 @@ namespace Disco.Services.Expressions.Extensions.ImageResultImplementations
|
||||
{
|
||||
int rowCount = (int)Math.Ceiling((double)ItemCount / (double)columnCount);
|
||||
|
||||
int requiredWidthPadding = (columnCount - 1) * this.Padding;
|
||||
int requiredHeightPadding = (rowCount - 1) * this.Padding;
|
||||
int requiredWidthPadding = (columnCount - 1) * Padding;
|
||||
int requiredHeightPadding = (rowCount - 1) * Padding;
|
||||
Size usableStageSize = new Size(StageSize.Width - requiredWidthPadding, StageSize.Height - requiredHeightPadding);
|
||||
double stageWidthRatio = (float)usableStageSize.Width / (float)usableStageSize.Height;
|
||||
double stageHeightRatio = (float)usableStageSize.Height / (float)usableStageSize.Width;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Disco.Services.Expressions
|
||||
{
|
||||
public class TextExpressionPart : IExpressionPart
|
||||
@@ -22,7 +19,7 @@ namespace Disco.Services.Expressions
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Source;
|
||||
return _Source;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -33,7 +30,7 @@ namespace Disco.Services.Expressions
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Source;
|
||||
return _Source;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -63,11 +60,11 @@ namespace Disco.Services.Expressions
|
||||
|
||||
public TextExpressionPart(string Source)
|
||||
{
|
||||
this._Source = Source;
|
||||
_Source = Source;
|
||||
}
|
||||
object IExpressionPart.Evaluate(object ExpressionContext, System.Collections.IDictionary Variables)
|
||||
{
|
||||
return this._Source;
|
||||
return _Source;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Disco
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Extensions
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
var trigger = TriggerBuilder.Create()
|
||||
.StartAt(DateTimeOffset.Now.AddMinutes(3));
|
||||
|
||||
this.ScheduleTask(trigger);
|
||||
ScheduleTask(trigger);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DirectoryServices;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
@@ -38,8 +34,8 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (this.Entry != null)
|
||||
return this.Entry.Path;
|
||||
if (Entry != null)
|
||||
return Entry.Path;
|
||||
else
|
||||
return base.ToString();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DirectoryServices.ActiveDirectory;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
@@ -43,19 +43,19 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public ADDomain(ActiveDirectoryContext Context, Domain Domain)
|
||||
{
|
||||
this.context = Context;
|
||||
context = Context;
|
||||
|
||||
this.Domain = Domain;
|
||||
this.SearchContainers = null;
|
||||
this.domainControllers = null;
|
||||
this.domainMaintenanceNext = DateTime.Now.AddMinutes(DomainMaintanceIntervalMinutes);
|
||||
SearchContainers = null;
|
||||
domainControllers = null;
|
||||
domainMaintenanceNext = DateTime.Now.AddMinutes(DomainMaintanceIntervalMinutes);
|
||||
|
||||
this.Initialize();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
this.Name = Domain.Name;
|
||||
Name = Domain.Name;
|
||||
|
||||
var dc = Domain.FindDomainController();
|
||||
|
||||
@@ -63,26 +63,26 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
using (var adRootDSE = new DirectoryEntry(ldapPath + "RootDSE"))
|
||||
{
|
||||
this.DistinguishedName = adRootDSE.Properties["defaultNamingContext"][0].ToString();
|
||||
this.ConfigurationNamingContext = adRootDSE.Properties["configurationNamingContext"][0].ToString();
|
||||
DistinguishedName = adRootDSE.Properties["defaultNamingContext"][0].ToString();
|
||||
ConfigurationNamingContext = adRootDSE.Properties["configurationNamingContext"][0].ToString();
|
||||
}
|
||||
|
||||
using (var adDomainRoot = new DirectoryEntry(ldapPath + this.DistinguishedName))
|
||||
using (var adDomainRoot = new DirectoryEntry(ldapPath + DistinguishedName))
|
||||
{
|
||||
this.SecurityIdentifier = new SecurityIdentifier((byte[])(adDomainRoot.Properties["objectSid"][0]), 0);
|
||||
SecurityIdentifier = new SecurityIdentifier((byte[])(adDomainRoot.Properties["objectSid"][0]), 0);
|
||||
}
|
||||
|
||||
using (var configSearchRoot = new DirectoryEntry(ldapPath + "CN=Partitions," + this.ConfigurationNamingContext))
|
||||
using (var configSearchRoot = new DirectoryEntry(ldapPath + "CN=Partitions," + ConfigurationNamingContext))
|
||||
{
|
||||
var configSearchFilter = string.Format("(&(objectcategory=Crossref)(dnsRoot={0})(netBIOSName=*))", this.Name);
|
||||
var configSearchFilter = string.Format("(&(objectcategory=Crossref)(dnsRoot={0})(netBIOSName=*))", Name);
|
||||
|
||||
using (var configSearcher = new DirectorySearcher(configSearchRoot, configSearchFilter, new string[] { "NetBIOSName" }, System.DirectoryServices.SearchScope.OneLevel))
|
||||
{
|
||||
SearchResult configResult = configSearcher.FindOne();
|
||||
if (configResult != null)
|
||||
this.NetBiosName = configResult.Properties["NetBIOSName"][0].ToString();
|
||||
NetBiosName = configResult.Properties["NetBIOSName"][0].ToString();
|
||||
else
|
||||
this.NetBiosName = null;
|
||||
NetBiosName = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,17 +91,17 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public IEnumerable<ADDomainController> GetAllReachableDomainControllers()
|
||||
{
|
||||
return this.Domain.FindAllDomainControllers().WhereReachable().Select(dc => new ADDomainController(this.context, dc, this, dc.SiteName == this.context.Site.Name, false));
|
||||
return Domain.FindAllDomainControllers().WhereReachable().Select(dc => new ADDomainController(context, dc, this, dc.SiteName == context.Site.Name, false));
|
||||
}
|
||||
|
||||
public IEnumerable<ADDomainController> GetReachableSiteDomainControllers()
|
||||
{
|
||||
return this.DomainControllers.Where(dc => dc.IsSiteServer && dc.DomainController.IsReachable());
|
||||
return DomainControllers.Where(dc => dc.IsSiteServer && dc.DomainController.IsReachable());
|
||||
}
|
||||
|
||||
public ADDomainController GetAvailableDomainController(bool RequireWritable = false)
|
||||
{
|
||||
if (this.domainMaintenanceNext < DateTime.Now)
|
||||
if (domainMaintenanceNext < DateTime.Now)
|
||||
MaintainDomainControllers();
|
||||
|
||||
IEnumerable<ADDomainController> availableServers;
|
||||
@@ -144,7 +144,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
}
|
||||
private IEnumerable<ADDomainController> AvailableDomainControllers(bool RequireSiteServer, bool RequireWritable)
|
||||
{
|
||||
IEnumerable<ADDomainController> query = this.DomainControllers.Where(dc => dc.IsAvailable);
|
||||
IEnumerable<ADDomainController> query = DomainControllers.Where(dc => dc.IsAvailable);
|
||||
if (RequireSiteServer)
|
||||
query = query.Where(dc => dc.IsSiteServer);
|
||||
if (RequireWritable)
|
||||
@@ -160,11 +160,11 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
else
|
||||
locatorOptions = LocatorOptions.ForceRediscovery;
|
||||
|
||||
var dc = this.Domain.FindDomainController(locatorOptions);
|
||||
var dc = Domain.FindDomainController(locatorOptions);
|
||||
|
||||
var dcName = dc.Name;
|
||||
|
||||
var existingDC = this.DomainControllers.FirstOrDefault(edc => edc.Name == dcName);
|
||||
var existingDC = DomainControllers.FirstOrDefault(edc => edc.Name == dcName);
|
||||
|
||||
if (existingDC != null)
|
||||
{
|
||||
@@ -183,10 +183,10 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
// New DC discovered
|
||||
|
||||
var adDC = new ADDomainController(this.context, dc, this, dc.SiteName == this.context.Site.Name, RequireWritable);
|
||||
var adDC = new ADDomainController(context, dc, this, dc.SiteName == context.Site.Name, RequireWritable);
|
||||
|
||||
// Add DC to Available Servers
|
||||
this.domainControllers.Push(adDC);
|
||||
domainControllers.Push(adDC);
|
||||
|
||||
return adDC;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
lock (domainMaintainLock)
|
||||
{
|
||||
var servers = this.domainControllers.ToList();
|
||||
var servers = domainControllers.ToList();
|
||||
|
||||
var nonSiteServersPresent = servers.Any(s => !s.IsSiteServer);
|
||||
|
||||
@@ -216,13 +216,13 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
UpdateDomainControllers(servers.Where(s => s.IsSiteServer || s.IsAvailable));
|
||||
}
|
||||
}
|
||||
this.domainMaintenanceNext = DateTime.Now.AddMinutes(DomainMaintanceIntervalMinutes);
|
||||
domainMaintenanceNext = DateTime.Now.AddMinutes(DomainMaintanceIntervalMinutes);
|
||||
}
|
||||
}
|
||||
|
||||
internal void UpdateDomainControllers(IEnumerable<ADDomainController> DomainControllers)
|
||||
{
|
||||
this.domainControllers = new ConcurrentStack<ADDomainController>(DomainControllers);
|
||||
domainControllers = new ConcurrentStack<ADDomainController>(DomainControllers);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -233,7 +233,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
throw new ArgumentNullException("DistinguishedName");
|
||||
|
||||
if (!DistinguishedName.EndsWith(this.DistinguishedName, StringComparison.OrdinalIgnoreCase))
|
||||
throw new ArgumentException(string.Format("The Distinguished Name ({0}) isn't a member of this domain [{1}]", DistinguishedName, this.Name), "DistinguishedName");
|
||||
throw new ArgumentException(string.Format("The Distinguished Name ({0}) isn't a member of this domain [{1}]", DistinguishedName, Name), "DistinguishedName");
|
||||
|
||||
var dc = GetAvailableDomainController();
|
||||
|
||||
@@ -244,12 +244,12 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public IEnumerable<ADSearchResult> SearchEntireDomain(string LdapFilter, string[] LoadProperties, int? ResultLimit = null)
|
||||
{
|
||||
return SearchInternal(this.DistinguishedName, LdapFilter, LoadProperties, ResultLimit);
|
||||
return SearchInternal(DistinguishedName, LdapFilter, LoadProperties, ResultLimit);
|
||||
}
|
||||
|
||||
public IEnumerable<ADSearchResult> SearchScope(string LdapFilter, string[] LoadProperties, int? ResultLimit = null)
|
||||
{
|
||||
var searchScope = this.SearchContainers;
|
||||
var searchScope = SearchContainers;
|
||||
|
||||
// No scope set, search entire domain
|
||||
if (searchScope == null)
|
||||
@@ -322,11 +322,11 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
internal void UpdateSearchContainers(List<string> Containers)
|
||||
{
|
||||
this.SearchContainers = Containers ?? new List<string>();
|
||||
SearchContainers = Containers ?? new List<string>();
|
||||
}
|
||||
internal void UpdateSearchEntireDomain()
|
||||
{
|
||||
this.SearchContainers = null;
|
||||
SearchContainers = null;
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
@@ -335,7 +335,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("CN=Computers,{0}", this.DistinguishedName);
|
||||
return string.Format("CN=Computers,{0}", DistinguishedName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
StringBuilder name = new StringBuilder();
|
||||
|
||||
name.Append('[').Append(this.NetBiosName).Append(']');
|
||||
name.Append('[').Append(NetBiosName).Append(']');
|
||||
|
||||
var subDN = DistinguishedName.Substring(0, DistinguishedName.Length - this.DistinguishedName.Length);
|
||||
var subDNComponents = subDN.Split(',');
|
||||
@@ -365,7 +365,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} [{1}]", this.Name, this.NetBiosName);
|
||||
return string.Format("{0} [{1}]", Name, NetBiosName);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -373,11 +373,11 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (obj == null || !(obj is ADDomain))
|
||||
return false;
|
||||
else
|
||||
return this.DistinguishedName == ((ADDomain)obj).DistinguishedName;
|
||||
return DistinguishedName == ((ADDomain)obj).DistinguishedName;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(this.DistinguishedName);
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(DistinguishedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,18 +45,18 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public ADDomainController(ActiveDirectoryContext Context, DomainController DomainController, ADDomain Domain, bool IsSiteServer, bool IsWritable)
|
||||
{
|
||||
this.context = Context;
|
||||
context = Context;
|
||||
|
||||
this.Domain = Domain;
|
||||
this.DomainController = DomainController;
|
||||
|
||||
this.Name = DomainController.Name;
|
||||
this.SiteName = DomainController.SiteName;
|
||||
Name = DomainController.Name;
|
||||
SiteName = DomainController.SiteName;
|
||||
|
||||
this.IsSiteServer = IsSiteServer;
|
||||
this.IsWritable = IsWritable;
|
||||
|
||||
this.AvailableWhen = null;
|
||||
AvailableWhen = null;
|
||||
}
|
||||
|
||||
public ADDirectoryEntry RetrieveDirectoryEntry(string DistinguishedName, string[] LoadProperties = null)
|
||||
@@ -64,15 +64,15 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (string.IsNullOrWhiteSpace(DistinguishedName))
|
||||
throw new ArgumentNullException("DistinguishedName");
|
||||
|
||||
if (!DistinguishedName.EndsWith(this.Domain.DistinguishedName, StringComparison.OrdinalIgnoreCase))
|
||||
throw new ArgumentException(string.Format("The Distinguished Name ({0}) isn't a member of this domain [{1}]", DistinguishedName, this.Domain.Name), "DistinguishedName");
|
||||
if (!DistinguishedName.EndsWith(Domain.DistinguishedName, StringComparison.OrdinalIgnoreCase))
|
||||
throw new ArgumentException(string.Format("The Distinguished Name ({0}) isn't a member of this domain [{1}]", DistinguishedName, Domain.Name), "DistinguishedName");
|
||||
|
||||
var entry = new DirectoryEntry(string.Format(LdapPathTemplate, this.Name, ADHelpers.EscapeDistinguishedName(DistinguishedName)));
|
||||
var entry = new DirectoryEntry(string.Format(LdapPathTemplate, Name, ADHelpers.EscapeDistinguishedName(DistinguishedName)));
|
||||
|
||||
if (LoadProperties != null)
|
||||
entry.RefreshCache(LoadProperties);
|
||||
|
||||
return new ADDirectoryEntry(this.Domain, this, entry);
|
||||
return new ADDirectoryEntry(Domain, this, entry);
|
||||
}
|
||||
|
||||
#region Searching
|
||||
@@ -83,7 +83,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public IEnumerable<ADSearchResult> SearchScope(string LdapFilter, string[] LoadProperties, int? ResultLimit = null)
|
||||
{
|
||||
var searchScope = this.Domain.SearchContainers;
|
||||
var searchScope = Domain.SearchContainers;
|
||||
|
||||
// No scope set, search entire domain
|
||||
if (searchScope == null)
|
||||
@@ -109,7 +109,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (ResultLimit.HasValue && ResultLimit.Value < 1)
|
||||
throw new ArgumentOutOfRangeException("ResultLimit", "The ResultLimit must be 1 or greater");
|
||||
|
||||
using (ADDirectoryEntry rootEntry = this.RetrieveDirectoryEntry(SearchRoot))
|
||||
using (ADDirectoryEntry rootEntry = RetrieveDirectoryEntry(SearchRoot))
|
||||
{
|
||||
using (DirectorySearcher searcher = new DirectorySearcher(rootEntry.Entry, LdapFilter, LoadProperties, System.DirectoryServices.SearchScope.Subtree))
|
||||
{
|
||||
@@ -174,7 +174,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
ldapFilter = string.Format(ADMachineAccount.LdapNetbootGuidSingleFilterTemplate, MacAddressNetbootGUID.Value.ToLdapQueryFormat());
|
||||
}
|
||||
adResult = this.SearchEntireDomain(ldapFilter, loadProperites, ActiveDirectory.SingleSearchResult).FirstOrDefault();
|
||||
adResult = SearchEntireDomain(ldapFilter, loadProperites, ActiveDirectory.SingleSearchResult).FirstOrDefault();
|
||||
}
|
||||
|
||||
if (adResult != null)
|
||||
@@ -212,7 +212,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
? ADGroup.LoadProperties.Concat(AdditionalProperties).ToArray()
|
||||
: ADGroup.LoadProperties;
|
||||
|
||||
using (var groupEntry = this.RetrieveDirectoryEntry(DistinguishedName, loadProperites))
|
||||
using (var groupEntry = RetrieveDirectoryEntry(DistinguishedName, loadProperites))
|
||||
{
|
||||
if (groupEntry == null)
|
||||
return null;
|
||||
@@ -224,8 +224,8 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
if (SecurityIdentifier == null)
|
||||
throw new ArgumentNullException("SecurityIdentifier");
|
||||
if (!SecurityIdentifier.IsEqualDomainSid(this.Domain.SecurityIdentifier))
|
||||
throw new ArgumentException(string.Format("The specified Security Identifier [{0}] does not belong to this domain [{1}]", SecurityIdentifier.ToString(), this.Domain.Name), "SecurityIdentifier");
|
||||
if (!SecurityIdentifier.IsEqualDomainSid(Domain.SecurityIdentifier))
|
||||
throw new ArgumentException(string.Format("The specified Security Identifier [{0}] does not belong to this domain [{1}]", SecurityIdentifier.ToString(), Domain.Name), "SecurityIdentifier");
|
||||
|
||||
var sidBinaryString = SecurityIdentifier.ToBinaryString();
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
? ADGroup.LoadProperties.Concat(AdditionalProperties).ToArray()
|
||||
: ADGroup.LoadProperties;
|
||||
|
||||
var result = this.SearchEntireDomain(ldapFilter, loadProperites, ActiveDirectory.SingleSearchResult).FirstOrDefault();
|
||||
var result = SearchEntireDomain(ldapFilter, loadProperites, ActiveDirectory.SingleSearchResult).FirstOrDefault();
|
||||
if (result == null)
|
||||
return null;
|
||||
else
|
||||
@@ -280,7 +280,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
Dictionary<string, List<ADOrganisationalUnit>> resultTree = new Dictionary<string, List<ADOrganisationalUnit>>();
|
||||
|
||||
var unsortedOrganisationalUnits = this.SearchEntireDomain(OrganisationalUnitsLdapFilter, OrganisationalUnitsLoadProperties)
|
||||
var unsortedOrganisationalUnits = SearchEntireDomain(OrganisationalUnitsLdapFilter, OrganisationalUnitsLoadProperties)
|
||||
.Select(r => r.AsADOrganisationalUnit()).ToList();
|
||||
|
||||
var indexedOrganisationalUnits = unsortedOrganisationalUnits.ToDictionary(k => k.DistinguishedName);
|
||||
@@ -307,12 +307,12 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
var slashIndex = Id.IndexOf('\\');
|
||||
|
||||
if (!this.Domain.NetBiosName.Equals(Id.Substring(0, slashIndex), StringComparison.OrdinalIgnoreCase))
|
||||
throw new ArgumentException(string.Format("The Id [{0}] is invalid for this domain [{1}]", Id, this.Domain.Name), "Id");
|
||||
if (!Domain.NetBiosName.Equals(Id.Substring(0, slashIndex), StringComparison.OrdinalIgnoreCase))
|
||||
throw new ArgumentException(string.Format("The Id [{0}] is invalid for this domain [{1}]", Id, Domain.Name), "Id");
|
||||
|
||||
var ldapFilter = string.Format(LdapFilterTemplate, Id.Substring(slashIndex + 1));
|
||||
|
||||
return this.SearchEntireDomain(ldapFilter, LoadProperties, ActiveDirectory.SingleSearchResult).FirstOrDefault();
|
||||
return SearchEntireDomain(ldapFilter, LoadProperties, ActiveDirectory.SingleSearchResult).FirstOrDefault();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -321,7 +321,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
using (Ping p = new Ping())
|
||||
{
|
||||
var pr = p.Send(this.Name, 1000);
|
||||
var pr = p.Send(Name, 1000);
|
||||
return (pr.Status == IPStatus.Success);
|
||||
}
|
||||
}
|
||||
@@ -331,8 +331,8 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (MachineAccount != null && MachineAccount.IsCriticalSystemObject)
|
||||
throw new InvalidOperationException(string.Format("This account {0} is a Critical System Active Directory Object and Disco refuses to modify it", MachineAccount.DistinguishedName));
|
||||
|
||||
if (!this.IsWritable)
|
||||
throw new InvalidOperationException(string.Format("The domain controller [{0}] is not writable. This action (Offline Domain Join Provision) requires a writable domain controller.", this.Name));
|
||||
if (!IsWritable)
|
||||
throw new InvalidOperationException(string.Format("The domain controller [{0}] is not writable. This action (Offline Domain Join Provision) requires a writable domain controller.", Name));
|
||||
|
||||
StringBuilder diagnosticInfo = new StringBuilder();
|
||||
string DJoinResult = null;
|
||||
@@ -349,7 +349,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var deOU = this.RetrieveDirectoryEntry(OrganisationalUnit, new string[] { "distinguishedName" }))
|
||||
using (var deOU = RetrieveDirectoryEntry(OrganisationalUnit, new string[] { "distinguishedName" }))
|
||||
{
|
||||
if (deOU == null)
|
||||
throw new Exception(string.Format("OU's Directory Entry couldn't be found at [{0}]", OrganisationalUnit));
|
||||
@@ -367,8 +367,8 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
string tempFileName = System.IO.Path.GetTempFileName();
|
||||
string argumentOU = (!string.IsNullOrWhiteSpace(OrganisationalUnit)) ? string.Format(" /MACHINEOU \"{0}\"", OrganisationalUnit) : string.Empty;
|
||||
string arguments = string.Format("/PROVISION /DOMAIN \"{0}\" /DCNAME \"{1}\" /MACHINE \"{2}\"{3} /REUSE /SAVEFILE \"{4}\"",
|
||||
this.Domain.Name,
|
||||
this.Name,
|
||||
Domain.Name,
|
||||
Name,
|
||||
ComputerSamAccountName,
|
||||
argumentOU,
|
||||
tempFileName
|
||||
@@ -409,7 +409,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
DiagnosticInformation = diagnosticInfo.ToString();
|
||||
|
||||
// Reload Machine Account
|
||||
MachineAccount = this.RetrieveADMachineAccount(string.Format(@"{0}\{1}", this.Domain.NetBiosName, ComputerSamAccountName), (MachineAccount == null ? null : MachineAccount.LoadedProperties.Keys.ToArray()));
|
||||
MachineAccount = RetrieveADMachineAccount(string.Format(@"{0}\{1}", Domain.NetBiosName, ComputerSamAccountName), (MachineAccount == null ? null : MachineAccount.LoadedProperties.Keys.ToArray()));
|
||||
|
||||
return DJoinResult;
|
||||
}
|
||||
@@ -417,7 +417,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
return Name;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -425,11 +425,11 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (obj == null || !(obj is ADDomainController))
|
||||
return false;
|
||||
else
|
||||
return this.Name == ((ADDomainController)obj).Name;
|
||||
return Name == ((ADDomainController)obj).Name;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(this.Name);
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DirectoryServices;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
|
||||
@@ -22,7 +21,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
public string SamAccountName { get; private set; }
|
||||
|
||||
public string Name { get; private set; }
|
||||
public string DisplayName { get { return this.Name; } }
|
||||
public string DisplayName { get { return Name; } }
|
||||
|
||||
public List<string> MemberOf { get; private set; }
|
||||
|
||||
@@ -105,18 +104,18 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
switch (PropertyName.ToLower())
|
||||
{
|
||||
case "name":
|
||||
return new string[] { this.Name }.OfType<T>();
|
||||
return new string[] { Name }.OfType<T>();
|
||||
case "samaccountname":
|
||||
return new string[] { this.SamAccountName }.OfType<T>();
|
||||
return new string[] { SamAccountName }.OfType<T>();
|
||||
case "distinguishedname":
|
||||
return new string[] { this.DistinguishedName }.OfType<T>();
|
||||
return new string[] { DistinguishedName }.OfType<T>();
|
||||
case "objectsid":
|
||||
return new SecurityIdentifier[] { this.SecurityIdentifier }.OfType<T>();
|
||||
return new SecurityIdentifier[] { SecurityIdentifier }.OfType<T>();
|
||||
case "memberof":
|
||||
return this.MemberOf.OfType<T>();
|
||||
return MemberOf.OfType<T>();
|
||||
default:
|
||||
object[] adProperty;
|
||||
if (this.LoadedProperties.TryGetValue(PropertyName, out adProperty))
|
||||
if (LoadedProperties.TryGetValue(PropertyName, out adProperty))
|
||||
return adProperty.OfType<T>();
|
||||
else
|
||||
return Enumerable.Empty<T>();
|
||||
@@ -125,7 +124,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Id;
|
||||
return Id;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -133,11 +132,11 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (obj == null || !(obj is ADGroup))
|
||||
return false;
|
||||
else
|
||||
return this.DistinguishedName == ((ADGroup)obj).DistinguishedName;
|
||||
return DistinguishedName == ((ADGroup)obj).DistinguishedName;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(this.DistinguishedName);
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(DistinguishedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public ADGroup GetGroup()
|
||||
{
|
||||
return ActiveDirectory.RetrieveADGroup(this.Configuration.GroupId, "member");
|
||||
return ActiveDirectory.RetrieveADGroup(Configuration.GroupId, "member");
|
||||
}
|
||||
|
||||
protected void AddMember(string Id)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services.Logging;
|
||||
using Disco.Services.Tasks;
|
||||
using Quartz;
|
||||
using System;
|
||||
@@ -20,23 +19,23 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
TriggerBuilder triggerBuilder = TriggerBuilder.Create().
|
||||
WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(23, 0));
|
||||
|
||||
this.ScheduleTask(triggerBuilder);
|
||||
ScheduleTask(triggerBuilder);
|
||||
}
|
||||
|
||||
protected override void ExecuteTask()
|
||||
{
|
||||
int changeCount;
|
||||
|
||||
List<ADManagedGroup> managedGroups = this.ExecutionContext.JobDetail.JobDataMap["ManagedGroups"] as List<ADManagedGroup>;
|
||||
List<ADManagedGroup> managedGroups = ExecutionContext.JobDetail.JobDataMap["ManagedGroups"] as List<ADManagedGroup>;
|
||||
if (managedGroups == null)
|
||||
managedGroups = ActiveDirectory.Context.ManagedGroups.Values;
|
||||
|
||||
this.Status.UpdateStatus(0, "Synchronising Active Directory Managed Groups", "Starting");
|
||||
Status.UpdateStatus(0, "Synchronising Active Directory Managed Groups", "Starting");
|
||||
|
||||
changeCount = ActiveDirectory.Context.ManagedGroups.SyncManagedGroups(managedGroups, this.Status);
|
||||
changeCount = ActiveDirectory.Context.ManagedGroups.SyncManagedGroups(managedGroups, Status);
|
||||
|
||||
Status.LogInformation($"Synchronised Active Directory Managed Groups, {changeCount:N0} changes made");
|
||||
this.Status.SetFinishedMessage(string.Format("Made {0} Changes to Active Directory Groups", changeCount));
|
||||
Status.SetFinishedMessage(string.Format("Made {0} Changes to Active Directory Groups", changeCount));
|
||||
}
|
||||
|
||||
public static ScheduledTaskStatus ScheduleSync(ADManagedGroup ManagedGroup)
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
int changeCount;
|
||||
|
||||
this.Status.UpdateStatus(1, "Starting", "Connecting to the Database and initializing the environment");
|
||||
Status.UpdateStatus(1, "Starting", "Connecting to the Database and initializing the environment");
|
||||
using (DiscoDataContext database = new DiscoDataContext())
|
||||
{
|
||||
UpdateLastNetworkLogonDates(database, this.Status);
|
||||
UpdateLastNetworkLogonDates(database, Status);
|
||||
Status.UpdateStatus(95, "Updating Database", "Writing last network logon dates to the Database");
|
||||
changeCount = database.SaveChanges();
|
||||
Status.Finished(string.Format("{0} Device last network logon dates updated", changeCount), "/Config/SystemConfig");
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
return Name;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -36,11 +36,11 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (obj == null || !(obj is ADOrganisationalUnit))
|
||||
return false;
|
||||
else
|
||||
return this.DistinguishedName == ((ADOrganisationalUnit)obj).DistinguishedName;
|
||||
return DistinguishedName == ((ADOrganisationalUnit)obj).DistinguishedName;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(this.DistinguishedName);
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(DistinguishedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public ADSearchResult(ADDomain Domain, ADDomainController DomainController, string SearchPath, string LdapFilter, SearchResult Result)
|
||||
{
|
||||
this._result = Result;
|
||||
_result = Result;
|
||||
this.Domain = Domain;
|
||||
this.DomainController = DomainController;
|
||||
this.SearchPath = SearchPath;
|
||||
this.LdapFilter = LdapFilter;
|
||||
|
||||
this.LdapPath = _result.Path;
|
||||
this.DistinguishedName = Value<string>("dn");
|
||||
LdapPath = _result.Path;
|
||||
DistinguishedName = Value<string>("dn");
|
||||
}
|
||||
|
||||
public bool Contains(string PropertyName)
|
||||
@@ -47,7 +47,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.LdapPath;
|
||||
return LdapPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public ADSite(ActiveDirectoryContext Context, ActiveDirectorySite Site)
|
||||
{
|
||||
this.context = Context;
|
||||
context = Context;
|
||||
|
||||
this.Site = Site;
|
||||
|
||||
this.Name = Site.Name;
|
||||
this.DomainControllers = null;
|
||||
Name = Site.Name;
|
||||
DomainControllers = null;
|
||||
}
|
||||
|
||||
internal void UpdateDomainControllers(IEnumerable<ADDomainController> DomainControllers)
|
||||
@@ -31,7 +31,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
return Name;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -39,11 +39,11 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (obj == null || !(obj is ADSite))
|
||||
return false;
|
||||
else
|
||||
return this.Name == ((ADSite)obj).Name;
|
||||
return Name == ((ADSite)obj).Name;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(this.Name);
|
||||
return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
using Disco.Models.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using Disco.Data.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DirectoryServices;
|
||||
using System.DirectoryServices.ActiveDirectory;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Interop.ActiveDirectory
|
||||
@@ -53,22 +51,22 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
private void Initialize(DiscoDataContext Database)
|
||||
{
|
||||
// Search Entire Forest (default: true)
|
||||
this._SearchAllForestServers = Database.DiscoConfiguration.ActiveDirectory.SearchAllForestServers ?? true;
|
||||
_SearchAllForestServers = Database.DiscoConfiguration.ActiveDirectory.SearchAllForestServers ?? true;
|
||||
|
||||
// Set Search LDAP Filters
|
||||
InitializeWildcardSearchSufixOnly(Database.DiscoConfiguration.ActiveDirectory.SearchWildcardSuffixOnly);
|
||||
|
||||
// Determine Site
|
||||
var computerSite = ActiveDirectorySite.GetComputerSite();
|
||||
this.Site = new ADSite(this, computerSite);
|
||||
Site = new ADSite(this, computerSite);
|
||||
|
||||
// Determine Domains
|
||||
var computerDomain = Domain.GetComputerDomain();
|
||||
this.Domains = computerDomain.Forest.Domains
|
||||
Domains = computerDomain.Forest.Domains
|
||||
.Cast<Domain>()
|
||||
.Select(d => new ADDomain(this, d))
|
||||
.ToList();
|
||||
this.PrimaryDomain = this.Domains.Where(d => d.Name == computerDomain.Name).First();
|
||||
PrimaryDomain = Domains.Where(d => d.Name == computerDomain.Name).First();
|
||||
|
||||
// Determine Search Scope Containers
|
||||
ReinitializeSearchContainers(Database.DiscoConfiguration.ActiveDirectory.SearchContainers);
|
||||
@@ -80,7 +78,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
.Select(dc => new ADDomainController(this, dc, GetDomainByName(dc.Domain.Name), IsSiteServer: true, IsWritable: false));
|
||||
|
||||
Site.UpdateDomainControllers(siteDomainControllers);
|
||||
this.Domains.ForEach(domain => domain.UpdateDomainControllers(siteDomainControllers.Where(dc => dc.Domain == domain)));
|
||||
Domains.ForEach(domain => domain.UpdateDomainControllers(siteDomainControllers.Where(dc => dc.Domain == domain)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -90,7 +88,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
public bool TryGetDomainFromDistinguishedName(string DistinguishedName, out ADDomain Domain)
|
||||
{
|
||||
// Find closest match
|
||||
Domain = this.Domains.Where(d => DistinguishedName.EndsWith(d.DistinguishedName, StringComparison.OrdinalIgnoreCase))
|
||||
Domain = Domains.Where(d => DistinguishedName.EndsWith(d.DistinguishedName, StringComparison.OrdinalIgnoreCase))
|
||||
.OrderByDescending(d => d.DistinguishedName.Length).FirstOrDefault();
|
||||
|
||||
return (Domain != null);
|
||||
@@ -105,7 +103,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public bool TryGetDomainByNetBiosName(string NetBiosName, out ADDomain Domain)
|
||||
{
|
||||
Domain = this.Domains.FirstOrDefault(d => d.NetBiosName.Equals(NetBiosName, StringComparison.OrdinalIgnoreCase));
|
||||
Domain = Domains.FirstOrDefault(d => d.NetBiosName.Equals(NetBiosName, StringComparison.OrdinalIgnoreCase));
|
||||
return (Domain != null);
|
||||
}
|
||||
public ADDomain GetDomainByNetBiosName(string NetBiosName)
|
||||
@@ -118,7 +116,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public bool TryGetDomainByName(string Name, out ADDomain Domain)
|
||||
{
|
||||
Domain = this.Domains.FirstOrDefault(d => d.Name.Equals(Name, StringComparison.OrdinalIgnoreCase));
|
||||
Domain = Domains.FirstOrDefault(d => d.Name.Equals(Name, StringComparison.OrdinalIgnoreCase));
|
||||
return (Domain != null);
|
||||
}
|
||||
public ADDomain GetDomainByName(string Name)
|
||||
@@ -131,7 +129,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public bool TryGetDomainFromSecurityIdentifier(SecurityIdentifier SecurityIdentifier, out ADDomain Domain)
|
||||
{
|
||||
Domain = this.Domains.FirstOrDefault(d => d.SecurityIdentifier.IsEqualDomainSid(SecurityIdentifier));
|
||||
Domain = Domains.FirstOrDefault(d => d.SecurityIdentifier.IsEqualDomainSid(SecurityIdentifier));
|
||||
return (Domain != null);
|
||||
}
|
||||
public ADDomain GetDomainFromSecurityIdentifier(SecurityIdentifier SecurityIdentifier)
|
||||
@@ -184,14 +182,14 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public IEnumerable<ADSearchResult> SearchEntireForest(string LdapFilter, string[] LoadProperties, int? ResultLimit = null)
|
||||
{
|
||||
var queries = this.Domains.Select(d => Tuple.Create(d, d.DistinguishedName));
|
||||
var queries = Domains.Select(d => Tuple.Create(d, d.DistinguishedName));
|
||||
|
||||
return SearchInternal(queries, LdapFilter, LoadProperties, ResultLimit);
|
||||
}
|
||||
|
||||
public IEnumerable<ADSearchResult> SearchScope(string LdapFilter, string[] LoadProperties, int? ResultLimit = null)
|
||||
{
|
||||
var queries = this.Domains.SelectMany(
|
||||
var queries = Domains.SelectMany(
|
||||
d => d.SearchContainers ?? new List<string>() { d.DistinguishedName },
|
||||
(d, scope) => Tuple.Create(d, scope));
|
||||
|
||||
@@ -256,7 +254,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (SearchAllForestServers == false)
|
||||
{
|
||||
Database.DiscoConfiguration.ActiveDirectory.SearchAllForestServers = false;
|
||||
this._SearchAllForestServers = false;
|
||||
_SearchAllForestServers = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -265,13 +263,13 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (forestServers.Count <= ActiveDirectory.MaxForestServerSearch)
|
||||
{
|
||||
Database.DiscoConfiguration.ActiveDirectory.SearchAllForestServers = true;
|
||||
this._SearchAllForestServers = true;
|
||||
_SearchAllForestServers = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Database.DiscoConfiguration.ActiveDirectory.SearchAllForestServers = false;
|
||||
this._SearchAllForestServers = false;
|
||||
_SearchAllForestServers = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -315,18 +313,18 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
if (Containers == null)
|
||||
{
|
||||
// No search restrictions (search entire domain)
|
||||
foreach (var domain in this.Domains)
|
||||
foreach (var domain in Domains)
|
||||
domain.UpdateSearchEntireDomain();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restrict search containers
|
||||
var searchContainerDomains = Containers.Join(this.Domains, ok => ok.Key, ik => ik.Name, (o, i) => Tuple.Create(o, i), StringComparer.OrdinalIgnoreCase);
|
||||
var searchContainerDomains = Containers.Join(Domains, ok => ok.Key, ik => ik.Name, (o, i) => Tuple.Create(o, i), StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var domainContainers in searchContainerDomains)
|
||||
domainContainers.Item2.UpdateSearchContainers(domainContainers.Item1.Value);
|
||||
|
||||
// Ignore domains without configured containers
|
||||
var unconfiguredContainers = this.Domains.Except(searchContainerDomains.Select(sc => sc.Item2));
|
||||
var unconfiguredContainers = Domains.Except(searchContainerDomains.Select(sc => sc.Item2));
|
||||
foreach (var domain in unconfiguredContainers)
|
||||
domain.UpdateSearchContainers(new List<string>());
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Interop.ActiveDirectory
|
||||
@@ -21,8 +20,8 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
public ActiveDirectoryGroupCache()
|
||||
{
|
||||
this.securityIdentifierCache = new ConcurrentDictionary<SecurityIdentifier, Tuple<ADGroup, DateTime>>();
|
||||
this.distinguishedNameCache = new ConcurrentDictionary<string, Tuple<ADGroup, DateTime>>(StringComparer.OrdinalIgnoreCase);
|
||||
securityIdentifierCache = new ConcurrentDictionary<SecurityIdentifier, Tuple<ADGroup, DateTime>>();
|
||||
distinguishedNameCache = new ConcurrentDictionary<string, Tuple<ADGroup, DateTime>>(StringComparer.OrdinalIgnoreCase);
|
||||
cacheCleanNext = DateTime.Now.AddMinutes(CacheCleanIntervalMinutes);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Services.Interop.ActiveDirectory
|
||||
@@ -436,7 +434,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
this.ManagedGroup = ManagedGroup;
|
||||
this.ActionType = ActionType;
|
||||
this.InvokingIdentifier = InvokingIdentifier;
|
||||
this.memberResolver = MemberResolver;
|
||||
memberResolver = MemberResolver;
|
||||
}
|
||||
|
||||
public IEnumerable<ADManagedGroupScheduledActionItem> ResolveMembers(DiscoDataContext Database)
|
||||
@@ -448,14 +446,14 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
return Enumerable.Empty<ADManagedGroupScheduledActionItem>();
|
||||
else
|
||||
return members.Select(m =>
|
||||
new ADManagedGroupScheduledActionItem(this.ManagedGroup, this.ActionType, m)
|
||||
new ADManagedGroupScheduledActionItem(ManagedGroup, ActionType, m)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ADManagedGroupScheduledActionItem[]
|
||||
{
|
||||
new ADManagedGroupScheduledActionItem(this.ManagedGroup, this.ActionType, this.InvokingIdentifier)
|
||||
new ADManagedGroupScheduledActionItem(ManagedGroup, ActionType, InvokingIdentifier)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Quartz;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Disco.Services.Interop.DiscoServices
|
||||
@@ -25,7 +23,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
TriggerBuilder triggerBuilder = TriggerBuilder.Create().
|
||||
WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(rndHour, rndMinute));
|
||||
|
||||
this.ScheduleTask(triggerBuilder);
|
||||
ScheduleTask(triggerBuilder);
|
||||
}
|
||||
|
||||
protected override void ExecuteTask()
|
||||
@@ -34,7 +32,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
{
|
||||
Status.UpdateStatus(1, "Updating Plugin Library Manifest", "Initializing");
|
||||
|
||||
var manifest = PluginLibrary.UpdateManifest(database, this.Status);
|
||||
var manifest = PluginLibrary.UpdateManifest(database, Status);
|
||||
|
||||
Status.SetFinishedMessage("The Plugin Library Manifest was updated successfully");
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
TriggerBuilder triggerBuilder = TriggerBuilder.Create().
|
||||
WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(rndHour, rndMinute));
|
||||
|
||||
this.ScheduleTask(triggerBuilder);
|
||||
ScheduleTask(triggerBuilder);
|
||||
}
|
||||
|
||||
protected override void ExecuteTask()
|
||||
|
||||
@@ -7,8 +7,6 @@ using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ using Disco.Services.Authorization;
|
||||
.Subscribe(JobNotification, NotificationError);
|
||||
|
||||
// Initially fill table
|
||||
base.Items = this.SortFunction(this.DetermineItems(Database, this.FilterFunction(Database.Jobs), FilterAuthorization)).ToList();
|
||||
base.Items = SortFunction(this.DetermineItems(Database, FilterFunction(Database.Jobs), FilterAuthorization)).ToList();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ using Disco.Services.Authorization;
|
||||
|
||||
private void NotificationError(Exception ex)
|
||||
{
|
||||
SystemLog.LogException(string.Format("Disco.Services.Jobs.JobLists.ManagedJobList: [{0}]", this.Name), ex);
|
||||
SystemLog.LogException(string.Format("Disco.Services.Jobs.JobLists.ManagedJobList: [{0}]", Name), ex);
|
||||
}
|
||||
|
||||
private void JobNotification(RepositoryMonitorEvent e)
|
||||
@@ -262,7 +262,7 @@ using Disco.Services.Authorization;
|
||||
if (existingItems == null)
|
||||
existingItems = base.Items.Where(i => jobIds.Contains(i.JobId)).ToArray();
|
||||
|
||||
var updatedItems = this.DetermineItems(Database, this.FilterFunction(Database.Jobs.Where(j => jobIds.Contains(j.Id))), false);
|
||||
var updatedItems = this.DetermineItems(Database, FilterFunction(Database.Jobs.Where(j => jobIds.Contains(j.Id))), false);
|
||||
|
||||
var refreshedList = base.Items.ToList();
|
||||
|
||||
@@ -277,7 +277,7 @@ using Disco.Services.Authorization;
|
||||
refreshedList.Add(updatedItem);
|
||||
|
||||
// Reorder
|
||||
base.Items = this.SortFunction(refreshedList).ToList();
|
||||
base.Items = SortFunction(refreshedList).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ using Disco.Services.Web.Signalling;
|
||||
using Microsoft.AspNet.SignalR;
|
||||
using Microsoft.AspNet.SignalR.Hubs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Services.Users;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Expressions;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -29,15 +29,15 @@ namespace Disco.Services.Jobs.Noticeboards
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(this.DeviceComputerNameFriendly);
|
||||
StringBuilder sb = new StringBuilder(DeviceComputerNameFriendly);
|
||||
|
||||
if (UserId != null)
|
||||
sb.Append(" - ").Append(this.UserDisplayName).Append(" (").Append(this.UserIdFriendly).Append(")");
|
||||
sb.Append(" - ").Append(UserDisplayName).Append(" (").Append(UserIdFriendly).Append(")");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.DeviceLocation))
|
||||
sb.Append(" - ").Append(this.DeviceLocation);
|
||||
if (!string.IsNullOrWhiteSpace(DeviceLocation))
|
||||
sb.Append(" - ").Append(DeviceLocation);
|
||||
else if (UserId == null)
|
||||
sb.Append(" - ").Append(this.DeviceSerialNumber);
|
||||
sb.Append(" - ").Append(DeviceSerialNumber);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
@@ -108,10 +108,10 @@ namespace Disco.Services.Jobs.Noticeboards
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.ReadyForReturn && (this.ReadyForReturnSince.Value < DateTime.Now.AddDays(-3)))
|
||||
if (ReadyForReturn && (ReadyForReturnSince.Value < DateTime.Now.AddDays(-3)))
|
||||
return true;
|
||||
|
||||
if (this.WaitingForUserAction && (this.WaitingForUserActionSince.Value < DateTime.Now.AddDays(-6)))
|
||||
if (WaitingForUserAction && (WaitingForUserActionSince.Value < DateTime.Now.AddDays(-6)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Disco.Services.Jobs.Statistics
|
||||
// Trigger Daily @ 12:29am
|
||||
TriggerBuilder triggerBuilder = TriggerBuilder.Create().WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(0, 29));
|
||||
|
||||
this.ScheduleTask(triggerBuilder);
|
||||
ScheduleTask(triggerBuilder);
|
||||
}
|
||||
protected override void ExecuteTask()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Services.Logging
|
||||
{
|
||||
@@ -12,7 +10,7 @@ namespace Disco.Services.Logging
|
||||
public LogBase()
|
||||
{
|
||||
// Cache Event Types
|
||||
_EventTypes = this.LoadEventTypes().ToDictionary(et => et.Id);
|
||||
_EventTypes = LoadEventTypes().ToDictionary(et => et.Id);
|
||||
}
|
||||
|
||||
public abstract int ModuleId { get; }
|
||||
@@ -29,13 +27,13 @@ namespace Disco.Services.Logging
|
||||
}
|
||||
protected void Log(int EventTypeId, params object[] Args)
|
||||
{
|
||||
LogContext.Current.Log(this.ModuleId, EventTypeId, Args);
|
||||
LogContext.Current.Log(ModuleId, EventTypeId, Args);
|
||||
}
|
||||
public string LiveLogGroupName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ModuleName;
|
||||
return ModuleName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Data.Repository;
|
||||
using System.IO;
|
||||
using System.Management;
|
||||
using System.Diagnostics;
|
||||
using System.Data.SqlServerCe;
|
||||
using System.Data.EntityClient;
|
||||
using System.Data.Entity;
|
||||
using Quartz;
|
||||
using Quartz.Impl;
|
||||
using Quartz.Impl.Triggers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Disco.Services.Logging
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Quartz;
|
||||
using Quartz;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Services.Logging
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Disco.Services.Logging.Models
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user