Skip to content

Commit

Permalink
build: merge release into main eclipse-tractusx#962
Browse files Browse the repository at this point in the history
Reviewed-By: Martin Rohrmeier <martin.ra.rohrmeier@bmw.de>
  • Loading branch information
Phil91 authored Aug 30, 2024
2 parents 983d132 + 7c71e1a commit df8be4a
Show file tree
Hide file tree
Showing 51 changed files with 10,728 additions and 470 deletions.
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,11 @@
"${commentprefix#} ${cx_header_with_#}",
"${commentend#}"
]
}
},
"cSpell.enableFiletypes": [
"dockercompose",
"dotenv",
"editorconfig"
],
"dotnet-test-explorer.testProjectPath": "tests/**/*csproj"
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

New features, fixed bugs, known defects and other noteworthy changes to each release of the Catena-X Portal Backend.

## 2.2.0-RC3

### Bugfixes

* **REgistration Process**
* removed DIM authentication details from logs [#951](https://github.com/eclipse-tractusx/portal-backend/pull/951)
* adjust retrigger process for sd creation [#938](https://github.com/eclipse-tractusx/portal-backend/pull/938)
* **Connector creation**
* adjusted the host and provider company for managed connectors [#948](https://github.com/eclipse-tractusx/portal-backend/pull/948)
* **Technical Users**
* adjusted logic to delete external technical users [#956](https://github.com/eclipse-tractusx/portal-backend/pull/956)

## 2.2.0-RC2

### Change
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix>RC2</VersionSuffix>
<VersionSuffix>RC3</VersionSuffix>
</PropertyGroup>
</Project>
56 changes: 28 additions & 28 deletions src/Portal.Backend.sln
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityProviderProvisionin
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserProvisioning.Executor.Tests", "..\tests\processes\UserProvisioning.Executor.Tests\UserProvisioning.Executor.Tests.csproj", "{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfDescriptionCreation.Executor", "processes\SelfDescriptionCreation.Executor\SelfDescriptionCreation.Executor.csproj", "{08535520-F6E6-4DAF-AB36-12C48437368A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfDescriptionCreation.Executor", "processes\SelfDescriptionCreation.Executor\SelfDescriptionCreation.Executor.csproj", "{D8EBE555-F103-4D05-9697-5381E4DE1DFE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfDescriptionCreation.Executor.Tests", "..\tests\processes\SelfDescriptionCreation.Executor.Tests\SelfDescriptionCreation.Executor.Tests.csproj", "{E87898BA-59A4-4F02-9594-50756BBF4E22}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfDescriptionCreation.Executor.Tests", "..\tests\processes\SelfDescriptionCreation.Executor.Tests\SelfDescriptionCreation.Executor.Tests.csproj", "{AA14B842-6A65-40BB-818A-D450F66F4101}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -1798,30 +1798,30 @@ Global
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|x64.Build.0 = Release|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|x86.ActiveCfg = Release|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|x86.Build.0 = Release|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Debug|x64.ActiveCfg = Debug|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Debug|x64.Build.0 = Debug|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Debug|x86.ActiveCfg = Debug|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Debug|x86.Build.0 = Debug|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Release|Any CPU.Build.0 = Release|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Release|x64.ActiveCfg = Release|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Release|x64.Build.0 = Release|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Release|x86.ActiveCfg = Release|Any CPU
{08535520-F6E6-4DAF-AB36-12C48437368A}.Release|x86.Build.0 = Release|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Debug|x64.ActiveCfg = Debug|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Debug|x64.Build.0 = Debug|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Debug|x86.ActiveCfg = Debug|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Debug|x86.Build.0 = Debug|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Release|Any CPU.Build.0 = Release|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Release|x64.ActiveCfg = Release|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Release|x64.Build.0 = Release|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Release|x86.ActiveCfg = Release|Any CPU
{E87898BA-59A4-4F02-9594-50756BBF4E22}.Release|x86.Build.0 = Release|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Debug|x64.ActiveCfg = Debug|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Debug|x64.Build.0 = Debug|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Debug|x86.ActiveCfg = Debug|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Debug|x86.Build.0 = Debug|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Release|Any CPU.Build.0 = Release|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Release|x64.ActiveCfg = Release|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Release|x64.Build.0 = Release|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Release|x86.ActiveCfg = Release|Any CPU
{D8EBE555-F103-4D05-9697-5381E4DE1DFE}.Release|x86.Build.0 = Release|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Debug|x64.ActiveCfg = Debug|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Debug|x64.Build.0 = Debug|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Debug|x86.ActiveCfg = Debug|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Debug|x86.Build.0 = Debug|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Release|Any CPU.Build.0 = Release|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Release|x64.ActiveCfg = Release|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Release|x64.Build.0 = Release|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Release|x86.ActiveCfg = Release|Any CPU
{AA14B842-6A65-40BB-818A-D450F66F4101}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1956,7 +1956,7 @@ Global
{143433B2-2792-4C5F-A3C2-E5C91D68E30D} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{9636BEC8-6929-4852-8DC8-8B41609630A3} = {282CEF03-292F-4A49-83C6-997567D0FF5F}
{E5494227-BDFE-41F2-A12F-54292D76C29F} = {282CEF03-292F-4A49-83C6-997567D0FF5F}
{08535520-F6E6-4DAF-AB36-12C48437368A} = {282CEF03-292F-4A49-83C6-997567D0FF5F}
{E87898BA-59A4-4F02-9594-50756BBF4E22} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{D8EBE555-F103-4D05-9697-5381E4DE1DFE} = {282CEF03-292F-4A49-83C6-997567D0FF5F}
{AA14B842-6A65-40BB-818A-D450F66F4101} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
using Org.Eclipse.TractusX.Portal.Backend.Processes.Library;
using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library;
using System.Collections.Immutable;
using System.Globalization;
using System.Text.Json;
using System.Text.RegularExpressions;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
Expand Down Expand Up @@ -358,13 +363,6 @@ public async Task<DimUrlsResponse> GetDimServiceUrls()
);
}

public Task<Pagination.Response<CompanyMissingSdDocumentData>> GetCompaniesWithMissingSdDocument(int page, int size) =>
Pagination.CreateResponseAsync(
page,
size,
_settings.MaxPageSize,
portalRepositories.GetInstance<ICompanyRepository>().GetCompaniesWithMissingSdDocument());

/// <inheritdoc />
public async Task<int> DeleteCompanyCertificateAsync(Guid documentId)
{
Expand Down Expand Up @@ -431,6 +429,7 @@ public async Task<int> DeleteCompanyCertificateAsync(Guid documentId)
{
throw new NotFoundException($"Company certificate document {documentId} does not exist");
}

if (!documentDetails.IsStatusLocked)
{
throw new ForbiddenException($"Document {documentId} status is not locked");
Expand All @@ -439,17 +438,42 @@ public async Task<int> DeleteCompanyCertificateAsync(Guid documentId)
return (documentDetails.FileName, documentDetails.Content, documentDetails.MediaTypeId.MapToMediaType());
}

public Task<Pagination.Response<CompanyMissingSdDocumentData>> GetCompaniesWithMissingSdDocument(int page, int size) =>
Pagination.CreateResponseAsync(
page,
size,
_settings.MaxPageSize,
portalRepositories.GetInstance<ICompanyRepository>().GetCompaniesWithMissingSdDocument());

public async Task TriggerSelfDescriptionCreation()
{
var hasMissingSdDocumentCompanies = await portalRepositories.GetInstance<ICompanyRepository>().HasAnyCompaniesWithMissingSelfDescription().ConfigureAwait(ConfigureAwaitOptions.None);
if (hasMissingSdDocumentCompanies)
var companiesWithMissingSd = portalRepositories.GetInstance<ICompanyRepository>().GetCompanyIdsWithMissingSelfDescription();
var processStepRepository = portalRepositories.GetInstance<IProcessStepRepository>();
var companyRepository = portalRepositories.GetInstance<ICompanyRepository>();
await foreach (var companyId in companiesWithMissingSd)
{
var processStepRepository = portalRepositories.GetInstance<IProcessStepRepository>();
var processId = processStepRepository.CreateProcess(ProcessTypeId.SELF_DESCRIPTION_CREATION).Id;

processStepRepository.CreateProcessStep(ProcessStepTypeId.SELF_DESCRIPTION_COMPANY_CREATION, ProcessStepStatusId.TODO, processId);
companyRepository.AttachAndModifyCompany(companyId, c => c.SdCreationProcessId = null, c => c.SdCreationProcessId = processId);
}

await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
}

await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
public async Task RetriggerSelfDescriptionCreation(Guid processId)
{
const ProcessStepTypeId NextStep = ProcessStepTypeId.SELF_DESCRIPTION_COMPANY_CREATION;
const ProcessStepTypeId StepToTrigger = ProcessStepTypeId.RETRIGGER_SELF_DESCRIPTION_COMPANY_CREATION;
var (validProcessId, processData) = await portalRepositories.GetInstance<IProcessStepRepository>().IsValidProcess(processId, ProcessTypeId.SELF_DESCRIPTION_CREATION, Enumerable.Repeat(StepToTrigger, 1)).ConfigureAwait(ConfigureAwaitOptions.None);
if (!validProcessId)
{
throw new NotFoundException($"process {processId} does not exist");
}

var context = processData.CreateManualProcessData(StepToTrigger, portalRepositories, () => $"processId {processId}");

context.ScheduleProcessSteps(Enumerable.Repeat(NextStep, 1));
context.FinalizeProcessStep();
await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
using Org.Eclipse.TractusX.Portal.Backend.Processes.Library;
using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -157,7 +158,7 @@ private async Task<Guid> CreateManagedConnectorInternalAsync(ManagedConnectorInp

await ValidateTechnicalUser(technicalUserId, result.CompanyId).ConfigureAwait(ConfigureAwaitOptions.None);

var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.CONNECTOR_AS_A_SERVICE, location, result.CompanyId, companyId, technicalUserId);
var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.CONNECTOR_AS_A_SERVICE, location, companyId, result.CompanyId, technicalUserId);
return await CreateAndRegisterConnectorAsync(
connectorRequestModel,
result.ProviderBpn,
Expand Down Expand Up @@ -346,7 +347,7 @@ public IAsyncEnumerable<ConnectorEndPointData> GetCompanyConnectorEndPointAsync(
/// <inheritdoc />
public async Task ProcessClearinghouseSelfDescription(SelfDescriptionResponseData data, CancellationToken cancellationToken)
{
logger.LogInformation("Process SelfDescription called with the following data {Data}", data.ToString().Replace(Environment.NewLine, string.Empty));
logger.LogInformation("Process SelfDescription called with the following data {@Data}", data.ToString().Replace(Environment.NewLine, string.Empty));

var result = await portalRepositories.GetInstance<IConnectorsRepository>()
.GetConnectorDataById(data.ExternalId)
Expand Down Expand Up @@ -433,14 +434,33 @@ public IAsyncEnumerable<OfferSubscriptionConnectorData> GetConnectorOfferSubscri

public async Task TriggerSelfDescriptionCreation()
{
var hasMissingSdDocumentConnectors = await portalRepositories.GetInstance<IConnectorsRepository>().HasAnyConnectorsWithMissingSelfDescription().ConfigureAwait(ConfigureAwaitOptions.None);
if (hasMissingSdDocumentConnectors)
var connectorRepository = portalRepositories.GetInstance<IConnectorsRepository>();
var processStepRepository = portalRepositories.GetInstance<IProcessStepRepository>();
var connectorIds = connectorRepository.GetConnectorIdsWithMissingSelfDescription();
await foreach (var connectorId in connectorIds)
{
var processStepRepository = portalRepositories.GetInstance<IProcessStepRepository>();
var processId = processStepRepository.CreateProcess(ProcessTypeId.SELF_DESCRIPTION_CREATION).Id;
processStepRepository.CreateProcessStep(ProcessStepTypeId.SELF_DESCRIPTION_CONNECTOR_CREATION, ProcessStepStatusId.TODO, processId);
connectorRepository.AttachAndModifyConnector(connectorId, c => c.SdCreationProcessId = null, c => c.SdCreationProcessId = processId);
}

await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
}

public async Task RetriggerSelfDescriptionCreation(Guid processId)
{
const ProcessStepTypeId NextStep = ProcessStepTypeId.SELF_DESCRIPTION_CONNECTOR_CREATION;
const ProcessStepTypeId StepToTrigger = ProcessStepTypeId.RETRIGGER_SELF_DESCRIPTION_CONNECTOR_CREATION;
var (validProcessId, processData) = await portalRepositories.GetInstance<IProcessStepRepository>().IsValidProcess(processId, ProcessTypeId.SELF_DESCRIPTION_CREATION, Enumerable.Repeat(StepToTrigger, 1)).ConfigureAwait(ConfigureAwaitOptions.None);
if (!validProcessId)
{
throw new NotFoundException($"process {processId} does not exist");
}

var context = processData.CreateManualProcessData(StepToTrigger, portalRepositories, () => $"processId {processId}");

context.ScheduleProcessSteps(Enumerable.Repeat(NextStep, 1));
context.FinalizeProcessStep();
await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/********************************************************************************
* Copyright (c) 2022 BMW Group AG
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
Expand Down Expand Up @@ -53,5 +52,6 @@ public interface ICompanyDataBusinessLogic
Task<Pagination.Response<CompanyCertificateData>> GetAllCompanyCertificatesAsync(int page, int size, CertificateSorting? sorting, CompanyCertificateStatusId? certificateStatus, CompanyCertificateTypeId? certificateType);
Task<DimUrlsResponse> GetDimServiceUrls();
Task<Pagination.Response<CompanyMissingSdDocumentData>> GetCompaniesWithMissingSdDocument(int page, int size);
Task RetriggerSelfDescriptionCreation(Guid processId);
Task TriggerSelfDescriptionCreation();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/********************************************************************************
* Copyright (c) 2022 BMW Group AG
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
Expand Down Expand Up @@ -102,6 +101,6 @@ public interface IConnectorsBusinessLogic
IAsyncEnumerable<OfferSubscriptionConnectorData> GetConnectorOfferSubscriptionData(bool? connectorIdSet);

Task<Pagination.Response<ConnectorMissingSdDocumentData>> GetConnectorsWithMissingSdDocument(int page, int size);

Task TriggerSelfDescriptionCreation();
Task RetriggerSelfDescriptionCreation(Guid processId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public async Task ProcessClearinghouseResponseAsync(ClearinghouseResponseData da
/// <inheritdoc />
public async Task ProcessDimResponseAsync(string bpn, DimWalletData data, CancellationToken cancellationToken)
{
logger.LogInformation("Process Dim called with the following data {Data}", data.ToString().Replace(Environment.NewLine, string.Empty));
logger.LogInformation("Process Dim called with the following data {Data}", data.DidDocument.RootElement.GetRawText().Replace(Environment.NewLine, string.Empty));

await dimBusinessLogic.ProcessDimResponse(bpn, data, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
Expand Down
Loading

0 comments on commit df8be4a

Please sign in to comment.