Skip to content

Commit

Permalink
Fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannewington committed Jun 8, 2018
1 parent efb7fc7 commit 78c2ad1
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Lithnet.Okta.ManagementAgent
{
internal class UserExportProvider : IObjectExportProvider
{
private static Logger logger = LogManager.GetCurrentClassLogger();
private static readonly Logger logger = LogManager.GetCurrentClassLogger();

public bool CanExport(CSEntryChange csentry)
{
Expand All @@ -37,10 +37,10 @@ public CSEntryChangeResult PutCSEntryChangeObject(CSEntryChange csentry, ExportC
case ObjectModificationType.Update:
return this.PutCSEntryChangeUpdate(csentry, context);

default:
case ObjectModificationType.Unconfigured:
case ObjectModificationType.None:
case ObjectModificationType.Replace:
case ObjectModificationType.Unconfigured:
default:
throw new InvalidOperationException($"Unknown or unsupported modification type: {csentry.ObjectModificationType} on object {csentry.DN}");
}
}
Expand Down Expand Up @@ -74,7 +74,6 @@ private CSEntryChangeResult PutCSEntryChangeAdd(CSEntryChange csentry, ExportCon
{
provider.Type = new AuthenticationProviderType(change.GetValueAdd<string>());
logger.Info($"Set {change.Name} to {provider.Type ?? "<null>"}");

}
else if (change.Name == "provider.name")
{
Expand Down Expand Up @@ -149,9 +148,10 @@ private CSEntryChangeResult PutCSEntryChangeUpdate(CSEntryChange csentry, Export
bool partial = true;

if (csentry.AttributeChanges.Any(t =>
(t.DataType == AttributeType.Reference && t.IsMultiValued)
|| t.ModificationType == AttributeModificationType.Delete
|| t.Name == "suspended"))
t.ModificationType == AttributeModificationType.Delete
|| t.Name == "suspended"
|| t.DataType == AttributeType.Reference // this should only need to include MV attributes, but there's an issue where MIM sends an attribute update with a value delete for a single valued ref that it doesn't know about
))
{
logger.Trace($"Getting user {csentry.DN} for FULL update");
user = AsyncHelper.RunSync(() => client.Users.GetUserAsync(csentry.DN, context.CancellationTokenSource.Token));
Expand Down Expand Up @@ -216,7 +216,6 @@ private CSEntryChangeResult PutCSEntryChangeUpdate(CSEntryChange csentry, Export
AsyncHelper.RunSync(() => client.Users.UpdateUserAsync(user, csentry.DN, context.CancellationTokenSource.Token));
}


return CSEntryChangeResult.Create(csentry.Identifier, null, MAExportError.Success);
}
}
Expand Down

0 comments on commit 78c2ad1

Please sign in to comment.