Update #42: AD Migration

Refactor to target specific Domain Controllers, with failover.
This commit is contained in:
Gary Sharp
2014-04-21 21:43:13 +10:00
parent 43fc622121
commit 09c2a24222
98 changed files with 3808 additions and 3271 deletions
@@ -6,6 +6,7 @@ using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Users;
using Disco.Services.Web;
using Disco.Web.Areas.API.Models.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -27,10 +28,10 @@ namespace Disco.Web.Areas.Config.Controllers
throw new ArgumentException("Invalid Authorization Role Id");
var token = RoleToken.FromAuthorizationRole(ar);
var subjects = token.SubjectIds == null ? new List<Models.AuthorizationRole.SubjectDescriptorModel>() :
token.SubjectIds.Select(subjectId => ActiveDirectory.RetrieveObject(subjectId, Quick: true))
var subjects = token.SubjectIds == null ? new List<SubjectDescriptorModel>() :
token.SubjectIds.Select(subjectId => ActiveDirectory.RetrieveADObject(subjectId, Quick: true))
.Where(item => item != null)
.Select(item => Models.AuthorizationRole.SubjectDescriptorModel.FromActiveDirectoryObject(item))
.Select(item => SubjectDescriptorModel.FromActiveDirectoryObject(item))
.OrderBy(item => item.Name).ToList();
var m = new Models.AuthorizationRole.ShowModel()
@@ -53,9 +54,9 @@ namespace Disco.Web.Areas.Config.Controllers
.Select(ar => RoleToken.FromAuthorizationRole(ar)).Cast<IRoleToken>().ToList();
var administratorSubjects = UserService.AdministratorSubjectIds
.Select(subjectId => ActiveDirectory.RetrieveObject(subjectId, Quick: true))
.Select(subjectId => ActiveDirectory.RetrieveADObject(subjectId, Quick: true))
.Where(item => item != null)
.Select(item => Models.AuthorizationRole.SubjectDescriptorModel.FromActiveDirectoryObject(item))
.Select(item => SubjectDescriptorModel.FromActiveDirectoryObject(item))
.OrderBy(item => item.Name).ToList();
var m = new Models.AuthorizationRole.IndexModel()
@@ -77,7 +77,7 @@ namespace Disco.Web.Areas.Config.Controllers
ComputerNameTemplate = DeviceProfile.DefaultComputerNameTemplate,
ProvisionADAccount = true,
DistributionType = DeviceProfile.DistributionTypes.OneToMany,
OrganisationalUnit = ActiveDirectory.PrimaryDomain.GetDefaultComputerContainer()
OrganisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer
}
};
@@ -6,6 +6,7 @@ using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Jobs.JobQueues;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web;
using Disco.Web.Areas.API.Models.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -28,10 +29,10 @@ namespace Disco.Web.Areas.Config.Controllers
throw new ArgumentException("Invalid Job Queue Id");
var token = JobQueueToken.FromJobQueue(jq);
var subjects = token.SubjectIds == null ? new List<Models.JobQueue.ShowModel.SubjectDescriptor>() :
token.SubjectIds.Select(subjectId => ActiveDirectory.RetrieveObject(subjectId, Quick: true))
var subjects = token.SubjectIds == null ? new List<SubjectDescriptorModel>() :
token.SubjectIds.Select(subjectId => ActiveDirectory.RetrieveADObject(subjectId, Quick: true))
.Where(item => item != null)
.Select(item => Models.JobQueue.ShowModel.SubjectDescriptor.FromActiveDirectoryObject(item))
.Select(item => SubjectDescriptorModel.FromActiveDirectoryObject(item))
.OrderBy(item => item.Name).ToList();
var totalJobCount = Database.JobQueueJobs.Where(jqj => jqj.JobQueueId == id.Value).Select(jqj => jqj.Job).Distinct().Count();