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
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>
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;
@@ -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;
@@ -476,7 +476,7 @@
case "RepositoriesIndexUpdate":
if (node.HasChildNodes)
{
RepositoriesIndexUpdate = node.FirstChild.Value;

Check warning on line 479 in src/UserProvider.cs

GitHub Actions / call-workflow / Build

'UserProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
break;
case "SkipFailingRows":
@@ -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

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

GitHub Actions / call-workflow / Build

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

Check warning on line 576 in src/UserProvider.cs

GitHub Actions / call-workflow / Build

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

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

Check warning on line 888 in src/UserProvider.cs

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

GitHub Actions / call-workflow / Build

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

Unchanged files with check annotations Beta

}
}
private string GetValue(ColumnMapping? columnMapping, Dictionary<string, object> row)

Check warning on line 1964 in src/UserDestinationWriter.cs

GitHub Actions / call-workflow / Build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
string? result = null;
if (columnMapping != null && (columnMapping.HasScriptWithValue || row.ContainsKey(columnMapping.SourceColumn.Name)))
conditionalSourceColumnName = UserProvider.GetOriginalColumnNameForGroups(conditional.SourceColumn.Name);
}
conditionalsSql = MappingExtensions.GetConditionalSql(conditionalsSql, conditionalSourceColumnName, conditional, conditionalCount);

Check warning on line 104 in src/UserSourceReader.cs

GitHub Actions / call-workflow / Build

'MappingExtensions.GetConditionalSql(string, string, MappingConditional, int)' is obsolete: 'Use GetConditionalSql(string conditionalsSql, string columnName, MappingConditional mappingConditional, int conditionalCount, ConditionalGroupOperator groupOperator) instead'
if (conditional.SourceColumn.Type == typeof(DateTime))
{
conditionalsSql += " AND ";
if (mapping.SourceTable.Name == "AccessUserGroup")
{
conditionalsSql += string.Format("[AccessUser].[AccessUserType] NOT IN ({0})", string.Join(",", User.GetUserTypes(true)));

Check warning on line 164 in src/UserSourceReader.cs

GitHub Actions / call-workflow / Build

'User.GetUserTypes(bool, bool)' is obsolete: 'Do not use'
}
else
{
conditionalsSql += string.Format("[AccessUser].[AccessUserType] IN ({0})", string.Join(",", User.GetUserTypes(true)));

Check warning on line 168 in src/UserSourceReader.cs

GitHub Actions / call-workflow / Build

'User.GetUserTypes(bool, bool)' is obsolete: 'Do not use'
}
}
if (mapping.SourceTable.Name == "SystemFieldValue")