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
@@ -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;
}
}
}