Bug Fix #58: Fail to assign MacSecureEnrol devices

Various code-paths *assumed* valid domain account ids as long as an id
existed (simple null-check). Correct checks for valid domain account ids
has been implemented.
This commit is contained in:
Gary Sharp
2014-07-10 18:33:05 +10:00
parent 2274e2201d
commit 9bfa95e263
4 changed files with 72 additions and 74 deletions
+2 -4
View File
@@ -177,13 +177,11 @@ namespace Disco.BI.Extensions
}
// Update AD Account
if (!string.IsNullOrEmpty(d.DeviceDomainId))
if (ActiveDirectory.IsValidDomainAccountId(d.DeviceDomainId))
{
var adMachineAccount = ActiveDirectory.RetrieveADMachineAccount(d.DeviceDomainId);
if (adMachineAccount != null)
{
adMachineAccount.SetDescription(d);
}
}
return newDua;
@@ -191,7 +189,7 @@ namespace Disco.BI.Extensions
public static ADMachineAccount ActiveDirectoryAccount(this Device Device, params string[] AdditionalProperties)
{
if (!string.IsNullOrEmpty(Device.DeviceDomainId))
if (ActiveDirectory.IsValidDomainAccountId(Device.DeviceDomainId))
return ActiveDirectory.RetrieveADMachineAccount(Device.DeviceDomainId, AdditionalProperties: AdditionalProperties);
else
return null;