Skip to content

Commit

Permalink
Merge pull request #39 from dynamicweb/mss/19895
Browse files Browse the repository at this point in the history
removed local rowsAffected so it now uses the one from BaseSqlWriter …
  • Loading branch information
frederik5480 authored Jul 30, 2024
2 parents 95b429a + 30069ce commit 586d42f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.5.0</Version>
<Version>10.6.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>User Provider</Title>
<Description>User Provider</Description>
Expand All @@ -23,7 +23,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dynamicweb.DataIntegration" Version="10.5.0" />
<PackageReference Include="Dynamicweb.DataIntegration" Version="10.6.3" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
</Project>
8 changes: 0 additions & 8 deletions src/UserDestinationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ internal class UserDestinationWriter : BaseSqlWriter
private List<int> MappingsWithUpdateUsersByCustomerNumberMode = new List<int>();
private TableCollection _schemaTables = null;

/// <summary>
/// Return rows affected
/// </summary>
internal int RowsAffected
{
get; private set;
}

public UserDestinationWriter(Job job, SqlConnection connection,
bool removeMissingUsers, bool generateUserPasswords, bool encryptUserPasswords, bool removeMissingGroups, bool UseEmailForUsername,
string userKeyField, string mailSubject, string senderEmail, string emailTemplate, bool allowEmail, string destinationGroup, bool deleteOnlyFromGroupsThatAreImportedTo, ILogger logger,
Expand Down
13 changes: 9 additions & 4 deletions src/UserProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using Dynamicweb.Extensibility.AddIns;
using Dynamicweb.Extensibility.Editors;
using Dynamicweb.Logging;
using Dynamicweb.Security.Permissions;
using Dynamicweb.Security.UserManagement;
using Dynamicweb.Security.UserManagement.Common.SystemFields;
using Microsoft.CodeAnalysis;
using System;
Expand Down Expand Up @@ -255,6 +253,7 @@ public UserProvider()
UserKeyField = "Auto";
DiscardDuplicates = false;
}

public override Schema GetOriginalSourceSchema()
{
List<string> tablestToKeep = new() { "AccessUser", "AccessUserAddress", "AccessUserSecondaryRelation" };
Expand Down Expand Up @@ -706,8 +705,10 @@ public override bool RunJob(Job job)
while (!reader.IsDone())
{
sourceRow = reader.GetNext();
ProcessInputRow(mapping, sourceRow);
Writer.Write(sourceRow, mapping, discardDuplicates);
if (ProcessInputRow(sourceRow, mapping))
{
Writer.Write(sourceRow, mapping, discardDuplicates);
}
}
}
}
Expand All @@ -720,6 +721,7 @@ public override bool RunJob(Job job)
sqlTransaction.Commit();
Writer.SendUserPasswords();
MoveRepositoriesIndexToJob(job);
TotalRowsAffected += Writer.RowsAffected;
}
catch (Exception ex)
{
Expand Down Expand Up @@ -748,6 +750,9 @@ public override bool RunJob(Job job)

if (sqlTransaction != null)
sqlTransaction.Rollback();

TotalRowsAffected = 0;

return false;
}
finally
Expand Down

0 comments on commit 586d42f

Please sign in to comment.