Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding GetId #47

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.8.0</Version>
<Version>10.8.1</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>User Provider</Title>
<Description>User Provider</Description>
Expand Down
14 changes: 10 additions & 4 deletions src/UserProvider.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Dynamicweb.Data;
using Dynamicweb.Core;
using Dynamicweb.Data;
using Dynamicweb.DataIntegration.Integration;
using Dynamicweb.DataIntegration.Integration.Interfaces;
using Dynamicweb.DataIntegration.ProviderHelpers;
using Dynamicweb.Extensibility.AddIns;
using Dynamicweb.Extensibility.Editors;
using Dynamicweb.Logging;
using Dynamicweb.Security.UserManagement.Common.SystemFields;
using Microsoft.CodeAnalysis;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand All @@ -19,7 +19,7 @@
namespace Dynamicweb.DataIntegration.Providers.UserProvider;

[AddInName("Dynamicweb.DataIntegration.Providers.Provider"), AddInLabel("User Provider"), AddInDescription("User provider"), AddInIgnore(false)]
public class UserProvider : BaseSqlProvider, IParameterOptions
public class UserProvider : BaseSqlProvider, IParameterOptions, ISource, IDestination
{
private Job _job = null;
private UserDestinationWriter Writer = null;
Expand Down Expand Up @@ -476,7 +476,7 @@
case "RepositoriesIndexUpdate":
if (node.HasChildNodes)
{
RepositoriesIndexUpdate = node.FirstChild.Value;

Check warning on line 479 in src/UserProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'UserProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
break;
case "SkipFailingRows":
Expand Down Expand Up @@ -539,11 +539,17 @@
xmlTextWriter.WriteElementString("DeleteOnlyFromGroupsThatAreImportedTo", DeleteOnlyFromGroupsThatAreImportedTo.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("DiscardDuplicates", DiscardDuplicates.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("ImportUsersBelongExactlyImportGroups", ImportUsersBelongExactlyImportGroups.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("RepositoriesIndexUpdate", RepositoriesIndexUpdate);

Check warning on line 542 in src/UserProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'UserProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
xmlTextWriter.WriteElementString("SkipFailingRows", SkipFailingRows.ToString(CultureInfo.CurrentCulture));
GetSchema().SaveAsXml(xmlTextWriter);
if (!Feature.IsActive<SchemaManagementFeature>())
GetSchema().SaveAsXml(xmlTextWriter);
}

string ISource.GetId() => "Source|UserProvider";

string IDestination.GetId() => "Destination|UserProvider";


public override void UpdateSourceSettings(ISource source)
{
UserProvider newProvider = (UserProvider)source;
Expand All @@ -567,7 +573,7 @@
DeleteOnlyFromGroupsThatAreImportedTo = newProvider.DeleteOnlyFromGroupsThatAreImportedTo;
DiscardDuplicates = newProvider.DiscardDuplicates;
ImportUsersBelongExactlyImportGroups = newProvider.ImportUsersBelongExactlyImportGroups;
RepositoriesIndexUpdate = newProvider.RepositoriesIndexUpdate;

Check warning on line 576 in src/UserProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'UserProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'

Check warning on line 576 in src/UserProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'UserProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
SkipFailingRows = newProvider.SkipFailingRows;
SqlConnectionString = newProvider.SqlConnectionString;
ManualConnectionString = newProvider.ManualConnectionString;
Expand Down Expand Up @@ -879,13 +885,13 @@

private void MoveRepositoriesIndexToJob(Job job)
{
if (!string.IsNullOrEmpty(RepositoriesIndexUpdate))

Check warning on line 888 in src/UserProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'UserProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
{
char[] separator = [','];
// if the provider already have RepositoriesIndexUpdate set, then we move them to the job, and set the add-in to string.empty
if (job.RepositoriesIndexSettings?.RepositoriesIndexes?.Count == 0)
{
job.RepositoriesIndexSettings = new RepositoriesIndexSettings(new Collection<string>([.. RepositoriesIndexUpdate.Split(separator, StringSplitOptions.RemoveEmptyEntries)]));

Check warning on line 894 in src/UserProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'UserProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
RepositoriesIndexUpdate = string.Empty;
job.Save();
Expand Down
Loading