Update #42: AD Migration
Refactor to target specific Domain Controllers, with failover.
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
using Disco.Models.Interop.ActiveDirectory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Web.Areas.API.Models.AuthorizationRole
|
||||
{
|
||||
public class SubjectItem
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Type { get; set; }
|
||||
|
||||
public static SubjectItem FromActiveDirectoryObject(IActiveDirectoryObject ADObject)
|
||||
{
|
||||
return new Models.AuthorizationRole.SubjectItem()
|
||||
{
|
||||
Id = ADObject.NetBiosId,
|
||||
Name = ADObject.DisplayName,
|
||||
Type = ADObject is ActiveDirectoryGroup ? "group" : "user"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using Disco.Models.Interop.ActiveDirectory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Web.Areas.API.Models.JobQueue
|
||||
{
|
||||
public class SubjectItem
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Type { get; set; }
|
||||
|
||||
public static SubjectItem FromActiveDirectoryObject(IActiveDirectoryObject ADObject)
|
||||
{
|
||||
return new Models.JobQueue.SubjectItem()
|
||||
{
|
||||
Id = ADObject.NetBiosId,
|
||||
Name = ADObject.DisplayName,
|
||||
Type = ADObject is ActiveDirectoryGroup ? "group" : "user"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Web.Areas.API.Models.Shared
|
||||
{
|
||||
public class SubjectDescriptorModel
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Type { get; set; }
|
||||
|
||||
public bool IsGroup { get; set; }
|
||||
public bool IsUserAccount { get; set; }
|
||||
public bool IsMachineAccount { get; set; }
|
||||
|
||||
public static SubjectDescriptorModel FromActiveDirectoryObject(IADObject ADObject)
|
||||
{
|
||||
var item = new SubjectDescriptorModel()
|
||||
{
|
||||
Id = ADObject.Id,
|
||||
Name = ADObject.DisplayName
|
||||
};
|
||||
|
||||
if (ADObject is ADUserAccount)
|
||||
{
|
||||
item.IsUserAccount = true;
|
||||
item.Type = "user";
|
||||
}
|
||||
else if (ADObject is ADGroup)
|
||||
{
|
||||
item.IsGroup = true;
|
||||
item.Type = "group";
|
||||
}
|
||||
else if (ADObject is ADMachineAccount)
|
||||
{
|
||||
item.IsMachineAccount = true;
|
||||
item.Type = "machine";
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Type = "unknown";
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
using Disco.Models.Interop.ActiveDirectory;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Web.Models.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Web.Areas.API.Models.System
|
||||
{
|
||||
public class DomainOrganisationalUnitsModel
|
||||
{
|
||||
public ActiveDirectoryDomain Domain { get; set; }
|
||||
public List<ActiveDirectoryOrganisationalUnit> OrganisationalUnits { get; set; }
|
||||
public ADDomain Domain { get; set; }
|
||||
public List<ADOrganisationalUnit> OrganisationalUnits { get; set; }
|
||||
|
||||
public FancyTreeNode ToFancyTreeNode()
|
||||
{
|
||||
@@ -21,13 +19,13 @@ namespace Disco.Web.Areas.API.Models.System
|
||||
key = Domain.DistinguishedName,
|
||||
title = Domain.NetBiosName,
|
||||
folder = true,
|
||||
tooltip = Domain.DnsName,
|
||||
tooltip = Domain.Name,
|
||||
children = children,
|
||||
unselectable = false,
|
||||
expanded = true
|
||||
};
|
||||
}
|
||||
private FancyTreeNode OrganisationalUnitToFancyTreeNode(ActiveDirectoryOrganisationalUnit OrganisationalUnit)
|
||||
private FancyTreeNode OrganisationalUnitToFancyTreeNode(ADOrganisationalUnit OrganisationalUnit)
|
||||
{
|
||||
FancyTreeNode[] children = OrganisationalUnit.Children == null
|
||||
? null
|
||||
|
||||
Reference in New Issue
Block a user