diff --git a/.vscode/settings.json b/.vscode/settings.json
index f7eb07762b..470c72bd36 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -82,5 +82,11 @@
"${commentprefix#} ${cx_header_with_#}",
"${commentend#}"
]
- }
+ },
+ "cSpell.enableFiletypes": [
+ "dockercompose",
+ "dotenv",
+ "editorconfig"
+ ],
+ "dotnet-test-explorer.testProjectPath": "tests/**/*csproj"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d24faf1cc..d16597c8d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 0a1bbb7255..7fdb463953 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -20,6 +20,6 @@
2.2.0
- RC2
+ RC3
diff --git a/src/Portal.Backend.sln b/src/Portal.Backend.sln
index b940cc935a..45967dba53 100644
--- a/src/Portal.Backend.sln
+++ b/src/Portal.Backend.sln
@@ -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
@@ -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
@@ -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
diff --git a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs
index 0cf42b585b..3a88bd632c 100644
--- a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs
@@ -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;
@@ -358,13 +363,6 @@ public async Task GetDimServiceUrls()
);
}
- public Task> GetCompaniesWithMissingSdDocument(int page, int size) =>
- Pagination.CreateResponseAsync(
- page,
- size,
- _settings.MaxPageSize,
- portalRepositories.GetInstance().GetCompaniesWithMissingSdDocument());
-
///
public async Task DeleteCompanyCertificateAsync(Guid documentId)
{
@@ -431,6 +429,7 @@ public async Task 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");
@@ -439,17 +438,42 @@ public async Task DeleteCompanyCertificateAsync(Guid documentId)
return (documentDetails.FileName, documentDetails.Content, documentDetails.MediaTypeId.MapToMediaType());
}
+ public Task> GetCompaniesWithMissingSdDocument(int page, int size) =>
+ Pagination.CreateResponseAsync(
+ page,
+ size,
+ _settings.MaxPageSize,
+ portalRepositories.GetInstance().GetCompaniesWithMissingSdDocument());
+
public async Task TriggerSelfDescriptionCreation()
{
- var hasMissingSdDocumentCompanies = await portalRepositories.GetInstance().HasAnyCompaniesWithMissingSelfDescription().ConfigureAwait(ConfigureAwaitOptions.None);
- if (hasMissingSdDocumentCompanies)
+ var companiesWithMissingSd = portalRepositories.GetInstance().GetCompanyIdsWithMissingSelfDescription();
+ var processStepRepository = portalRepositories.GetInstance();
+ var companyRepository = portalRepositories.GetInstance();
+ await foreach (var companyId in companiesWithMissingSd)
{
- var processStepRepository = portalRepositories.GetInstance();
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().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);
}
}
diff --git a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs
index 9828763d6d..942ebb4e78 100644
--- a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs
@@ -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;
@@ -157,7 +158,7 @@ private async Task 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,
@@ -346,7 +347,7 @@ public IAsyncEnumerable GetCompanyConnectorEndPointAsync(
///
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()
.GetConnectorDataById(data.ExternalId)
@@ -433,14 +434,33 @@ public IAsyncEnumerable GetConnectorOfferSubscri
public async Task TriggerSelfDescriptionCreation()
{
- var hasMissingSdDocumentConnectors = await portalRepositories.GetInstance().HasAnyConnectorsWithMissingSelfDescription().ConfigureAwait(ConfigureAwaitOptions.None);
- if (hasMissingSdDocumentConnectors)
+ var connectorRepository = portalRepositories.GetInstance();
+ var processStepRepository = portalRepositories.GetInstance();
+ var connectorIds = connectorRepository.GetConnectorIdsWithMissingSelfDescription();
+ await foreach (var connectorId in connectorIds)
{
- var processStepRepository = portalRepositories.GetInstance();
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().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);
}
}
diff --git a/src/administration/Administration.Service/BusinessLogic/ICompanyDataBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ICompanyDataBusinessLogic.cs
index 05ea8fe4bc..24657e66d4 100644
--- a/src/administration/Administration.Service/BusinessLogic/ICompanyDataBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/ICompanyDataBusinessLogic.cs
@@ -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
@@ -53,5 +52,6 @@ public interface ICompanyDataBusinessLogic
Task> GetAllCompanyCertificatesAsync(int page, int size, CertificateSorting? sorting, CompanyCertificateStatusId? certificateStatus, CompanyCertificateTypeId? certificateType);
Task GetDimServiceUrls();
Task> GetCompaniesWithMissingSdDocument(int page, int size);
+ Task RetriggerSelfDescriptionCreation(Guid processId);
Task TriggerSelfDescriptionCreation();
}
diff --git a/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs
index 0f92ba43cc..c1ae735aa8 100644
--- a/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs
@@ -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
@@ -102,6 +101,6 @@ public interface IConnectorsBusinessLogic
IAsyncEnumerable GetConnectorOfferSubscriptionData(bool? connectorIdSet);
Task> GetConnectorsWithMissingSdDocument(int page, int size);
-
Task TriggerSelfDescriptionCreation();
+ Task RetriggerSelfDescriptionCreation(Guid processId);
}
diff --git a/src/administration/Administration.Service/BusinessLogic/RegistrationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/RegistrationBusinessLogic.cs
index 8d78e3abb0..b12daaa6ea 100644
--- a/src/administration/Administration.Service/BusinessLogic/RegistrationBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/RegistrationBusinessLogic.cs
@@ -362,7 +362,7 @@ public async Task ProcessClearinghouseResponseAsync(ClearinghouseResponseData da
///
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);
diff --git a/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs
index 9c88b2a324..971667785d 100644
--- a/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/ServiceAccountBusinessLogic.cs
@@ -28,6 +28,7 @@
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities;
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;
@@ -98,8 +99,14 @@ public async Task DeleteOwnCompanyServiceAccountAsync(Guid serviceAccountId
{
var serviceAccountRepository = portalRepositories.GetInstance();
var companyId = _identityData.CompanyId;
- var result = await serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(serviceAccountId, companyId).ConfigureAwait(ConfigureAwaitOptions.None)
- ?? throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_CONFLICT, [new("serviceAccountId", serviceAccountId.ToString()), new(CompanyId, companyId.ToString())]);
+ var technicalUserCreationSteps = new[]
+ {
+ ProcessStepTypeId.CREATE_DIM_TECHNICAL_USER, ProcessStepTypeId.RETRIGGER_CREATE_DIM_TECHNICAL_USER,
+ ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE,
+ ProcessStepTypeId.RETRIGGER_AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE
+ };
+ var result = await serviceAccountRepository.GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(serviceAccountId, companyId, technicalUserCreationSteps).ConfigureAwait(ConfigureAwaitOptions.None)
+ ?? throw NotFoundException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_FOUND, [new("serviceAccountId", serviceAccountId.ToString()), new(CompanyId, companyId.ToString())]);
if (result.StatusId is ConnectorStatusId.ACTIVE or ConnectorStatusId.PENDING)
{
@@ -112,41 +119,41 @@ public async Task DeleteOwnCompanyServiceAccountAsync(Guid serviceAccountId
}
// serviceAccount
- if (result.IsDimServiceAccount)
+ var userStatus = UserStatusId.DELETED;
+ switch (result)
{
- var processId = result.ProcessId ?? throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_LINKED_TO_PROCESS, [new("serviceAccountId", serviceAccountId.ToString())]);
-
- var processData = await portalRepositories.GetInstance()
- .GetProcessDataForServiceAccountDeletionCallback(processId, null)
- .ConfigureAwait(ConfigureAwaitOptions.None);
-
- var context = processData.ProcessData.CreateManualProcessData(null,
- portalRepositories, () => $"externalId {processId}");
+ case { IsDimServiceAccount: true, CreationProcessInProgress: false }:
+ userStatus = await CreateDeletionProcess(serviceAccountId, result).ConfigureAwait(ConfigureAwaitOptions.None);
+ break;
+ case { IsDimServiceAccount: true, CreationProcessInProgress: true }:
+ throw ConflictException.Create(AdministrationServiceAccountErrors.TECHNICAL_USER_CREATION_IN_PROGRESS);
+ default:
+ if (!string.IsNullOrWhiteSpace(result.ClientClientId))
+ {
+ await provisioningManager.DeleteCentralClientAsync(result.ClientClientId).ConfigureAwait(ConfigureAwaitOptions.None);
+ }
- context.ProcessSteps.Where(step => step.ProcessStepTypeId != ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER).IfAny(pending =>
- throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_PENDING_PROCESS_STEPS, [new("serviceAccountId", serviceAccountId.ToString()), new("processStepTypeIds", string.Join(",", pending))]));
+ break;
+ }
- if (!context.ProcessSteps.Any(step => step.ProcessStepTypeId == ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER))
+ portalRepositories.GetInstance().AttachAndModifyIdentity(
+ serviceAccountId,
+ i =>
{
- portalRepositories.GetInstance().AttachAndModifyIdentity(serviceAccountId, null, i =>
- {
- i.UserStatusId = UserStatusId.PENDING_DELETION;
- });
- context.ScheduleProcessSteps([ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER]);
- context.FinalizeProcessStep();
- }
- }
- else if (!string.IsNullOrWhiteSpace(result.ClientClientId))
- {
- await provisioningManager.DeleteCentralClientAsync(result.ClientClientId).ConfigureAwait(ConfigureAwaitOptions.None);
- portalRepositories.GetInstance().AttachAndModifyIdentity(serviceAccountId, null, i =>
+ i.UserStatusId = UserStatusId.PENDING;
+ },
+ i =>
{
- i.UserStatusId = UserStatusId.DELETED;
+ i.UserStatusId = userStatus;
});
- }
-
portalRepositories.GetInstance().DeleteCompanyUserAssignedRoles(result.UserRoleIds.Select(userRoleId => (serviceAccountId, userRoleId)));
+ ModifyConnectorForDeleteServiceAccount(serviceAccountId, result);
+ return await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
+ }
+
+ private void ModifyConnectorForDeleteServiceAccount(Guid serviceAccountId, OwnServiceAccountData result)
+ {
if (result.ConnectorId != null)
{
portalRepositories.GetInstance().AttachAndModifyConnector(result.ConnectorId.Value,
@@ -159,8 +166,28 @@ public async Task DeleteOwnCompanyServiceAccountAsync(Guid serviceAccountId
connector.CompanyServiceAccountId = null;
});
}
+ }
- return await portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
+ private async Task CreateDeletionProcess(Guid serviceAccountId, OwnServiceAccountData result)
+ {
+ var processId = result.ProcessId ?? throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_LINKED_TO_PROCESS, [new("serviceAccountId", serviceAccountId.ToString())]);
+
+ var processData = await portalRepositories.GetInstance()
+ .GetProcessDataForServiceAccountDeletionCallback(processId, null)
+ .ConfigureAwait(ConfigureAwaitOptions.None);
+
+ var context = processData.ProcessData.CreateManualProcessData(null,
+ portalRepositories, () => $"externalId {processId}");
+
+ context.ProcessSteps.Where(step => step.ProcessStepTypeId != ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER).IfAny(pending =>
+ throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_PENDING_PROCESS_STEPS, [new("serviceAccountId", serviceAccountId.ToString()), new("processStepTypeIds", string.Join(",", pending))]));
+
+ if (context.ProcessSteps.Any(step => step.ProcessStepTypeId == ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER))
+ return UserStatusId.DELETED;
+
+ context.ScheduleProcessSteps([ProcessStepTypeId.DELETE_DIM_TECHNICAL_USER]);
+ context.FinalizeProcessStep();
+ return UserStatusId.PENDING_DELETION;
}
public async Task GetOwnCompanyServiceAccountDetailsAsync(Guid serviceAccountId)
@@ -170,7 +197,7 @@ public async Task GetOwnCompanyServiceAccountD
if (result == null)
{
- throw NotFoundException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_CONFLICT, [new("serviceAccountId", serviceAccountId.ToString()), new(CompanyId, companyId.ToString())]);
+ throw NotFoundException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_FOUND, [new("serviceAccountId", serviceAccountId.ToString()), new(CompanyId, companyId.ToString())]);
}
IamClientAuthMethod? iamClientAuthMethod;
@@ -220,7 +247,7 @@ public async Task ResetOwnCompanyServiceAccountSecretAsyn
var result = await portalRepositories.GetInstance().GetOwnCompanyServiceAccountDetailedDataUntrackedAsync(serviceAccountId, companyId);
if (result == null)
{
- throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_CONFLICT, [new("serviceAccountId", serviceAccountId.ToString()), new(CompanyId, companyId.ToString())]);
+ throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_FOUND, [new("serviceAccountId", serviceAccountId.ToString()), new(CompanyId, companyId.ToString())]);
}
if (result.ClientClientId == null)
@@ -259,7 +286,7 @@ public async Task UpdateOwnCompanyServiceAccountDetailsAs
var result = await serviceAccountRepository.GetOwnCompanyServiceAccountWithIamClientIdAsync(serviceAccountId, companyId).ConfigureAwait(ConfigureAwaitOptions.None);
if (result == null)
{
- throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_CONFLICT, [new("serviceAccountId", serviceAccountId.ToString()), new(CompanyId, companyId.ToString())]);
+ throw ConflictException.Create(AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_FOUND, [new("serviceAccountId", serviceAccountId.ToString()), new(CompanyId, companyId.ToString())]);
}
if (result.UserStatusId == UserStatusId.INACTIVE)
@@ -398,7 +425,7 @@ public async Task HandleServiceAccountDeletionCallback(Guid processId)
null,
i =>
{
- i.UserStatusId = UserStatusId.INACTIVE;
+ i.UserStatusId = UserStatusId.DELETED;
});
context.FinalizeProcessStep();
diff --git a/src/administration/Administration.Service/Controllers/CompanyDataController.cs b/src/administration/Administration.Service/Controllers/CompanyDataController.cs
index 52d3676084..19d2cab993 100644
--- a/src/administration/Administration.Service/Controllers/CompanyDataController.cs
+++ b/src/administration/Administration.Service/Controllers/CompanyDataController.cs
@@ -365,4 +365,24 @@ public async Task TriggerSelfDescriptionProcess()
await logic.TriggerSelfDescriptionCreation().ConfigureAwait(false);
return NoContent();
}
+
+ ///
+ /// Retriggers the process to create the missing self description documents
+ ///
+ /// NoContent
+ /// Example: POST: /api/administration/companyData/trigger-self-description/{processId}
+ /// Empty response on success.
+ /// No Process found for the processId
+ [HttpPost]
+ [Authorize(Roles = "approve_new_partner")]
+ [Authorize(Policy = PolicyTypes.CompanyUser)]
+ [Route("retrigger-self-description")]
+ [ProducesResponseType(StatusCodes.Status204NoContent)]
+ [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
+ [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
+ public async Task RetriggerSelfDescriptionProcess([FromRoute] Guid processId)
+ {
+ await logic.RetriggerSelfDescriptionCreation(processId).ConfigureAwait(false);
+ return NoContent();
+ }
}
diff --git a/src/administration/Administration.Service/Controllers/ConnectorsController.cs b/src/administration/Administration.Service/Controllers/ConnectorsController.cs
index 168a7f1e9b..afd393a032 100644
--- a/src/administration/Administration.Service/Controllers/ConnectorsController.cs
+++ b/src/administration/Administration.Service/Controllers/ConnectorsController.cs
@@ -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
@@ -19,6 +18,7 @@
********************************************************************************/
using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models;
@@ -39,19 +39,9 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Controllers
[EnvironmentRoute("MVC_ROUTING_BASEPATH", "[controller]")]
[ApiController]
[Produces("application/json")]
-public class ConnectorsController : ControllerBase
+public class ConnectorsController(IConnectorsBusinessLogic logic)
+ : ControllerBase
{
- private readonly IConnectorsBusinessLogic _businessLogic;
-
- ///
- /// Constructor.
- ///
- /// Connectors business logic.
- public ConnectorsController(IConnectorsBusinessLogic connectorsBusinessLogic)
- {
- _businessLogic = connectorsBusinessLogic;
- }
-
///
/// Retrieves all company registered own connectors and their status.
///
@@ -69,7 +59,7 @@ public ConnectorsController(IConnectorsBusinessLogic connectorsBusinessLogic)
[Authorize(Policy = PolicyTypes.ValidCompany)]
[ProducesResponseType(typeof(Pagination.Response), StatusCodes.Status200OK)]
public Task> GetCompanyConnectorsForCurrentUserAsync([FromQuery] int page = 0, [FromQuery] int size = 15) =>
- _businessLogic.GetAllCompanyConnectorDatas(page, size);
+ logic.GetAllCompanyConnectorDatas(page, size);
///
/// Retrieves all registered connectors which are managed connectors of company customers and their status.
@@ -89,7 +79,7 @@ public ConnectorsController(IConnectorsBusinessLogic connectorsBusinessLogic)
[ProducesResponseType(typeof(Pagination.Response), StatusCodes.Status200OK)]
[PublicUrl(CompanyRoleId.APP_PROVIDER, CompanyRoleId.SERVICE_PROVIDER)]
public Task> GetManagedConnectorsForCurrentUserAsync([FromQuery] int page = 0, [FromQuery] int size = 15) =>
- _businessLogic.GetManagedConnectorForCompany(page, size);
+ logic.GetManagedConnectorForCompany(page, size);
///
/// Retrieves connector information for a specific connector by its ID. Note: only company owned connectors can get called.
@@ -107,7 +97,7 @@ public ConnectorsController(IConnectorsBusinessLogic connectorsBusinessLogic)
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status403Forbidden)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public Task GetCompanyConnectorByIdForCurrentUserAsync([FromRoute] Guid connectorId) =>
- _businessLogic.GetCompanyConnectorData(connectorId);
+ logic.GetCompanyConnectorData(connectorId);
///
/// Allows to register owned company connectors (self-hosted/-managed) inside the CX dataspace.
@@ -128,7 +118,7 @@ public Task GetCompanyConnectorByIdForCurrentUserAsync([FromRoute
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status503ServiceUnavailable)]
public async Task CreateConnectorAsync([FromForm] ConnectorInputModel connectorInputModel, CancellationToken cancellationToken)
{
- var connectorId = await _businessLogic.CreateConnectorAsync(connectorInputModel, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
+ var connectorId = await logic.CreateConnectorAsync(connectorInputModel, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
return CreatedAtRoute(nameof(GetCompanyConnectorByIdForCurrentUserAsync), new { connectorId }, connectorId);
}
@@ -152,7 +142,7 @@ public async Task CreateConnectorAsync([FromForm] Connecto
[PublicUrl(CompanyRoleId.APP_PROVIDER, CompanyRoleId.SERVICE_PROVIDER)]
public async Task CreateManagedConnectorAsync([FromForm] ManagedConnectorInputModel connectorInputModel, CancellationToken cancellationToken)
{
- var connectorId = await _businessLogic.CreateManagedConnectorAsync(connectorInputModel, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
+ var connectorId = await logic.CreateManagedConnectorAsync(connectorInputModel, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
return CreatedAtRoute(nameof(GetCompanyConnectorByIdForCurrentUserAsync), new { connectorId }, connectorId);
}
@@ -173,7 +163,7 @@ public async Task CreateManagedConnectorAsync([FromForm] M
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public async Task DeleteConnectorAsync([FromRoute] Guid connectorId)
{
- await _businessLogic.DeleteConnectorAsync(connectorId);
+ await logic.DeleteConnectorAsync(connectorId);
return NoContent();
}
@@ -189,7 +179,7 @@ public async Task DeleteConnectorAsync([FromRoute] Guid connector
[ProducesResponseType(typeof(IAsyncEnumerable), StatusCodes.Status200OK)]
[PublicUrl(CompanyRoleId.APP_PROVIDER, CompanyRoleId.SERVICE_PROVIDER, CompanyRoleId.ACTIVE_PARTICIPANT)]
public IAsyncEnumerable GetCompanyConnectorEndPointAsync([FromBody] IEnumerable? bpns = null) =>
- _businessLogic.GetCompanyConnectorEndPointAsync(bpns);
+ logic.GetCompanyConnectorEndPointAsync(bpns);
///
/// Asynchron callback endpoint for the clearinghouse provider to submit the connector SD document.
@@ -209,7 +199,7 @@ public IAsyncEnumerable GetCompanyConnectorEndPointAsync(
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public async Task ProcessClearinghouseSelfDescription([FromBody] SelfDescriptionResponseData data, CancellationToken cancellationToken)
{
- await _businessLogic.ProcessClearinghouseSelfDescription(data, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
+ await logic.ProcessClearinghouseSelfDescription(data, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
return NoContent();
}
@@ -236,7 +226,7 @@ public async Task ProcessClearinghouseSelfDescription([FromBody
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status503ServiceUnavailable)]
public async Task UpdateConnectorUrl([FromRoute] Guid connectorId, [FromBody] ConnectorUpdateRequest data)
{
- await _businessLogic.UpdateConnectorUrl(connectorId, data)
+ await logic.UpdateConnectorUrl(connectorId, data)
.ConfigureAwait(ConfigureAwaitOptions.None);
return NoContent();
}
@@ -256,7 +246,7 @@ await _businessLogic.UpdateConnectorUrl(connectorId, data)
[Authorize(Policy = PolicyTypes.ValidCompany)]
[ProducesResponseType(typeof(IAsyncEnumerable), StatusCodes.Status200OK)]
public IAsyncEnumerable GetConnectorOfferSubscriptionData([FromQuery] bool? connectorIdSet) =>
- _businessLogic.GetConnectorOfferSubscriptionData(connectorIdSet);
+ logic.GetConnectorOfferSubscriptionData(connectorIdSet);
///
/// Retrieves all active connectors with missing sd document.
@@ -275,7 +265,7 @@ public IAsyncEnumerable GetConnectorOfferSubscri
[Authorize(Policy = PolicyTypes.ValidCompany)]
[ProducesResponseType(typeof(Pagination.Response), StatusCodes.Status200OK)]
public Task> GetConnectorsWithMissingSdDocument([FromQuery] int page = 0, [FromQuery] int size = 15) =>
- _businessLogic.GetConnectorsWithMissingSdDocument(page, size);
+ logic.GetConnectorsWithMissingSdDocument(page, size);
///
/// Triggers the process to create the missing self description documents
@@ -293,7 +283,27 @@ public IAsyncEnumerable GetConnectorOfferSubscri
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public async Task TriggerSelfDescriptionProcess()
{
- await _businessLogic.TriggerSelfDescriptionCreation().ConfigureAwait(false);
+ await logic.TriggerSelfDescriptionCreation().ConfigureAwait(false);
+ return NoContent();
+ }
+
+ ///
+ /// Retriggers the process to create the missing self description documents
+ ///
+ /// NoContent
+ /// Example: POST: /api/administration/connectors/retrigger-self-description/{processId}
+ /// Empty response on success.
+ /// No Process found for the processId
+ [HttpPost]
+ [Authorize(Roles = "approve_new_partner")]
+ [Authorize(Policy = PolicyTypes.CompanyUser)]
+ [Route("retrigger-self-description")]
+ [ProducesResponseType(StatusCodes.Status204NoContent)]
+ [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
+ [ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
+ public async Task RetriggerSelfDescriptionProcess([FromRoute] Guid processId)
+ {
+ await logic.RetriggerSelfDescriptionCreation(processId).ConfigureAwait(false);
return NoContent();
}
}
diff --git a/src/administration/Administration.Service/Controllers/IdentityProviderController.cs b/src/administration/Administration.Service/Controllers/IdentityProviderController.cs
index 57f3f3a713..8adb9f2d00 100644
--- a/src/administration/Administration.Service/Controllers/IdentityProviderController.cs
+++ b/src/administration/Administration.Service/Controllers/IdentityProviderController.cs
@@ -48,6 +48,7 @@ public IdentityProviderController(IIdentityProviderBusinessLogic identityProvide
}
///
+ ///
/// Gets the details of the own company identity provider
///
/// Returns the details of the own company identity provider
diff --git a/src/administration/Administration.Service/Controllers/ServiceAccountController.cs b/src/administration/Administration.Service/Controllers/ServiceAccountController.cs
index 90640c362e..de85dbfe16 100644
--- a/src/administration/Administration.Service/Controllers/ServiceAccountController.cs
+++ b/src/administration/Administration.Service/Controllers/ServiceAccountController.cs
@@ -84,8 +84,11 @@ public Task> ExecuteCompanyUserCreation([From
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
- public Task DeleteServiceAccount([FromRoute] Guid serviceAccountId) =>
- _logic.DeleteOwnCompanyServiceAccountAsync(serviceAccountId);
+ public async Task DeleteServiceAccount([FromRoute] Guid serviceAccountId)
+ {
+ await _logic.DeleteOwnCompanyServiceAccountAsync(serviceAccountId).ConfigureAwait(ConfigureAwaitOptions.None);
+ return NoContent();
+ }
///
/// Gets the service account details for the given id
diff --git a/src/administration/Administration.Service/ErrorHandling/AdministrationServiceAccountErrorMessageContainer.cs b/src/administration/Administration.Service/ErrorHandling/AdministrationServiceAccountErrorMessageContainer.cs
index 1b5c4d5b66..6983f07645 100644
--- a/src/administration/Administration.Service/ErrorHandling/AdministrationServiceAccountErrorMessageContainer.cs
+++ b/src/administration/Administration.Service/ErrorHandling/AdministrationServiceAccountErrorMessageContainer.cs
@@ -30,7 +30,7 @@ public class AdministrationServiceAccountErrorMessageContainer : IErrorMessageCo
{ AdministrationServiceAccountErrors.SERVICE_COMPANY_NOT_EXIST_CONFLICT, "company {companyId} does not exist"},
{ AdministrationServiceAccountErrors.SERVICE_BPN_NOT_SET_CONFLICT, "bpn not set for company {companyId}"},
{ AdministrationServiceAccountErrors.SERVICE_ROLES_NOT_ASSIGN_ARGUMENT, "The roles {unassignable} are not assignable to a service account, {userRoleIds}"},
- { AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_CONFLICT, "serviceAccount {serviceAccountId} not found for company {companyId}"},
+ { AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_FOUND, "serviceAccount {serviceAccountId} not found for company {companyId}"},
{ AdministrationServiceAccountErrors.SERVICE_USERID_ACTIVATION_PENDING_CONFLICT, "Technical User is linked to an active connector. Change the link or deactivate the connector to delete the technical user."},
{ AdministrationServiceAccountErrors.SERVICE_USERID_ACTIVATION_ACTIVE_CONFLICT, "Technical User is linked to an active subscription. Deactivate the subscription to delete the technical user."},
{ AdministrationServiceAccountErrors.SERVICE_UNDEFINED_CLIENTID_CONFLICT, "undefined clientId for serviceAccount {serviceAccountId}"},
@@ -38,7 +38,8 @@ public class AdministrationServiceAccountErrorMessageContainer : IErrorMessageCo
{ AdministrationServiceAccountErrors.SERVICE_INACTIVE_CONFLICT, "serviceAccount {serviceAccountId} is already INACTIVE"},
{ AdministrationServiceAccountErrors.SERVICE_CLIENTID_NOT_NULL_CONFLICT, "clientClientId of serviceAccount {serviceAccountId} should not be null"},
{ AdministrationServiceAccountErrors.SERVICE_ACCOUNT_NOT_LINKED_TO_PROCESS, "Service Account {serviceAccountId} is not linked to a process" },
- { AdministrationServiceAccountErrors.SERVICE_ACCOUNT_PENDING_PROCESS_STEPS, "Service Account {serviceAccountId} has pending process steps {processStepTypeIds}"}
+ { AdministrationServiceAccountErrors.SERVICE_ACCOUNT_PENDING_PROCESS_STEPS, "Service Account {serviceAccountId} has pending process steps {processStepTypeIds}"},
+ { AdministrationServiceAccountErrors.TECHNICAL_USER_CREATION_IN_PROGRESS, "Technical user can't be deleted because the creation progress is still running"}
}.ToImmutableDictionary(x => (int)x.Key, x => x.Value);
public Type Type { get => typeof(AdministrationServiceAccountErrors); }
@@ -52,7 +53,7 @@ public enum AdministrationServiceAccountErrors
SERVICE_COMPANY_NOT_EXIST_CONFLICT,
SERVICE_BPN_NOT_SET_CONFLICT,
SERVICE_ROLES_NOT_ASSIGN_ARGUMENT,
- SERVICE_ACCOUNT_NOT_CONFLICT,
+ SERVICE_ACCOUNT_NOT_FOUND,
SERVICE_USERID_ACTIVATION_PENDING_CONFLICT,
SERVICE_USERID_ACTIVATION_ACTIVE_CONFLICT,
SERVICE_UNDEFINED_CLIENTID_CONFLICT,
@@ -60,5 +61,6 @@ public enum AdministrationServiceAccountErrors
SERVICE_INACTIVE_CONFLICT,
SERVICE_CLIENTID_NOT_NULL_CONFLICT,
SERVICE_ACCOUNT_NOT_LINKED_TO_PROCESS,
- SERVICE_ACCOUNT_PENDING_PROCESS_STEPS
+ SERVICE_ACCOUNT_PENDING_PROCESS_STEPS,
+ TECHNICAL_USER_CREATION_IN_PROGRESS
}
diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/CompanyMissingSdDocumentData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/CompanyMissingSdDocumentData.cs
index a04473d2a1..0425994549 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Models/CompanyMissingSdDocumentData.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Models/CompanyMissingSdDocumentData.cs
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2022 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/OwnServiceAccountData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/OwnServiceAccountData.cs
index 2551ccd7f3..99c59d7936 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Models/OwnServiceAccountData.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Models/OwnServiceAccountData.cs
@@ -30,5 +30,8 @@ public record OwnServiceAccountData(
ConnectorStatusId? StatusId,
OfferSubscriptionStatusId? OfferStatusId,
bool IsDimServiceAccount,
+ bool CreationProcessInProgress,
Guid? ProcessId
);
+
+public record ProcessData(Guid ProcessId, IEnumerable ProcessStepIds);
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanyRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanyRepository.cs
index bbde405120..2acc602b6c 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanyRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanyRepository.cs
@@ -29,8 +29,7 @@
namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories;
///
-public class CompanyRepository(PortalDbContext context)
- : ICompanyRepository
+public class CompanyRepository(PortalDbContext context) : ICompanyRepository
{
///
Company ICompanyRepository.CreateCompany(string companyName, Action? setOptionalParameters)
@@ -433,34 +432,36 @@ public void RemoveProviderCompanyDetails(Guid providerCompanyDetailId) =>
c.Name)
).SingleOrDefaultAsync();
- public Task HasAnyCompaniesWithMissingSelfDescription() =>
- context.Companies.AnyAsync(c =>
- c.CompanyStatusId == CompanyStatusId.ACTIVE &&
- c.SelfDescriptionDocumentId == null &&
- c.CompanyApplications.Any(ca =>
- ca.ApplicationChecklistEntries.Any(a =>
- a.ApplicationChecklistEntryTypeId == ApplicationChecklistEntryTypeId.SELF_DESCRIPTION_LP &&
- a.ApplicationChecklistEntryStatusId != ApplicationChecklistEntryStatusId.TO_DO &&
- a.ApplicationChecklistEntryStatusId != ApplicationChecklistEntryStatusId.IN_PROGRESS)));
-
- public IAsyncEnumerable<(Guid Id, IEnumerable<(UniqueIdentifierId Id, string Value)> UniqueIdentifiers, string? BusinessPartnerNumber, string CountryCode)> GetNextCompaniesWithMissingSelfDescription() =>
+ public IAsyncEnumerable GetCompanyIdsWithMissingSelfDescription() =>
context.Companies.Where(c =>
- c.CompanyStatusId == CompanyStatusId.ACTIVE &&
- c.SelfDescriptionDocumentId == null &&
- c.CompanyApplications.Any(ca =>
- ca.ApplicationChecklistEntries.Any(a =>
- a.ApplicationChecklistEntryTypeId == ApplicationChecklistEntryTypeId.SELF_DESCRIPTION_LP &&
- a.ApplicationChecklistEntryStatusId != ApplicationChecklistEntryStatusId.TO_DO &&
- a.ApplicationChecklistEntryStatusId != ApplicationChecklistEntryStatusId.IN_PROGRESS)))
+ c.CompanyStatusId == CompanyStatusId.ACTIVE &&
+ c.SelfDescriptionDocumentId == null &&
+ c.SdCreationProcessId == null &&
+ c.CompanyApplications.Any(ca =>
+ ca.ApplicationChecklistEntries.Any(a =>
+ a.ApplicationChecklistEntryTypeId == ApplicationChecklistEntryTypeId.SELF_DESCRIPTION_LP &&
+ a.ApplicationChecklistEntryStatusId != ApplicationChecklistEntryStatusId.TO_DO &&
+ a.ApplicationChecklistEntryStatusId != ApplicationChecklistEntryStatusId.IN_PROGRESS)))
+ .Select(c => c.Id)
+ .ToAsyncEnumerable();
+
+ public Task<(Guid Id, IEnumerable<(UniqueIdentifierId Id, string Value)> UniqueIdentifiers, string? BusinessPartnerNumber, string CountryCode)> GetCompanyByProcessId(Guid processId) =>
+ context.Companies
+ .Where(c => c.SdCreationProcessId == processId)
.Select(c => new ValueTuple, string?, string>(
c.Id,
c.CompanyIdentifiers.Select(ci => new ValueTuple(ci.UniqueIdentifierId, ci.Value)),
c.BusinessPartnerNumber,
c.Address!.Country!.Alpha2Code
))
- .Take(2)
- .ToAsyncEnumerable();
+ .SingleOrDefaultAsync();
public Task IsExistingCompany(Guid companyId) =>
context.Companies.AnyAsync(c => c.Id == companyId);
+
+ public Task<(bool Exists, Guid CompanyId, IEnumerable SubmittedCompanyApplicationId)> GetCompanyIdByBpn(string bpn) =>
+ context.Companies
+ .Where(x => x.BusinessPartnerNumber == bpn)
+ .Select(x => new ValueTuple>(true, x.Id, x.CompanyApplications.Where(a => a.ApplicationStatusId == CompanyApplicationStatusId.SUBMITTED).Select(a => a.Id)))
+ .SingleOrDefaultAsync();
}
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs
index 3f07d0ad0c..bfef9302d8 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs
@@ -221,13 +221,15 @@ public void DeleteConnectorAssignedSubscriptions(Guid connectorId, IEnumerable HasAnyConnectorsWithMissingSelfDescription() =>
- _context.Connectors.AnyAsync(c => c.SelfDescriptionDocumentId == null);
-
- public IAsyncEnumerable<(Guid Id, string? BusinessPartnerNumber, Guid? SelfDescriptionDocumentId)> GetNextConnectorsWithMissingSelfDescription() =>
+ public IAsyncEnumerable GetConnectorIdsWithMissingSelfDescription() =>
_context.Connectors
- .Where(c => c.StatusId == ConnectorStatusId.ACTIVE && c.SelfDescriptionDocumentId == null)
- .Select(c => new ValueTuple(c.Id, c.Provider!.BusinessPartnerNumber, c.Provider.SelfDescriptionDocumentId))
- .Take(2)
+ .Where(c => c.StatusId == ConnectorStatusId.ACTIVE && c.SelfDescriptionDocumentId == null && c.Provider!.SelfDescriptionDocumentId != null)
+ .Select(c => c.Id)
.ToAsyncEnumerable();
+
+ public Task<(Guid Id, string? BusinessPartnerNumber, Guid SelfDescriptionDocumentId)> GetConnectorForProcessId(Guid processId) =>
+ _context.Connectors
+ .Where(c => c.SdCreationProcessId == processId)
+ .Select(c => new ValueTuple(c.Id, c.Provider!.BusinessPartnerNumber, c.Provider.SelfDescriptionDocumentId!.Value))
+ .SingleOrDefaultAsync();
}
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ICompanyRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ICompanyRepository.cs
index 8811bcff1a..d35cc64afa 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ICompanyRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ICompanyRepository.cs
@@ -181,7 +181,8 @@ public interface ICompanyRepository
Task<(string? Holder, string? BusinessPartnerNumber, WalletInformation? WalletInformation)> GetWalletData(Guid identityId);
void RemoveProviderCompanyDetails(Guid providerCompanyDetailId);
Func?>> GetCompaniesWithMissingSdDocument();
- Task HasAnyCompaniesWithMissingSelfDescription();
- IAsyncEnumerable<(Guid Id, IEnumerable<(UniqueIdentifierId Id, string Value)> UniqueIdentifiers, string? BusinessPartnerNumber, string CountryCode)> GetNextCompaniesWithMissingSelfDescription();
+ IAsyncEnumerable GetCompanyIdsWithMissingSelfDescription();
+ Task<(Guid Id, IEnumerable<(UniqueIdentifierId Id, string Value)> UniqueIdentifiers, string? BusinessPartnerNumber, string CountryCode)> GetCompanyByProcessId(Guid processId);
Task IsExistingCompany(Guid companyId);
+ Task<(bool Exists, Guid CompanyId, IEnumerable SubmittedCompanyApplicationId)> GetCompanyIdByBpn(string bpn);
}
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs
index f470fcc529..0d4fd47593 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs
@@ -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
@@ -106,6 +105,6 @@ public interface IConnectorsRepository
void DeleteConnectorAssignedSubscriptions(Guid connectorId, IEnumerable assignedOfferSubscriptions);
Func?>> GetConnectorsWithMissingSdDocument();
- Task HasAnyConnectorsWithMissingSelfDescription();
- IAsyncEnumerable<(Guid Id, string? BusinessPartnerNumber, Guid? SelfDescriptionDocumentId)> GetNextConnectorsWithMissingSelfDescription();
+ IAsyncEnumerable GetConnectorIdsWithMissingSelfDescription();
+ Task<(Guid Id, string? BusinessPartnerNumber, Guid SelfDescriptionDocumentId)> GetConnectorForProcessId(Guid processId);
}
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs
index a059863f68..8cb40a1ee8 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IServiceAccountRepository.cs
@@ -36,7 +36,7 @@ CompanyServiceAccount CreateCompanyServiceAccount(Guid identityId,
void AttachAndModifyCompanyServiceAccount(Guid id, Guid version, Action? initialize, Action modify);
Task GetOwnCompanyServiceAccountWithIamClientIdAsync(Guid serviceAccountId, Guid userCompanyId);
- Task GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(Guid serviceAccountId, Guid companyId);
+ Task GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(Guid serviceAccountId, Guid companyId, IEnumerable processStepsToFilter);
Task GetOwnCompanyServiceAccountDetailedDataUntrackedAsync(Guid serviceAccountId, Guid companyId);
Func?>> GetOwnCompanyServiceAccountsUntracked(Guid userCompanyId, string? clientId, bool? isOwner, IEnumerable userStatusIds);
Task CheckActiveServiceAccountExistsForCompanyAsync(Guid technicalUserId, Guid companyId);
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs
index f3c9c4799f..15862fa27a 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ServiceAccountRepository.cs
@@ -94,7 +94,7 @@ public void AttachAndModifyCompanyServiceAccount(
userRole.UserRoleText))))
.SingleOrDefaultAsync();
- public Task GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(Guid serviceAccountId, Guid companyId) =>
+ public Task GetOwnCompanyServiceAccountWithIamServiceAccountRolesAsync(Guid serviceAccountId, Guid companyId, IEnumerable processStepsToFilter) =>
portalDbContext.CompanyServiceAccounts
.Where(serviceAccount =>
serviceAccount.Id == serviceAccountId &&
@@ -108,8 +108,12 @@ public void AttachAndModifyCompanyServiceAccount(
sa.ClientClientId,
sa.Connector!.StatusId,
sa.OfferSubscription!.OfferSubscriptionStatusId,
- sa.DimCompanyServiceAccount != null,
- sa.DimUserCreationData!.ProcessId))
+ sa.CompanyServiceAccountKindId == CompanyServiceAccountKindId.EXTERNAL,
+ sa.DimUserCreationData!.Process!.ProcessSteps
+ .Any(ps =>
+ ps.ProcessStepStatusId == ProcessStepStatusId.TODO &&
+ processStepsToFilter.Contains(ps.ProcessStepTypeId)),
+ sa.DimUserCreationData == null ? null : sa.DimUserCreationData!.ProcessId))
.SingleOrDefaultAsync();
public Task GetOwnCompanyServiceAccountDetailedDataUntrackedAsync(Guid serviceAccountId, Guid companyId) =>
diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20240829064322_2.2.0-rc3.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20240829064322_2.2.0-rc3.Designer.cs
new file mode 100644
index 0000000000..c570bad488
--- /dev/null
+++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20240829064322_2.2.0-rc3.Designer.cs
@@ -0,0 +1,9706 @@
+/********************************************************************************
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Apache License, Version 2.0 which is available at
+ * https://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ ********************************************************************************/
+
+//
+using System;
+using System.Text.Json;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities;
+
+#nullable disable
+
+namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations
+{
+ [DbContext(typeof(PortalDbContext))]
+ [Migration("20240829064322_2.2.0-rc3")]
+ partial class _220rc3
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasDefaultSchema("portal")
+ .UseCollation("en_US.utf8")
+ .HasAnnotation("ProductVersion", "8.0.7")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditAppSubscriptionDetail20221118", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AppInstanceId")
+ .HasColumnType("uuid")
+ .HasColumnName("app_instance_id");
+
+ b.Property("AppSubscriptionUrl")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("app_subscription_url");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("OfferSubscriptionId")
+ .HasColumnType("uuid")
+ .HasColumnName("offer_subscription_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_app_subscription_detail20221118");
+
+ b.ToTable("audit_app_subscription_detail20221118", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditAppSubscriptionDetail20231115", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AppInstanceId")
+ .HasColumnType("uuid")
+ .HasColumnName("app_instance_id");
+
+ b.Property("AppSubscriptionUrl")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("app_subscription_url");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("OfferSubscriptionId")
+ .HasColumnType("uuid")
+ .HasColumnName("offer_subscription_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_app_subscription_detail20231115");
+
+ b.ToTable("audit_app_subscription_detail20231115", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCertificateManagement20240416", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("CompanyCertificateStatusId")
+ .HasColumnType("integer")
+ .HasColumnName("company_certificate_status_id");
+
+ b.Property("CompanyCertificateTypeId")
+ .HasColumnType("integer")
+ .HasColumnName("company_certificate_type_id");
+
+ b.Property("CompanyId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_id");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("DocumentId")
+ .HasColumnType("uuid")
+ .HasColumnName("document_id");
+
+ b.Property("ExternalCertificateNumber")
+ .HasColumnType("text")
+ .HasColumnName("external_certificate_number");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("Issuer")
+ .HasColumnType("text")
+ .HasColumnName("issuer");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("TrustLevel")
+ .HasColumnType("text")
+ .HasColumnName("trust_level");
+
+ b.Property("ValidFrom")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("valid_from");
+
+ b.Property("ValidTill")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("valid_till");
+
+ b.Property("Validator")
+ .HasColumnType("text")
+ .HasColumnName("validator");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_certificate_management20240416");
+
+ b.ToTable("audit_certificate_management20240416", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyApplication20221005", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("ApplicationStatusId")
+ .HasColumnType("integer")
+ .HasColumnName("application_status_id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("CompanyId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_id");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_created");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_company_application20221005");
+
+ b.ToTable("audit_company_application20221005", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyApplication20230214", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("ApplicationStatusId")
+ .HasColumnType("integer")
+ .HasColumnName("application_status_id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("ChecklistProcessId")
+ .HasColumnType("uuid")
+ .HasColumnName("checklist_process_id");
+
+ b.Property("CompanyId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_id");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_created");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_company_application20230214");
+
+ b.ToTable("audit_company_application20230214", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyApplication20230824", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("ApplicationStatusId")
+ .HasColumnType("integer")
+ .HasColumnName("application_status_id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("ChecklistProcessId")
+ .HasColumnType("uuid")
+ .HasColumnName("checklist_process_id");
+
+ b.Property("CompanyApplicationTypeId")
+ .HasColumnType("integer")
+ .HasColumnName("company_application_type_id");
+
+ b.Property("CompanyId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_id");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_created");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("OnboardingServiceProviderId")
+ .HasColumnType("uuid")
+ .HasColumnName("onboarding_service_provider_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_company_application20230824");
+
+ b.ToTable("audit_company_application20230824", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyApplication20231115", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("ApplicationStatusId")
+ .HasColumnType("integer")
+ .HasColumnName("application_status_id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("ChecklistProcessId")
+ .HasColumnType("uuid")
+ .HasColumnName("checklist_process_id");
+
+ b.Property("CompanyApplicationTypeId")
+ .HasColumnType("integer")
+ .HasColumnName("company_application_type_id");
+
+ b.Property("CompanyId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_id");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_created");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("OnboardingServiceProviderId")
+ .HasColumnType("uuid")
+ .HasColumnName("onboarding_service_provider_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_company_application20231115");
+
+ b.ToTable("audit_company_application20231115", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyAssignedRole2023316", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("CompanyId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_id");
+
+ b.Property("CompanyRoleId")
+ .HasColumnType("integer")
+ .HasColumnName("company_role_id");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_company_assigned_role2023316");
+
+ b.ToTable("audit_company_assigned_role2023316", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyUser20221005", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("CompanyId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_id");
+
+ b.Property("CompanyUserStatusId")
+ .HasColumnType("integer")
+ .HasColumnName("company_user_status_id");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_created");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("Email")
+ .HasColumnType("text")
+ .HasColumnName("email");
+
+ b.Property("Firstname")
+ .HasColumnType("text")
+ .HasColumnName("firstname");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("Lastlogin")
+ .HasColumnType("bytea")
+ .HasColumnName("lastlogin");
+
+ b.Property("Lastname")
+ .HasColumnType("text")
+ .HasColumnName("lastname");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_company_user20221005");
+
+ b.ToTable("audit_company_user20221005", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyUser20230522", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("Email")
+ .HasColumnType("text")
+ .HasColumnName("email");
+
+ b.Property("Firstname")
+ .HasColumnType("text")
+ .HasColumnName("firstname");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("Lastlogin")
+ .HasColumnType("bytea")
+ .HasColumnName("lastlogin");
+
+ b.Property("Lastname")
+ .HasColumnType("text")
+ .HasColumnName("lastname");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_company_user20230523");
+
+ b.ToTable("audit_company_user20230523", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditCompanyUserAssignedRole20221018", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("CompanyUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_user_id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("UserRoleId")
+ .HasColumnType("uuid")
+ .HasColumnName("user_role_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_company_user_assigned_role20221018");
+
+ b.ToTable("audit_company_user_assigned_role20221018", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConnector20230405", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AuditV1DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("audit_v1date_last_changed");
+
+ b.Property("AuditV1LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1last_editor_id");
+
+ b.Property("AuditV1OperationId")
+ .HasColumnType("integer")
+ .HasColumnName("audit_v1operation_id");
+
+ b.Property("ConnectorUrl")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("connector_url");
+
+ b.Property("DapsRegistrationSuccessful")
+ .HasColumnType("boolean")
+ .HasColumnName("daps_registration_successful");
+
+ b.Property("DateLastChanged")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_last_changed");
+
+ b.Property("HostId")
+ .HasColumnType("uuid")
+ .HasColumnName("host_id");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("LocationId")
+ .IsRequired()
+ .HasMaxLength(2)
+ .HasColumnType("character varying(2)")
+ .HasColumnName("location_id");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("name");
+
+ b.Property