Feature #42: Active Directory Interop Upgrade

AD Interop moved to Disco.Services; Supports multi-domain environments,
sites, and searching restricted with OUs.
This commit is contained in:
Gary Sharp
2014-04-10 17:58:04 +10:00
parent b841c6b2c0
commit db73cc1a12
218 changed files with 6383 additions and 2535 deletions
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.Interop.ActiveDirectory
{
public class ActiveDirectoryDomain
{
public string DnsName { get; private set; }
public string NetBiosName { get; private set; }
public string DistinguishedName { get; private set; }
public List<string> SearchContainers { get; private set; }
public ActiveDirectoryDomain(string DnsName, string NetBiosName, string DistinguishedName, List<string> SearchContainers)
{
this.DnsName = DnsName;
this.NetBiosName = NetBiosName;
this.DistinguishedName = DistinguishedName;
this.SearchContainers = SearchContainers;
}
public void UpdateSearchContainers(IEnumerable<string> Containers)
{
this.SearchContainers = Containers.ToList();
}
}
}
@@ -1,19 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Disco.Models.Interop.ActiveDirectory
{
public class ActiveDirectoryGroup : IActiveDirectoryObject
{
public string Name { get; set; }
public string DistinguishedName { get; set; }
public string Domain { get; set; }
public string SamAccountName { get; set; }
public string DistinguishedName { get; set; }
public string SecurityIdentifier { get; set; }
public string CommonName { get; set; }
public string Name { get; set; }
public List<string> MemberOf { get; set; }
public string NetBiosId { get { return string.Format(@"{0}\{1}", Domain, SamAccountName); } }
}
}
@@ -1,21 +1,23 @@
using System;
using Disco.Models.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Disco.Models.Repository;
namespace Disco.Models.Interop.ActiveDirectory
{
public class ActiveDirectoryMachineAccount : IActiveDirectoryObject
{
public string DistinguishedName { get; set; }
public string DnsName { get; set; }
public string Domain { get; set; }
public string Name { get; set; }
public Guid NetbootGUID { get; set; }
public string SecurityIdentifier { get; set; }
public string Path { get; set; }
public string SamAccountName { get; set; }
public string SecurityIdentifier { get; set; }
public string DistinguishedName { get; set; }
public string Path { get; set; }
public string Name { get; set; }
public string DnsName { get; set; }
public Guid NetbootGUID { get; set; }
public bool IsCriticalSystemObject { get; set; }
public Dictionary<string, object[]> LoadedProperties { get; set; }
@@ -23,10 +25,11 @@ namespace Disco.Models.Interop.ActiveDirectory
{
return new User
{
Id = this.SamAccountName,
UserId = this.Domain + "\\" + this.SamAccountName,
DisplayName = this.Name
};
}
public string NetBiosId { get { return string.Format(@"{0}\{1}", Domain, SamAccountName); } }
}
}
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.Interop.ActiveDirectory
{
public class ActiveDirectoryOrganisationalUnit
{
public string Name { get; set; }
public string Domain { get; set; }
public string DistinguishedName { get; set; }
public List<ActiveDirectoryOrganisationalUnit> Children { get; set; }
}
}
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.DirectoryServices;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.Interop.ActiveDirectory
{
public class ActiveDirectorySearchResult
{
public ActiveDirectoryDomain Domain { get; set; }
public string SearchRoot { get; set; }
public SearchResult Result { get; set; }
}
}
@@ -8,25 +8,29 @@ namespace Disco.Models.Interop.ActiveDirectory
{
public class ActiveDirectoryUserAccount : IActiveDirectoryObject
{
public string DisplayName { get; set; }
public string DistinguishedName { get; set; }
public string Domain { get; set; }
public string Email { get; set; }
public string GivenName { get; set; }
public List<string> Groups { get; set; }
public string Name { get; set; }
public string SamAccountName { get; set; }
public string DistinguishedName { get; set; }
public string SecurityIdentifier { get; set; }
public string Path { get; set; }
public string Phone { get; set; }
public string SamAccountName { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public string Email { get; set; }
public string Surname { get; set; }
public string GivenName { get; set; }
public string Phone { get; set; }
public List<string> Groups { get; set; }
public Dictionary<string, object[]> LoadedProperties { get; set; }
public User ToRepositoryUser()
{
return new User
{
Id = this.SamAccountName,
UserId = this.Domain + "\\" + this.SamAccountName,
DisplayName = this.DisplayName,
Surname = this.Surname,
GivenName = this.GivenName,
@@ -35,5 +39,6 @@ namespace Disco.Models.Interop.ActiveDirectory
};
}
public string NetBiosId { get { return string.Format(@"{0}\{1}", Domain, SamAccountName); } }
}
}
@@ -1,17 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Disco.Models.Interop.ActiveDirectory
{
public interface IActiveDirectoryObject
{
string DistinguishedName { get; set; }
string SecurityIdentifier { get; set; }
string Domain { get; set; }
string SamAccountName { get; set; }
string NetBiosId { get; }
string Name { get; set; }
}