Update #42: AD Migration
Refactor to target specific Domain Controllers, with failover.
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.Entity" />
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -47,9 +46,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BI\Job\LocationModes.cs" />
|
||||
<Compile Include="Interop\ActiveDirectory\ActiveDirectoryDomain.cs" />
|
||||
<Compile Include="Interop\ActiveDirectory\ActiveDirectoryOrganisationalUnit.cs" />
|
||||
<Compile Include="Interop\ActiveDirectory\ActiveDirectorySearchResult.cs" />
|
||||
<Compile Include="Services\Authorization\IAuthorizationToken.cs" />
|
||||
<Compile Include="Services\Authorization\IClaimNavigatorItem.cs" />
|
||||
<Compile Include="Services\Authorization\IRoleToken.cs" />
|
||||
@@ -76,10 +72,6 @@
|
||||
<Compile Include="ClientServices\Enrol.cs" />
|
||||
<Compile Include="ClientServices\WhoAmI.cs" />
|
||||
<Compile Include="ClientServices\WhoAmIResponse.cs" />
|
||||
<Compile Include="Interop\ActiveDirectory\ActiveDirectoryMachineAccount.cs" />
|
||||
<Compile Include="Interop\ActiveDirectory\ActiveDirectoryGroup.cs" />
|
||||
<Compile Include="Interop\ActiveDirectory\ActiveDirectoryUserAccount.cs" />
|
||||
<Compile Include="Interop\ActiveDirectory\IActiveDirectoryObject.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Repository\ConfigurationItem.cs" />
|
||||
<Compile Include="Repository\Device\Device.cs" />
|
||||
@@ -172,7 +164,7 @@
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" />
|
||||
<UserProperties BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
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,21 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Disco.Models.Interop.ActiveDirectory
|
||||
{
|
||||
public class ActiveDirectoryGroup : IActiveDirectoryObject
|
||||
{
|
||||
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 string DisplayName { get { return this.Name; } }
|
||||
|
||||
public List<string> MemberOf { get; set; }
|
||||
|
||||
public string NetBiosId { get { return string.Format(@"{0}\{1}", Domain, SamAccountName); } }
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using Disco.Models.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Disco.Models.Interop.ActiveDirectory
|
||||
{
|
||||
public class ActiveDirectoryMachineAccount : IActiveDirectoryObject
|
||||
{
|
||||
|
||||
public string Domain { 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 DisplayName { get { return this.Name; } }
|
||||
public string DnsName { get; set; }
|
||||
public Guid NetbootGUID { get; set; }
|
||||
|
||||
public bool IsCriticalSystemObject { get; set; }
|
||||
public Dictionary<string, object[]> LoadedProperties { get; set; }
|
||||
|
||||
public User ToRepositoryUser()
|
||||
{
|
||||
return new User
|
||||
{
|
||||
UserId = this.Domain + "\\" + this.SamAccountName,
|
||||
DisplayName = this.Name
|
||||
};
|
||||
}
|
||||
|
||||
public string NetBiosId { get { return string.Format(@"{0}\{1}", Domain, SamAccountName); } }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Models.Interop.ActiveDirectory
|
||||
{
|
||||
public class ActiveDirectoryUserAccount : IActiveDirectoryObject
|
||||
{
|
||||
public string Domain { get; set; }
|
||||
public string SamAccountName { get; set; }
|
||||
|
||||
public string DistinguishedName { get; set; }
|
||||
public string SecurityIdentifier { get; set; }
|
||||
public string Path { 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
|
||||
{
|
||||
UserId = this.Domain + "\\" + this.SamAccountName,
|
||||
DisplayName = this.DisplayName,
|
||||
Surname = this.Surname,
|
||||
GivenName = this.GivenName,
|
||||
EmailAddress = this.Email,
|
||||
PhoneNumber = this.Phone,
|
||||
};
|
||||
}
|
||||
|
||||
public string NetBiosId { get { return string.Format(@"{0}\{1}", Domain, SamAccountName); } }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
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; }
|
||||
string DisplayName { get; }
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,9 @@ namespace Disco.Models.Repository
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DeviceDomainId == null)
|
||||
return null;
|
||||
|
||||
var index = DeviceDomainId.IndexOf('\\');
|
||||
return index < 0 ? DeviceDomainId : DeviceDomainId.Substring(index + 1);
|
||||
}
|
||||
@@ -82,6 +85,9 @@ namespace Disco.Models.Repository
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DeviceDomainId == null)
|
||||
return null;
|
||||
|
||||
var index = DeviceDomainId.IndexOf('\\');
|
||||
return index < 0 ? null : DeviceDomainId.Substring(0, index);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Disco.Models.Repository
|
||||
|
||||
public void UpdateSelf(User u)
|
||||
{
|
||||
if (!this.UserId.Equals(u.UserId, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (!this.UserId.Equals(u.UserId, StringComparison.OrdinalIgnoreCase))
|
||||
throw new ArgumentException("User Id's do not match", "u");
|
||||
|
||||
if (this.Surname != u.Surname)
|
||||
|
||||
Reference in New Issue
Block a user