diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46349603c9..22852bab6a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,29 @@
New features, fixed bugs, known defects and other noteworthy changes to each release of the Catena-X Portal Backend.
+## 1.6.0-RC4
+
+### Change
+* Apps Service
+ * Change the appInstanceId to iamClientId for the /{appId}/subscription/{subscriptionId}/provider endpoint
+* BPDM Service
+ * BPDM Service calls are changed to the new bpdm endpoints
+
+### Technical Support
+* reinclude http request & response messages in logging
+* lastEditorId is now set whenever a auditable entity is changed
+
+### Bugfix
+* Apps Service
+ * Fix /api/apps/business endpoint to return correct results
+ * Fix POST /api/apps/appreleaseprocess/consent/{appId}/agreementConsents to save consents and set the correct user id
+* Services Service
+ * Fix POST /api/services/servicerelease/consent/{serviceId}/agreementConsents to save consents and set the correct user id
+* Administration Service
+ * Ignore inactive credentials when trying to create a new credential
+* AutoSetup
+ * fix an error that occurred when autoSetup was executed by a service-account caused by the the creator of a notification being linked to a companyUser instead of identities
+
## 1.6.0-RC3
### Change
diff --git a/docker/Dockerfile-maintenance-service b/docker/Dockerfile-maintenance-service
index 9404302127..c8fbc7c185 100644
--- a/docker/Dockerfile-maintenance-service
+++ b/docker/Dockerfile-maintenance-service
@@ -30,6 +30,7 @@ COPY src/framework/Framework.Linq/ src/framework/Framework.Linq/
COPY src/framework/Framework.Models/ src/framework/Framework.Models/
COPY src/framework/Framework.Logging/ src/framework/Framework.Logging/
COPY src/framework/Framework.ErrorHandling.Library/ src/framework/Framework.ErrorHandling.Library/
+COPY src/framework/Framework.ProcessIdentity/ src/framework/Framework.ProcessIdentity/
RUN dotnet restore "src/maintenance/Maintenance.App/Maintenance.App.csproj"
WORKDIR /src/maintenance/Maintenance.App
RUN dotnet build "Maintenance.App.csproj" -c Release -o /app/build
diff --git a/docker/Dockerfile-portal-migrations b/docker/Dockerfile-portal-migrations
index e736286b56..04f73b1dd4 100644
--- a/docker/Dockerfile-portal-migrations
+++ b/docker/Dockerfile-portal-migrations
@@ -29,6 +29,7 @@ COPY /src/framework/Framework.Models /src/framework/Framework.Models
COPY /src/framework/Framework.Linq /src/framework/Framework.Linq
COPY /src/framework/Framework.ErrorHandling.Library /src/framework/Framework.ErrorHandling.Library
COPY /src/framework/Framework.BaseDependencies /src/framework/Framework.BaseDependencies
+COPY /src/framework/Framework.ProcessIdentity /src/framework/Framework.ProcessIdentity/
COPY /src/framework/Framework.Seeding /src/framework/Framework.Seeding
WORKDIR /src/portalbackend/PortalBackend.Migrations
RUN dotnet build "PortalBackend.Migrations.csproj" -c Release -o /migrations/build
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index d62d56ea50..a3c653174f 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -21,6 +21,6 @@
1.6.0
- RC3
+ RC4
-
\ No newline at end of file
+
diff --git a/src/Portal.Backend.sln b/src/Portal.Backend.sln
index 8ebfb4c400..b808785626 100644
--- a/src/Portal.Backend.sln
+++ b/src/Portal.Backend.sln
@@ -208,6 +208,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Authorization", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Models.Tests", "..\tests\framework\Framework.Models.Tests\Framework.Models.Tests.csproj", "{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.ProcessIdentity", "framework\Framework.ProcessIdentity\Framework.ProcessIdentity.csproj", "{4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1298,6 +1300,18 @@ Global
{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Release|x64.Build.0 = Release|Any CPU
{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Release|x86.ActiveCfg = Release|Any CPU
{EA9BA26E-83F6-47C4-BA3B-880AF1AD6A82}.Release|x86.Build.0 = Release|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|x64.Build.0 = Debug|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Debug|x86.Build.0 = Debug|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x64.ActiveCfg = Release|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x64.Build.0 = Release|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x86.ActiveCfg = Release|Any CPU
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1396,5 +1410,6 @@ Global
{1694E75F-ABCE-4573-B805-18ED50F148FD} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{031237BF-7B2A-4B37-9E37-4D4C575FDD22} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
{CB9FFDD9-7F41-44DA-BFA8-C157A96D51F6} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
+ {4CA307AB-A0F8-4AA5-A09D-91F47DA3054A} = {23500169-FC01-4D2B-A997-E7FAE2169FC0}
EndGlobalSection
EndGlobal
diff --git a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs
index 16116d6a85..4e1d8ad0db 100644
--- a/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/CompanyDataBusinessLogic.cs
@@ -412,7 +412,6 @@ public async Task ApproveCredential(Guid userId, Guid credentialId, Cancellation
{
c.CompanySsiDetailStatusId = CompanySsiDetailStatusId.ACTIVE;
c.DateLastChanged = _dateTimeProvider.OffsetNow;
- c.LastEditorId = userId;
});
switch (data.Kind)
@@ -475,7 +474,6 @@ public async Task RejectCredential(Guid userId, Guid credentialId)
{
c.CompanySsiDetailStatusId = CompanySsiDetailStatusId.INACTIVE;
c.DateLastChanged = _dateTimeProvider.OffsetNow;
- c.LastEditorId = userId;
});
await _portalRepositories.SaveAsync().ConfigureAwait(false);
diff --git a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs
index 7a7a28ef1c..5cd9ee8183 100644
--- a/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/ConnectorsBusinessLogic.cs
@@ -114,16 +114,16 @@ public async Task GetCompanyConnectorData(Guid connectorId, Guid
}
///
- public Task CreateConnectorAsync(ConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken)
+ public Task CreateConnectorAsync(ConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken)
{
ValidateCertificationType(connectorInputModel.Certificate);
- return CreateConnectorInternalAsync(connectorInputModel, identity, cancellationToken);
+ return CreateConnectorInternalAsync(connectorInputModel, companyId, cancellationToken);
}
- public Task CreateManagedConnectorAsync(ManagedConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken)
+ public Task CreateManagedConnectorAsync(ManagedConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken)
{
ValidateCertificationType(connectorInputModel.Certificate);
- return CreateManagedConnectorInternalAsync(connectorInputModel, identity, cancellationToken);
+ return CreateManagedConnectorInternalAsync(connectorInputModel, companyId, cancellationToken);
}
private void ValidateCertificationType(IFormFile? certificate)
@@ -135,45 +135,44 @@ private void ValidateCertificationType(IFormFile? certificate)
}
}
- private async Task CreateConnectorInternalAsync(ConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken)
+ private async Task CreateConnectorInternalAsync(ConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken)
{
var (name, connectorUrl, location, certificate, technicalUserId) = connectorInputModel;
await CheckLocationExists(location);
var result = await _portalRepositories
.GetInstance()
- .GetCompanyBpnAndSelfDescriptionDocumentByIdAsync(identity.CompanyId)
+ .GetCompanyBpnAndSelfDescriptionDocumentByIdAsync(companyId)
.ConfigureAwait(false);
if (string.IsNullOrEmpty(result.Bpn))
{
- throw new UnexpectedConditionException($"provider company {identity.CompanyId} has no businessPartnerNumber assigned");
+ throw new UnexpectedConditionException($"provider company {companyId} has no businessPartnerNumber assigned");
}
if (result.SelfDescriptionDocumentId is null)
{
- throw new UnexpectedConditionException($"provider company {identity.CompanyId} has no self description document");
+ throw new UnexpectedConditionException($"provider company {companyId} has no self description document");
}
- await ValidateTechnicalUser(technicalUserId, identity.CompanyId).ConfigureAwait(false);
+ await ValidateTechnicalUser(technicalUserId, companyId).ConfigureAwait(false);
- var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.COMPANY_CONNECTOR, location, identity.CompanyId, identity.CompanyId, technicalUserId);
+ var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.COMPANY_CONNECTOR, location, companyId, companyId, technicalUserId);
return await CreateAndRegisterConnectorAsync(
connectorRequestModel,
result.Bpn,
result.SelfDescriptionDocumentId.Value,
certificate,
- identity.UserId,
null,
cancellationToken).ConfigureAwait(false);
}
- private async Task CreateManagedConnectorInternalAsync(ManagedConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken)
+ private async Task CreateManagedConnectorInternalAsync(ManagedConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken)
{
var (name, connectorUrl, location, subscriptionId, certificate, technicalUserId) = connectorInputModel;
await CheckLocationExists(location).ConfigureAwait(false);
var result = await _portalRepositories.GetInstance()
- .CheckOfferSubscriptionWithOfferProvider(subscriptionId, identity.CompanyId)
+ .CheckOfferSubscriptionWithOfferProvider(subscriptionId, companyId)
.ConfigureAwait(false);
if (!result.Exists)
@@ -209,13 +208,12 @@ private async Task CreateManagedConnectorInternalAsync(ManagedConnectorInp
await ValidateTechnicalUser(technicalUserId, result.CompanyId).ConfigureAwait(false);
- var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.CONNECTOR_AS_A_SERVICE, location, result.CompanyId, identity.CompanyId, technicalUserId);
+ var connectorRequestModel = new ConnectorRequestModel(name, connectorUrl, ConnectorTypeId.CONNECTOR_AS_A_SERVICE, location, result.CompanyId, companyId, technicalUserId);
return await CreateAndRegisterConnectorAsync(
connectorRequestModel,
result.ProviderBpn,
result.SelfDescriptionDocumentId!.Value,
certificate,
- identity.UserId,
subscriptionId,
cancellationToken).ConfigureAwait(false);
}
@@ -248,7 +246,6 @@ private async Task CreateAndRegisterConnectorAsync(
string businessPartnerNumber,
Guid selfDescriptionDocumentId,
IFormFile? file,
- Guid userId,
Guid? subscriptionId,
CancellationToken cancellationToken)
{
@@ -264,7 +261,6 @@ private async Task CreateAndRegisterConnectorAsync(
connector.ProviderId = provider;
connector.HostId = host;
connector.TypeId = type;
- connector.LastEditorId = userId;
connector.DateLastChanged = DateTimeOffset.UtcNow;
if (technicalUserId != null)
{
@@ -314,24 +310,29 @@ await _sdFactoryBusinessLogic
}
///
- public async Task DeleteConnectorAsync(Guid connectorId, Guid userId, CancellationToken cancellationToken)
+ public async Task DeleteConnectorAsync(Guid connectorId, Guid companyId, CancellationToken cancellationToken)
{
var connectorsRepository = _portalRepositories.GetInstance();
- var (isValidConnectorId, dapsClientId, selfDescriptionDocumentId,
- documentStatus, connectorStatus, dapsRegistrationSuccess) = await connectorsRepository.GetConnectorDeleteDataAsync(connectorId).ConfigureAwait(false);
+ var (isValidConnectorId, isProvidingOrHostCompany, dapsClientId, selfDescriptionDocumentId,
+ documentStatus, connectorStatus, dapsRegistrationSuccess) = await connectorsRepository.GetConnectorDeleteDataAsync(connectorId, companyId).ConfigureAwait(false);
if (!isValidConnectorId)
{
throw new NotFoundException($"Connector {connectorId} does not exist");
}
+ if (!isProvidingOrHostCompany)
+ {
+ throw new ForbiddenException($"company {companyId} is neither provider nor host-company of connector {connectorId}");
+ }
+
switch ((dapsRegistrationSuccess ?? false, connectorStatus))
{
case (true, ConnectorStatusId.ACTIVE) when selfDescriptionDocumentId == null:
- await DeleteUpdateConnectorDetail(connectorId, userId, dapsClientId, connectorsRepository, cancellationToken);
+ await DeleteUpdateConnectorDetail(connectorId, dapsClientId, connectorsRepository, cancellationToken);
break;
case (true, ConnectorStatusId.ACTIVE) when selfDescriptionDocumentId != null && documentStatus != null:
- await DeleteConnector(connectorId, userId, dapsClientId, selfDescriptionDocumentId.Value, documentStatus.Value, connectorsRepository, cancellationToken);
+ await DeleteConnector(connectorId, dapsClientId, selfDescriptionDocumentId.Value, documentStatus.Value, connectorsRepository, cancellationToken);
break;
case (false, ConnectorStatusId.PENDING) when selfDescriptionDocumentId == null:
await DeleteConnectorWithoutDocuments(connectorId, connectorsRepository);
@@ -346,17 +347,17 @@ public async Task DeleteConnectorAsync(Guid connectorId, Guid userId, Cancellati
}
}
- private async Task DeleteConnector(Guid connectorId, Guid userId, string? dapsClientId, Guid selfDescriptionDocumentId, DocumentStatusId documentStatus, IConnectorsRepository connectorsRepository, CancellationToken cancellationToken)
+ private async Task DeleteConnector(Guid connectorId, string? dapsClientId, Guid selfDescriptionDocumentId, DocumentStatusId documentStatus, IConnectorsRepository connectorsRepository, CancellationToken cancellationToken)
{
_portalRepositories.GetInstance().AttachAndModifyDocument(
selfDescriptionDocumentId,
a => { a.DocumentStatusId = documentStatus; },
a => { a.DocumentStatusId = DocumentStatusId.INACTIVE; });
- await DeleteUpdateConnectorDetail(connectorId, userId, dapsClientId, connectorsRepository, cancellationToken);
+ await DeleteUpdateConnectorDetail(connectorId, dapsClientId, connectorsRepository, cancellationToken);
}
- private async Task DeleteUpdateConnectorDetail(Guid connectorId, Guid userId, string? dapsClientId, IConnectorsRepository connectorsRepository, CancellationToken cancellationToken)
+ private async Task DeleteUpdateConnectorDetail(Guid connectorId, string? dapsClientId, IConnectorsRepository connectorsRepository, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(dapsClientId))
{
@@ -367,7 +368,6 @@ private async Task DeleteUpdateConnectorDetail(Guid connectorId, Guid userId, st
connectorsRepository.AttachAndModifyConnector(connectorId, null, con =>
{
con.StatusId = ConnectorStatusId.INACTIVE;
- con.LastEditorId = userId;
con.DateLastChanged = DateTimeOffset.UtcNow;
});
await _dapsService.DeleteDapsClient(dapsClientId, cancellationToken).ConfigureAwait(false);
@@ -437,7 +437,6 @@ public async Task TriggerDapsAsync(Guid connectorId, IFormFile certificate
con.DapsRegistrationSuccessful = true;
con.StatusId = ConnectorStatusId.ACTIVE;
con.DateLastChanged = DateTimeOffset.UtcNow;
- con.LastEditorId = identity.UserId;
});
connectorsRepository.CreateConnectorClientDetails(connectorId, response.ClientId);
@@ -520,7 +519,10 @@ private async Task UpdateConnectorUrlInternal(Guid connectorId, ConnectorUpdateR
await _dapsService
.UpdateDapsConnectorUrl(connector.DapsClientId, data.ConnectorUrl, bpn, cancellationToken)
.ConfigureAwait(false);
- connectorsRepository.AttachAndModifyConnector(connectorId, null, con => { con.ConnectorUrl = data.ConnectorUrl; });
+ connectorsRepository.AttachAndModifyConnector(connectorId, null, con =>
+ {
+ con.ConnectorUrl = data.ConnectorUrl;
+ });
await _portalRepositories.SaveAsync().ConfigureAwait(false);
}
diff --git a/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs
index 621c22f3cb..20a3b87e04 100644
--- a/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/IConnectorsBusinessLogic.cs
@@ -54,27 +54,27 @@ public interface IConnectorsBusinessLogic
/// Add a connector to persistence layer and calls the sd factory service with connector parameters.
///
/// Connector parameters for creation.
- /// identity (userId and companyId) of the user
+ /// companyId of the user
///
/// View model of created connector.
- Task CreateConnectorAsync(ConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken);
+ Task CreateConnectorAsync(ConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken);
///
/// Add a managed connector to persistence layer and calls the sd factory service with connector parameters.
///
/// Connector parameters for creation.
- /// identity (userId and companyId) of the user
+ /// companyId of the user
///
/// View model of created connector.
- Task CreateManagedConnectorAsync(ManagedConnectorInputModel connectorInputModel, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken);
+ Task CreateManagedConnectorAsync(ManagedConnectorInputModel connectorInputModel, Guid companyId, CancellationToken cancellationToken);
///
/// Remove a connector from persistence layer by id.
///
/// ID of the connector to be deleted.
- /// userId of the user
+ /// companyId of the user
/// Cancellation Token
- Task DeleteConnectorAsync(Guid connectorId, Guid userId, CancellationToken cancellationToken);
+ Task DeleteConnectorAsync(Guid connectorId, Guid companyId, CancellationToken cancellationToken);
///
/// Retrieve connector end point along with bpns
diff --git a/src/administration/Administration.Service/BusinessLogic/IIdentityProviderBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IIdentityProviderBusinessLogic.cs
index 7851057064..1778037751 100644
--- a/src/administration/Administration.Service/BusinessLogic/IIdentityProviderBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/IIdentityProviderBusinessLogic.cs
@@ -34,7 +34,7 @@ public interface IIdentityProviderBusinessLogic
ValueTask DeleteCompanyIdentityProviderAsync(Guid identityProviderId, Guid companyId);
IAsyncEnumerable GetOwnCompanyUsersIdentityProviderDataAsync(IEnumerable identityProviderIds, Guid companyId, bool unlinkedUsersOnly);
(Stream FileStream, string ContentType, string FileName, Encoding Encoding) GetOwnCompanyUsersIdentityProviderLinkDataStream(IEnumerable identityProviderIds, Guid companyId, bool unlinkedUsersOnly);
- ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataAsync(IFormFile document, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken);
+ ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataAsync(IFormFile document, Guid companyId, CancellationToken cancellationToken);
ValueTask CreateOwnCompanyUserIdentityProviderLinkDataAsync(Guid companyUserId, UserIdentityProviderLinkData identityProviderLinkData, Guid companyId);
ValueTask CreateOrUpdateOwnCompanyUserIdentityProviderLinkDataAsync(Guid companyUserId, Guid identityProviderId, UserLinkData userLinkData, Guid companyId);
ValueTask GetOwnCompanyUserIdentityProviderLinkDataAsync(Guid companyUserId, Guid identityProviderId, Guid companyId);
diff --git a/src/administration/Administration.Service/BusinessLogic/IInvitationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IInvitationBusinessLogic.cs
index c4feb93a12..09cc651f22 100644
--- a/src/administration/Administration.Service/BusinessLogic/IInvitationBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/IInvitationBusinessLogic.cs
@@ -24,6 +24,6 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLog
{
public interface IInvitationBusinessLogic
{
- Task ExecuteInvitation(CompanyInvitationData invitationData, Guid userId);
+ Task ExecuteInvitation(CompanyInvitationData invitationData);
}
}
diff --git a/src/administration/Administration.Service/BusinessLogic/ISubscriptionConfigurationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/ISubscriptionConfigurationBusinessLogic.cs
index 1162a48dab..c2ee708094 100644
--- a/src/administration/Administration.Service/BusinessLogic/ISubscriptionConfigurationBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/ISubscriptionConfigurationBusinessLogic.cs
@@ -66,6 +66,6 @@ public interface ISubscriptionConfigurationBusinessLogic
/// Sets service provider company details
///
/// Detail data for the service provider
- /// Id of the users and the users company
- Task SetProviderCompanyDetailsAsync(ProviderDetailData data, (Guid UserId, Guid CompanyId) identity);
+ /// Id of the users company
+ Task SetProviderCompanyDetailsAsync(ProviderDetailData data, Guid companyId);
}
diff --git a/src/administration/Administration.Service/BusinessLogic/IUserBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IUserBusinessLogic.cs
index bb9625c82c..cbf8b21a2f 100644
--- a/src/administration/Administration.Service/BusinessLogic/IUserBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/IUserBusinessLogic.cs
@@ -47,7 +47,7 @@ public interface IUserBusinessLogic
///
///
Task DeleteOwnUserAsync(Guid companyUserId, Guid userId);
- IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable userIds, (Guid UserId, Guid CompanyId) identity);
+ IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable userIds, Guid companyId);
Task ExecuteOwnCompanyUserPasswordReset(Guid companyUserId, (Guid UserId, Guid CompanyId) identity);
Task> GetOwnCompanyAppUsersAsync(Guid appId, Guid userId, int page, int size, CompanyUserFilter filter);
Task DeleteOwnUserBusinessPartnerNumbersAsync(Guid userId, string businessPartnerNumber, (Guid UserId, Guid CompanyId) identity);
diff --git a/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs
index 16a60963b8..744cef0301 100644
--- a/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/IdentityProviderBusinessLogic.cs
@@ -516,19 +516,19 @@ public async IAsyncEnumerable GetOwnCompanyUsersIdenti
return (new AsyncEnumerableStringStream(GetOwnCompanyUsersIdentityProviderDataLines(identityProviderIds, unlinkedUsersOnly, companyId), csvSettings.Encoding), csvSettings.ContentType, csvSettings.FileName, csvSettings.Encoding);
}
- public ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataAsync(IFormFile document, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken)
+ public ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataAsync(IFormFile document, Guid companyId, CancellationToken cancellationToken)
{
if (!document.ContentType.Equals(_settings.CsvSettings.ContentType, StringComparison.OrdinalIgnoreCase))
{
throw new UnsupportedMediaTypeException($"Only contentType {_settings.CsvSettings.ContentType} files are allowed.");
}
- return UploadOwnCompanyUsersIdentityProviderLinkDataInternalAsync(document, identity, cancellationToken);
+ return UploadOwnCompanyUsersIdentityProviderLinkDataInternalAsync(document, companyId, cancellationToken);
}
- private async ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataInternalAsync(IFormFile document, (Guid UserId, Guid CompanyId) identity, CancellationToken cancellationToken)
+ private async ValueTask UploadOwnCompanyUsersIdentityProviderLinkDataInternalAsync(IFormFile document, Guid companyId, CancellationToken cancellationToken)
{
var userRepository = _portalRepositories.GetInstance();
- var (sharedIdpAlias, existingAliase) = await GetCompanyAliasDataAsync(identity.CompanyId).ConfigureAwait(false);
+ var (sharedIdpAlias, existingAliase) = await GetCompanyAliasDataAsync(companyId).ConfigureAwait(false);
using var stream = document.OpenReadStream();
@@ -541,7 +541,7 @@ private async ValueTask UploadOwnCompanyUsersIdenti
numIdps = ParseCSVFirstLineReturningNumIdps(line);
},
line => ParseCSVLine(line, numIdps, existingAliase),
- lines => ProcessOwnCompanyUsersIdentityProviderLinkDataInternalAsync(lines, userRepository, identity.CompanyId, sharedIdpAlias, identity.UserId, cancellationToken),
+ lines => ProcessOwnCompanyUsersIdentityProviderLinkDataInternalAsync(lines, userRepository, companyId, sharedIdpAlias, cancellationToken),
cancellationToken
).ConfigureAwait(false);
@@ -556,7 +556,6 @@ private async ValueTask UploadOwnCompanyUsersIdenti
IUserRepository userRepository,
Guid companyId,
string? sharedIdpAlias,
- Guid creatorId,
[EnumeratorCancellation] CancellationToken cancellationToken)
{
await foreach (var (companyUserId, profile, identityProviderLinks) in userProfileLinkDatas)
@@ -578,7 +577,7 @@ private async ValueTask UploadOwnCompanyUsersIdenti
if (existingProfile != profile)
{
- await UpdateUserProfileAsync(userRepository, userEntityId, companyUserId, profile, existingLinks, sharedIdpAlias, creatorId).ConfigureAwait(false);
+ await UpdateUserProfileAsync(userRepository, userEntityId, companyUserId, profile, existingLinks, sharedIdpAlias).ConfigureAwait(false);
updated = true;
}
success = updated;
@@ -644,7 +643,7 @@ private async ValueTask UpdateIdentityProviderLinksAsync(string userEntity
return true;
}
- private async ValueTask UpdateUserProfileAsync(IUserRepository userRepository, string userEntityId, Guid companyUserId, UserProfile profile, IEnumerable existingLinks, string? sharedIdpAlias, Guid creatorId)
+ private async ValueTask UpdateUserProfileAsync(IUserRepository userRepository, string userEntityId, Guid companyUserId, UserProfile profile, IEnumerable existingLinks, string? sharedIdpAlias)
{
var (firstName, lastName, email) = (profile.FirstName ?? "", profile.LastName ?? "", profile.Email ?? "");
@@ -663,7 +662,6 @@ private async ValueTask UpdateUserProfileAsync(IUserRepository userRepository, s
companyUser.Firstname = profile.FirstName;
companyUser.Lastname = profile.LastName;
companyUser.Email = profile.Email;
- companyUser.LastEditorId = creatorId;
});
await _portalRepositories.SaveAsync().ConfigureAwait(false);
}
diff --git a/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs
index 65447652ae..af699f7a74 100644
--- a/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/InvitationBusinessLogic.cs
@@ -62,7 +62,7 @@ public InvitationBusinessLogic(
_settings = settings.Value;
}
- public Task ExecuteInvitation(CompanyInvitationData invitationData, Guid userId)
+ public Task ExecuteInvitation(CompanyInvitationData invitationData)
{
if (string.IsNullOrWhiteSpace(invitationData.email))
{
@@ -72,10 +72,10 @@ public Task ExecuteInvitation(CompanyInvitationData invitationData, Guid userId)
{
throw new ControllerArgumentException("organisationName must not be empty", "organisationName");
}
- return ExecuteInvitationInternalAsync(invitationData, userId);
+ return ExecuteInvitationInternalAsync(invitationData);
}
- private async Task ExecuteInvitationInternalAsync(CompanyInvitationData invitationData, Guid userId)
+ private async Task ExecuteInvitationInternalAsync(CompanyInvitationData invitationData)
{
var idpName = await _provisioningManager.GetNextCentralIdentityProviderNameAsync().ConfigureAwait(false);
await _provisioningManager.SetupSharedIdpAsync(idpName, invitationData.organisationName, _settings.InitialLoginTheme).ConfigureAwait(false);
@@ -96,7 +96,6 @@ private async Task ExecuteInvitationInternalAsync(CompanyInvitationData invitati
company.Id,
company.Name,
null,
- userId,
idpName,
true
);
diff --git a/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs
index 109dcb2524..049e25c8cd 100644
--- a/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/SubscriptionConfigurationBusinessLogic.cs
@@ -59,7 +59,7 @@ public async Task GetProviderCompanyDetailsAsync(Guid
}
///
- public Task SetProviderCompanyDetailsAsync(ProviderDetailData data, (Guid UserId, Guid CompanyId) identity)
+ public Task SetProviderCompanyDetailsAsync(ProviderDetailData data, Guid companyId)
{
data.Url.EnsureValidHttpsUrl(() => nameof(data.Url));
data.CallbackUrl?.EnsureValidHttpsUrl(() => nameof(data.CallbackUrl));
@@ -70,36 +70,35 @@ public Task SetProviderCompanyDetailsAsync(ProviderDetailData data, (Guid UserId
"the maximum allowed length is 100 characters", nameof(data.Url));
}
- return SetOfferProviderCompanyDetailsInternalAsync(data, identity);
+ return SetOfferProviderCompanyDetailsInternalAsync(data, companyId);
}
- private async Task SetOfferProviderCompanyDetailsInternalAsync(ProviderDetailData data, (Guid UserId, Guid CompanyId) identity)
+ private async Task SetOfferProviderCompanyDetailsInternalAsync(ProviderDetailData data, Guid companyId)
{
var companyRepository = _portalRepositories.GetInstance();
var providerDetailData = await companyRepository
- .GetProviderCompanyDetailsExistsForUser(identity.CompanyId)
+ .GetProviderCompanyDetailsExistsForUser(companyId)
.ConfigureAwait(false);
if (providerDetailData == default)
{
var result = await companyRepository
- .IsValidCompanyRoleOwner(identity.CompanyId, new[] { CompanyRoleId.APP_PROVIDER, CompanyRoleId.SERVICE_PROVIDER })
+ .IsValidCompanyRoleOwner(companyId, new[] { CompanyRoleId.APP_PROVIDER, CompanyRoleId.SERVICE_PROVIDER })
.ConfigureAwait(false);
if (!result.IsValidCompanyId)
{
- throw new ConflictException($"Company {identity.CompanyId} not found");
+ throw new ConflictException($"Company {companyId} not found");
}
if (!result.IsCompanyRoleOwner)
{
- throw new ForbiddenException($"Company {identity.CompanyId} is not an app- or service-provider");
+ throw new ForbiddenException($"Company {companyId} is not an app- or service-provider");
}
- companyRepository.CreateProviderCompanyDetail(identity.CompanyId, data.Url, providerDetails =>
+ companyRepository.CreateProviderCompanyDetail(companyId, data.Url, providerDetails =>
{
if (data.CallbackUrl != null)
{
providerDetails.AutoSetupCallbackUrl = data.CallbackUrl;
}
providerDetails.DateLastChanged = DateTimeOffset.UtcNow;
- providerDetails.LastEditorId = identity.UserId;
});
}
else
@@ -111,7 +110,6 @@ private async Task SetOfferProviderCompanyDetailsInternalAsync(ProviderDetailDat
{
details.AutoSetupUrl = data.Url;
details.DateLastChanged = DateTimeOffset.UtcNow;
- details.LastEditorId = identity.UserId;
});
}
await _portalRepositories.SaveAsync().ConfigureAwait(false);
diff --git a/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs
index 21d701710a..fb05c2bb6e 100644
--- a/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs
+++ b/src/administration/Administration.Service/BusinessLogic/UserBusinessLogic.cs
@@ -384,20 +384,20 @@ public async Task DeleteOwnUserAsync(Guid companyUserId, Guid userId)
throw new ConflictException($"user {userId} does not exist");
}
var (sharedIdpAlias, accountData) = iamIdpAliasAccountData;
- await DeleteUserInternalAsync(sharedIdpAlias, accountData, userId).ConfigureAwait(false);
+ await DeleteUserInternalAsync(sharedIdpAlias, accountData).ConfigureAwait(false);
return await _portalRepositories.SaveAsync().ConfigureAwait(false);
}
- public async IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable userIds, (Guid UserId, Guid CompanyId) identity)
+ public async IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable userIds, Guid companyId)
{
- var iamIdpAlias = await _portalRepositories.GetInstance().GetSharedIdentityProviderIamAliasDataUntrackedAsync(identity.CompanyId);
+ var iamIdpAlias = await _portalRepositories.GetInstance().GetSharedIdentityProviderIamAliasDataUntrackedAsync(companyId);
- await foreach (var accountData in _portalRepositories.GetInstance().GetCompanyUserAccountDataUntrackedAsync(userIds, identity.CompanyId).ConfigureAwait(false))
+ await foreach (var accountData in _portalRepositories.GetInstance().GetCompanyUserAccountDataUntrackedAsync(userIds, companyId).ConfigureAwait(false))
{
var success = false;
try
{
- await DeleteUserInternalAsync(iamIdpAlias, accountData, identity.UserId).ConfigureAwait(false);
+ await DeleteUserInternalAsync(iamIdpAlias, accountData).ConfigureAwait(false);
success = true;
}
catch (Exception e)
@@ -419,7 +419,7 @@ public async IAsyncEnumerable DeleteOwnCompanyUsersAsync(IEnumerable
await _portalRepositories.SaveAsync().ConfigureAwait(false);
}
- private async Task DeleteUserInternalAsync(string? sharedIdpAlias, CompanyUserAccountData accountData, Guid administratorId)
+ private async Task DeleteUserInternalAsync(string? sharedIdpAlias, CompanyUserAccountData accountData)
{
var (userId, userEntityId, businessPartnerNumbers, roleIds, offerIds, invitationIds) = accountData;
if (userEntityId != null)
@@ -434,16 +434,9 @@ private async Task DeleteUserInternalAsync(string? sharedIdpAlias, CompanyUserAc
i =>
{
i.UserStatusId = UserStatusId.DELETED;
- i.LastEditorId = administratorId;
i.UserEntityId = null;
});
- _portalRepositories.GetInstance().AttachAndModifyCompanyUser(userId, null,
- i =>
- {
- i.LastEditorId = administratorId;
- });
-
_portalRepositories.GetInstance()
.DeleteCompanyUserAssignedBusinessPartners(businessPartnerNumbers.Select(bpn => (userId, bpn)));
diff --git a/src/administration/Administration.Service/Controllers/CompanyDataController.cs b/src/administration/Administration.Service/Controllers/CompanyDataController.cs
index 86551c3d94..b4e5fbbdd9 100644
--- a/src/administration/Administration.Service/Controllers/CompanyDataController.cs
+++ b/src/administration/Administration.Service/Controllers/CompanyDataController.cs
@@ -159,7 +159,6 @@ public IAsyncEnumerable GetCompanyRoleAndConsentAgre
[HttpPost]
[Authorize(Roles = "view_company_data")]
[Authorize(Policy = PolicyTypes.ValidIdentity)]
- [Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("companyRolesAndConsents")]
[ProducesResponseType(typeof(NoContentResult), StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
@@ -232,7 +231,6 @@ public IAsyncEnumerable GetCertificateTypes() =>
[Consumes("multipart/form-data")]
[Authorize(Roles = "request_ssicredential")]
[Authorize(Policy = PolicyTypes.ValidIdentity)]
- [Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("useCaseParticipation")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
@@ -258,7 +256,6 @@ public async Task CreateUseCaseParticipation([FromForm] UseCase
[Consumes("multipart/form-data")]
[Authorize(Roles = "request_ssicredential")]
[Authorize(Policy = PolicyTypes.ValidIdentity)]
- [Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("certificates")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
diff --git a/src/administration/Administration.Service/Controllers/ConnectorsController.cs b/src/administration/Administration.Service/Controllers/ConnectorsController.cs
index 0b1bf54823..a7c50ca0ce 100644
--- a/src/administration/Administration.Service/Controllers/ConnectorsController.cs
+++ b/src/administration/Administration.Service/Controllers/ConnectorsController.cs
@@ -125,7 +125,7 @@ public Task GetCompanyConnectorByIdForCurrentUserAsync([FromRoute
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status503ServiceUnavailable)]
public async Task CreateConnectorAsync([FromForm] ConnectorInputModel connectorInputModel, CancellationToken cancellationToken)
{
- var connectorId = await this.WithUserIdAndCompanyId(identity => _businessLogic.CreateConnectorAsync(connectorInputModel, identity, cancellationToken)).ConfigureAwait(false);
+ var connectorId = await this.WithCompanyId(companyId => _businessLogic.CreateConnectorAsync(connectorInputModel, companyId, cancellationToken)).ConfigureAwait(false);
return CreatedAtRoute(nameof(GetCompanyConnectorByIdForCurrentUserAsync), new { connectorId }, connectorId);
}
@@ -149,7 +149,7 @@ public async Task CreateConnectorAsync([FromForm] Connecto
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status503ServiceUnavailable)]
public async Task CreateManagedConnectorAsync([FromForm] ManagedConnectorInputModel connectorInputModel, CancellationToken cancellationToken)
{
- var connectorId = await this.WithUserIdAndCompanyId(identity => _businessLogic.CreateManagedConnectorAsync(connectorInputModel, identity, cancellationToken)).ConfigureAwait(false);
+ var connectorId = await this.WithCompanyId(companyId => _businessLogic.CreateManagedConnectorAsync(connectorInputModel, companyId, cancellationToken)).ConfigureAwait(false);
return CreatedAtRoute(nameof(GetCompanyConnectorByIdForCurrentUserAsync), new { connectorId }, connectorId);
}
@@ -198,7 +198,7 @@ public async Task TriggerDapsAuth([FromRoute] Guid connectorId, [FromForm]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public async Task DeleteConnectorAsync([FromRoute] Guid connectorId, CancellationToken cancellationToken)
{
- await this.WithUserId(userId => _businessLogic.DeleteConnectorAsync(connectorId, userId, cancellationToken));
+ await this.WithCompanyId(companyId => _businessLogic.DeleteConnectorAsync(connectorId, companyId, cancellationToken));
return NoContent();
}
diff --git a/src/administration/Administration.Service/Controllers/IdentityProviderController.cs b/src/administration/Administration.Service/Controllers/IdentityProviderController.cs
index 870c3f593b..a7c6a3e72f 100644
--- a/src/administration/Administration.Service/Controllers/IdentityProviderController.cs
+++ b/src/administration/Administration.Service/Controllers/IdentityProviderController.cs
@@ -271,7 +271,7 @@ public IActionResult GetOwnCompanyUsersIdentityProviderFileAsync([FromQuery] IEn
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status415UnsupportedMediaType)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status502BadGateway)]
public ValueTask UploadOwnCompanyUsersIdentityProviderFileAsync([FromForm(Name = "document")] IFormFile document, CancellationToken cancellationToken) =>
- this.WithUserIdAndCompanyId(identity => _businessLogic.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(document, identity, cancellationToken));
+ this.WithCompanyId(companyId => _businessLogic.UploadOwnCompanyUsersIdentityProviderLinkDataAsync(document, companyId, cancellationToken));
///
/// Adds the user to the given identity provider
diff --git a/src/administration/Administration.Service/Controllers/InvitationController.cs b/src/administration/Administration.Service/Controllers/InvitationController.cs
index a1edb4f16d..75d0cfdc36 100644
--- a/src/administration/Administration.Service/Controllers/InvitationController.cs
+++ b/src/administration/Administration.Service/Controllers/InvitationController.cs
@@ -70,5 +70,5 @@ public InvitationController(IInvitationBusinessLogic logic)
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status502BadGateway)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status409Conflict)]
public Task ExecuteInvitation([FromBody] CompanyInvitationData invitationData) =>
- this.WithUserId(userId => _logic.ExecuteInvitation(invitationData, userId));
+ _logic.ExecuteInvitation(invitationData);
}
diff --git a/src/administration/Administration.Service/Controllers/RegistrationController.cs b/src/administration/Administration.Service/Controllers/RegistrationController.cs
index 6bea9cae63..614809088b 100644
--- a/src/administration/Administration.Service/Controllers/RegistrationController.cs
+++ b/src/administration/Administration.Service/Controllers/RegistrationController.cs
@@ -25,6 +25,7 @@
using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling.Library;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
+using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.Models;
@@ -157,7 +158,8 @@ public async Task ApproveApplication([FromRoute] Guid applicati
/// Either the CompanyApplication is not in status SUBMITTED, or there is no checklist entry of type Registration_Verification.
/// Application ID not found.
[HttpPost]
- // [Authorize(Roles = "decline_new_partner")]
+ [Authorize(Roles = "decline_new_partner")]
+ [Authorize(Policy = PolicyTypes.ValidIdentity)]
[Route("applications/{applicationId}/decline")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
diff --git a/src/administration/Administration.Service/Controllers/SubscriptionConfigurationController.cs b/src/administration/Administration.Service/Controllers/SubscriptionConfigurationController.cs
index d923f7eaf4..ed5fc4b456 100644
--- a/src/administration/Administration.Service/Controllers/SubscriptionConfigurationController.cs
+++ b/src/administration/Administration.Service/Controllers/SubscriptionConfigurationController.cs
@@ -88,7 +88,7 @@ public Task GetServiceProviderCompanyDetail() =>
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public async Task SetProviderCompanyDetail([FromBody] ProviderDetailData data)
{
- await this.WithUserIdAndCompanyId(identity => _businessLogic.SetProviderCompanyDetailsAsync(data, identity)).ConfigureAwait(false);
+ await this.WithCompanyId(companyId => _businessLogic.SetProviderCompanyDetailsAsync(data, companyId)).ConfigureAwait(false);
return NoContent();
}
diff --git a/src/administration/Administration.Service/Controllers/UserController.cs b/src/administration/Administration.Service/Controllers/UserController.cs
index 53bd500434..5fc2f4e2ca 100644
--- a/src/administration/Administration.Service/Controllers/UserController.cs
+++ b/src/administration/Administration.Service/Controllers/UserController.cs
@@ -312,7 +312,7 @@ public Task AddOwnCompanyUserBusinessPartnerNumber(Guid companyUserId, stri
[ProducesResponseType(typeof(IAsyncEnumerable), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
public IAsyncEnumerable DeleteOwnCompanyUsers([FromBody] IEnumerable usersToDelete) =>
- this.WithUserIdAndCompanyId(identity => _logic.DeleteOwnCompanyUsersAsync(usersToDelete, identity));
+ this.WithCompanyId(companyId => _logic.DeleteOwnCompanyUsersAsync(usersToDelete, companyId));
///
/// Resets the password for the given user
diff --git a/src/administration/Administration.Service/appsettings.json b/src/administration/Administration.Service/appsettings.json
index d241dc1a72..36d98cd105 100644
--- a/src/administration/Administration.Service/appsettings.json
+++ b/src/administration/Administration.Service/appsettings.json
@@ -1,15 +1,12 @@
{
- "Logging": {
- "LogLevel": {
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.Console" ],
+ "MinimumLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic": "Information"
- }
- },
- "Serilog": {
- "Using": [ "Serilog.Sinks.Console" ],
- "MinimumLevel": "Information",
+ },
"WriteTo": [
{ "Name": "Console" }
],
diff --git a/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj b/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj
index 260d237f14..7d3e0daf02 100644
--- a/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj
+++ b/src/externalsystems/Bpdm.Library/Bpdm.Library.csproj
@@ -29,6 +29,7 @@
+
diff --git a/src/externalsystems/Bpdm.Library/BpdmService.cs b/src/externalsystems/Bpdm.Library/BpdmService.cs
index 30ecf9ea44..391a68373c 100644
--- a/src/externalsystems/Bpdm.Library/BpdmService.cs
+++ b/src/externalsystems/Bpdm.Library/BpdmService.cs
@@ -22,7 +22,6 @@
using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
using Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions;
-using Org.Eclipse.TractusX.Portal.Backend.Framework.Linq;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Token;
using System.Net.Http.Json;
using System.Text.Json;
@@ -37,7 +36,10 @@ public class BpdmService : IBpdmService
private static readonly JsonSerializerOptions Options = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
- Converters = { new JsonStringEnumConverter(allowIntegerValues: false) }
+ Converters =
+ {
+ new JsonStringEnumConverter(allowIntegerValues: false),
+ }
};
public BpdmService(ITokenService tokenService, IOptions options)
@@ -54,75 +56,54 @@ public async Task PutInputLegalEntity(BpdmTransferData data, CancellationT
var requestData = new BpdmLegalEntityData[]
{
new(
- data.ExternalId, // ExternalId
- null, // Bpn
+ data.ExternalId, // Index
+ Enumerable.Repeat(data.CompanyName, 1), // LegalName
+ data.ShortName, // LegalShortName
+ null, // LegalForm
data.Identifiers.Select(x =>
new BpdmIdentifier(
- x.Value, // Value
- x.BpdmIdentifierId, // Type
- null, // IssuingBody
- null)), // Status
- new BpdmName[] // Names
- {
- new (
- data.CompanyName, // Value
- null, // ShortName
- "REGISTERED", // Type
- "de") // Language
- },
- null, // LegalForm
- null, // Status
- Enumerable.Empty(),
- Enumerable.Empty(), // Types
- Enumerable.Empty(),
+ x.Value, // Value
+ x.BpdmIdentifierId, // Type
+ null)), // IssuingBody
+ Enumerable.Empty(), // Status
+ Enumerable.Empty(), // Classifications
+ Enumerable.Empty(), // Roles
new BpdmLegalAddress(
- new BpdmAddressVersion(
- "WESTERN_LATIN_STANDARD", //CharacterSet
- "de"), // Version
- null, // CareOf
- Enumerable.Empty(),// Contexts
- data.AlphaCode2, // Country
- data.Region == null
- ? Enumerable.Empty()
- : new BpdmAdministrativeArea[] {
- new (
- data.Region, // Value
- null, // ShortName
- null, // Fipscode
- "COUNTY" // Type
- )
- },
- data.ZipCode == null
- ? Enumerable.Empty()
- : new BpdmPostcode[] {
- new (
- data.ZipCode, // Value
- "REGULAR") // Type
- },
- new BpdmLocality[] {
- new (
- data.City, // Value
- null, // ShortName
- "CITY") // Type
- },
- new BpdmThoroughfare[] {
- new (
- data.StreetName, // Value
- null, // Name
- null, // ShortName
- data.StreetNumber, // Number
- null, // Direction
- "STREET") // Type
- },
- Enumerable.Empty(),
- Enumerable.Empty(),
- null, // GeographicCoordinates
- Enumerable.Empty() // Types
- )
+ Enumerable.Empty(), // Name
+ Enumerable.Empty(), // States
+ Enumerable.Empty(), // Identifiers
+ new BpdmAddressPhysicalPostalAddress( // PhysicalPostalAddress
+ null, // GeographicCoordinates
+ data.AlphaCode2, // Country
+ data.ZipCode, // PostalCode
+ data.City, // City
+ new BpdmStreet(
+ null, // NamePrefix
+ null, // AdditionalNamePrefix
+ data.StreetName, // Name
+ null, // NameSuffix
+ null, // AdditionalNameSuffix
+ data.StreetNumber, // StreetNumber
+ null, // Milestone
+ null // Direction
+ ),
+ data.Region, // AdministrativeAreaLevel1
+ null, // AdministrativeAreaLevel2
+ null, // AdministrativeAreaLevel3
+ null, // District
+ null, // CompanyPostalCode
+ null, // IndustrialZone
+ null, // Building
+ null, // Floor
+ null // Door
+ ),
+ null, // AlternativePostalAddress
+ Enumerable.Empty()
+ )
)
};
- await httpClient.PutAsJsonAsync("/api/catena/input/legal-entities", requestData, Options, cancellationToken)
+ await httpClient.PutAsJsonAsync("/companies/test-company/api/catena/input/legal-entities", requestData, Options, cancellationToken)
.CatchingIntoServiceExceptionFor("bpdm-put-legal-entities", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE).ConfigureAwait(false);
return true;
}
@@ -132,28 +113,19 @@ public async Task FetchInputLegalEntity(string extern
var httpClient = await _tokenService.GetAuthorizedClient(_settings, cancellationToken).ConfigureAwait(false);
var data = Enumerable.Repeat(externalId, 1);
- var result = await httpClient.PostAsJsonAsync("/api/catena/output/legal-entities/search", data, Options, cancellationToken)
+ var result = await httpClient.PostAsJsonAsync("/companies/test-company/api/catena/output/legal-entities/search", data, Options, cancellationToken)
.CatchingIntoServiceExceptionFor("bpdm-search-legal-entities", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE).ConfigureAwait(false);
try
{
- var paginationResponse = await result.Content
+ var response = await result.Content
.ReadFromJsonAsync(Options, cancellationToken)
.ConfigureAwait(false);
- if (paginationResponse?.Content == null || paginationResponse.Errors == null)
+ if (response?.Content?.Count() != 1)
{
throw new ServiceException("Access to external system bpdm did not return a valid legal entity response", true);
}
- paginationResponse.Errors.IfAny(errors =>
- throw new ServiceException($"The external system bpdm responded with errors {string.Join(";", errors.Select(x => $"ErrorCode: {x.ErrorCode}, ErrorMessage: {x.Message}"))}"));
- try
- {
- return paginationResponse.Content.Single(x => x.ExternalId == externalId);
- }
- catch (InvalidOperationException)
- {
- throw new ServiceException("Access to external system bpdm did not return a valid legal entity response", true);
- }
+ return response.Content.Single();
}
catch (JsonException je)
{
diff --git a/src/externalsystems/Bpdm.Library/BpnAccess.cs b/src/externalsystems/Bpdm.Library/BpnAccess.cs
new file mode 100644
index 0000000000..d894c46c9a
--- /dev/null
+++ b/src/externalsystems/Bpdm.Library/BpnAccess.cs
@@ -0,0 +1,65 @@
+/********************************************************************************
+ * Copyright (c) 2021, 2023 Microsoft and BMW Group AG
+ * Copyright (c) 2021, 2023 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 Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models;
+using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
+using Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions;
+using System.Net.Http.Headers;
+using System.Net.Http.Json;
+using System.Text.Json;
+
+namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library;
+
+public class BpnAccess : IBpnAccess
+{
+ private readonly HttpClient _httpClient;
+ private static readonly JsonSerializerOptions Options = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
+
+ public BpnAccess(IHttpClientFactory httpFactory)
+ {
+ _httpClient = httpFactory.CreateClient(nameof(BpnAccess));
+ }
+
+ public async Task FetchLegalEntityByBpn(string businessPartnerNumber, string token, CancellationToken cancellationToken)
+ {
+ _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var uri = new UriBuilder
+ {
+ Path = $"pool/api/catena/legal-entities/{Uri.EscapeDataString(businessPartnerNumber)}",
+ Query = "idType=BPN"
+ }.Uri;
+ var result = await _httpClient.GetAsync(uri.PathAndQuery, cancellationToken)
+ .CatchingIntoServiceExceptionFor("bpn-fetch-legal-entity")
+ .ConfigureAwait(false);
+ try
+ {
+ var legalEntityResponse = await result.Content.ReadFromJsonAsync(Options, cancellationToken).ConfigureAwait(false);
+ if (legalEntityResponse?.Bpn == null)
+ {
+ throw new ServiceException("Access to external system bpdm did not return a valid legal entity response");
+ }
+ return legalEntityResponse;
+ }
+ catch (JsonException je)
+ {
+ throw new ServiceException($"Access to external system bpdm did not return a valid json response: {je.Message}");
+ }
+ }
+}
diff --git a/src/externalsystems/Bpdm.Library/BpdmServiceCollectionExtension.cs b/src/externalsystems/Bpdm.Library/DependencyInjection/BpdmServiceCollectionExtension.cs
similarity index 96%
rename from src/externalsystems/Bpdm.Library/BpdmServiceCollectionExtension.cs
rename to src/externalsystems/Bpdm.Library/DependencyInjection/BpdmServiceCollectionExtension.cs
index 69c2613322..c364267d40 100644
--- a/src/externalsystems/Bpdm.Library/BpdmServiceCollectionExtension.cs
+++ b/src/externalsystems/Bpdm.Library/DependencyInjection/BpdmServiceCollectionExtension.cs
@@ -25,7 +25,7 @@
using Org.Eclipse.TractusX.Portal.Backend.Framework.HttpClientExtensions;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging;
-namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library;
+namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.DependencyInjection;
public static class BpdmServiceCollectionExtension
{
diff --git a/src/registration/Registration.Service/Bpn/BpnAccessCollectionExtension.cs b/src/externalsystems/Bpdm.Library/DependencyInjection/BpnAccessCollectionExtension.cs
similarity index 92%
rename from src/registration/Registration.Service/Bpn/BpnAccessCollectionExtension.cs
rename to src/externalsystems/Bpdm.Library/DependencyInjection/BpnAccessCollectionExtension.cs
index 17d624f028..b474de05db 100644
--- a/src/registration/Registration.Service/Bpn/BpnAccessCollectionExtension.cs
+++ b/src/externalsystems/Bpdm.Library/DependencyInjection/BpnAccessCollectionExtension.cs
@@ -18,9 +18,10 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
+using Microsoft.Extensions.DependencyInjection;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging;
-namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn;
+namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.DependencyInjection;
public static class BpnAccessCollectionExtension
{
diff --git a/src/registration/Registration.Service/Bpn/IBpnAccess.cs b/src/externalsystems/Bpdm.Library/IBpnAccess.cs
similarity index 72%
rename from src/registration/Registration.Service/Bpn/IBpnAccess.cs
rename to src/externalsystems/Bpdm.Library/IBpnAccess.cs
index 13a73b0e27..f236af4c33 100644
--- a/src/registration/Registration.Service/Bpn/IBpnAccess.cs
+++ b/src/externalsystems/Bpdm.Library/IBpnAccess.cs
@@ -18,13 +18,11 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
-using Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model;
+using Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models;
-namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn;
+namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library;
public interface IBpnAccess
{
- IAsyncEnumerable FetchBusinessPartner(string bpn, string token, CancellationToken cancellationToken);
Task FetchLegalEntityByBpn(string businessPartnerNumber, string token, CancellationToken cancellationToken);
- IAsyncEnumerable FetchLegalEntityAddressByBpn(string businessPartnerNumber, string token, CancellationToken cancellationToken);
}
diff --git a/src/registration/Registration.Service/Bpn/Model/BpdmAddressDto.cs b/src/externalsystems/Bpdm.Library/Models/BpdmAddressDto.cs
similarity index 88%
rename from src/registration/Registration.Service/Bpn/Model/BpdmAddressDto.cs
rename to src/externalsystems/Bpdm.Library/Models/BpdmAddressDto.cs
index 9c83532f23..66bba76561 100644
--- a/src/registration/Registration.Service/Bpn/Model/BpdmAddressDto.cs
+++ b/src/externalsystems/Bpdm.Library/Models/BpdmAddressDto.cs
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
-namespace Org.Eclipse.TractusX.Portal.Backend.Registration.Service.Bpn.Model;
+namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models;
public record BpdmLegalEntityAddressDto(
string LegalEntity,
@@ -37,7 +37,7 @@ public record BpdmLegalAddressDto(
IEnumerable Premises,
IEnumerable PostalDeliveryPoints,
BpdmGeographicCoordinatesDto GeographicCoordinates,
- IEnumerable Types
+ IEnumerable Types
);
public record BpdmAddressVersionDto(
@@ -49,19 +49,19 @@ public record BpdmAdministrativeAreaDto(
string Value,
string ShortName,
string FipsCode,
- BpdmUrlDataDto Type,
+ BpdmTechnicalKey Type,
BpdmDataDto Language
);
public record BpdmPostCodeDto(
string Value,
- BpdmUrlDataDto Type
+ BpdmTechnicalKey Type
);
public record BpdmLocalityDto(
string Value,
string ShortName,
- BpdmUrlDataDto Type,
+ BpdmTechnicalKey Type,
BpdmDataDto Language
);
@@ -71,7 +71,7 @@ public record BpdmThoroughfareDto(
string ShortName,
string Number,
string Direction,
- BpdmUrlDataDto Type,
+ BpdmTechnicalKey Type,
BpdmDataDto Language
);
@@ -79,7 +79,7 @@ public record BpdmPremiseDto(
string Value,
string ShortName,
string Number,
- BpdmUrlDataDto Type,
+ BpdmTechnicalKey Type,
BpdmDataDto Language
);
@@ -87,12 +87,12 @@ public record BpdmPostalDeliveryPointDto(
string Value,
string ShortName,
string Number,
- BpdmUrlDataDto Type,
+ BpdmTechnicalKey Type,
BpdmDataDto Language
);
public record BpdmGeographicCoordinatesDto(
- int Longitude,
- int Latitude,
- int Altitude
+ double Longitude,
+ double Latitude,
+ double Altitude
);
diff --git a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityData.cs b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityData.cs
index 5ebe5c69cb..28274d2a15 100644
--- a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityData.cs
+++ b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityData.cs
@@ -24,186 +24,80 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models;
public record BpdmLegalEntityData(
string ExternalId,
- string? Bpn,
- IEnumerable Identifiers,
- IEnumerable Names,
+ IEnumerable LegalNameParts,
+ string? LegalShortName,
string? LegalForm,
- BpdmStatus? Status,
- IEnumerable ProfileClassifications,
- IEnumerable Types,
- IEnumerable? BankAccounts,
+ IEnumerable Identifiers,
+ IEnumerable States,
+ IEnumerable Classifications,
+ IEnumerable Roles,
BpdmLegalAddress LegalAddress
);
public record BpdmIdentifier(
string Value,
BpdmIdentifierId Type,
- string? IssuingBody,
- string? Status
-);
-
-public record BpdmName(
- string Value,
- string? ShortName,
- string Type,
- string Language
-);
-
-public record BpdmLegalForm
-(
- string TechnicalKey,
- string Name,
- string Url,
- string MainAbbreviation,
- BpdmLanguage Language,
- IEnumerable Categories
-);
-
-public record BpdmLanguage
-(
- string TechnicalKey,
- string Name
-);
-
-public record BpdmCategory
-(
- string Name,
- string Url
+ string? IssuingBody
);
public record BpdmStatus(
string OfficialDenotation,
DateTimeOffset ValidFrom,
DateTimeOffset ValidUntil,
- BpdmType Type
+ string Type
);
public record BpdmProfileClassification(
string Value,
string Code,
- BpdmProfileClassificationType Type
-);
-
-public record BpdmProfileClassificationType
-(
- string Name,
- string Url
-);
-
-public record BpdmType
-(
- string TechnicalKey,
- string Name,
- string Url
-);
-
-public record BpdmBankAccount(
- IEnumerable TrustScores,
- BpdmCurrency Currency,
- string InternationalBankAccountIdentifier,
- string InternationalBankIdentifier,
- string NationalBankAccountIdentifier,
- string NationalBankIdentifier
-);
-
-public record BpdmCurrency
-(
- string TechnicalKey,
- string Name
-);
-
-public record BpdmRoles
-(
- string TechnicalKey,
- string Name
-);
-
-public record BpdmReations
-(
- BpdmRelationClass RelationClass,
- BpdmRelationType Type,
- string StartNode,
- string EndNode,
- DateTimeOffset StartedAt,
- DateTimeOffset EndedAt
-);
-
-public record BpdmRelationClass
-(
- string TechnicalKey,
- string Name
-);
-
-public record BpdmRelationType
-(
- string TechnicalKey,
- string Name
-);
-
-public record BpdmLegalAddress(
- BpdmAddressVersion Version,
- string? CareOf,
- IEnumerable Contexts,
- string Country,
- IEnumerable AdministrativeAreas,
- IEnumerable PostCodes,
- IEnumerable Localities,
- IEnumerable Thoroughfares,
- IEnumerable Premises,
- IEnumerable PostalDeliveryPoints,
- BpdmGeographicCoordinates? GeographicCoordinates,
- IEnumerable Types
-);
-
-public record BpdmAddressVersion(
- string CharacterSet,
- string Language
-);
-
-public record BpdmAdministrativeArea(
- string Value,
- string? ShortName,
- string? FipsCode,
string Type
);
-public record BpdmPostcode(
- string Value,
- string Type
-);
-
-public record BpdmLocality(
- string Value,
- string? ShortName,
- string Type
-);
-
-public record BpdmThoroughfare(
- string Value,
- string? Name,
- string? ShortName,
- string? Number,
- string? Direction,
- string Type
-);
-
-public record BpdmPremise(
- string Value,
- string? ShortName,
- string? Number,
+public record BpdmLegalAddress(
+ IEnumerable NameParts,
+ IEnumerable States,
+ IEnumerable Identifiers,
+ BpdmAddressPhysicalPostalAddress PhysicalPostalAddress,
+ BpdmAddressAlternativePostalAddress? AlternativePostalAddress,
+ IEnumerable Roles
+);
+
+public record BpdmAddressState(
+ string Description,
+ DateTimeOffset? ValidFrom,
+ DateTimeOffset? ValidTo,
string Type
);
-public record BpdmPostalDeliveryPoint(
+public record BpdmAddressIdentifier(
string Value,
- string? ShortName,
- string? Number,
- string Type
+ BpdmIdentifierId Type
+);
+
+public record BpdmAddressPhysicalPostalAddress(
+ BpdmGeographicCoordinatesDto? GeographicCoordinates,
+ string? Country,
+ string? PostalCode,
+ string? City,
+ BpdmStreet? Street,
+ string? AdministrativeAreaLevel1,
+ string? AdministrativeAreaLevel2,
+ string? AdministrativeAreaLevel3,
+ string? District,
+ string? CompanyPostalCode,
+ string? IndustrialZone,
+ string? Building,
+ string? Floor,
+ string? Door
+);
+
+public record BpdmAddressAlternativePostalAddress(
+ BpdmGeographicCoordinatesDto? GeographicCoordinates,
+ string? Country,
+ string? PostalCode,
+ string? City,
+ string? AdministrativeAreaLevel1,
+ string? DeliveryServiceNumber,
+ string? DeliveryServiceType,
+ string? DeliveryServiceQualifier
);
-
-public record BpdmGeographicCoordinates(
- int Longitude,
- int Latitude,
- int Altitude
-);
-
diff --git a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityDto.cs b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityDto.cs
new file mode 100644
index 0000000000..cc337c73c6
--- /dev/null
+++ b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityDto.cs
@@ -0,0 +1,155 @@
+/********************************************************************************
+ * Copyright (c) 2021, 2023 Microsoft and BMW Group AG
+ * Copyright (c) 2021, 2023 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.Text.Json.Serialization;
+
+namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models;
+
+public record BpdmLegalEntityDto(
+ [property: JsonPropertyName("bpnl")] string Bpn,
+ [property: JsonPropertyName("legalName")] string? LegalName,
+ [property: JsonPropertyName("legalShortName")] string? LegalShortName,
+ [property: JsonPropertyName("currentness")] DateTimeOffset Currentness,
+ [property: JsonPropertyName("createdAt")] DateTimeOffset CreatedAt,
+ [property: JsonPropertyName("updatedAt")] DateTimeOffset UpdatedAt,
+ IEnumerable Identifiers,
+ BpdmLegalFormDto? LegalForm,
+ IEnumerable Status,
+ IEnumerable ProfileClassifications,
+ IEnumerable Relations,
+ BpdmLegalEntityAddress LegalEntityAddress
+);
+
+public record BpdmIdentifierDto(
+ string Value,
+ BpdmTechnicalKey Type,
+ string IssuingBody
+);
+
+public record BpdmLegalFormDto(
+ string TechnicalKey,
+ string Name,
+ string Abbreviation
+);
+
+public record BpdmStatusDto(
+ string OfficialDenotation,
+ DateTimeOffset ValidFrom,
+ DateTimeOffset ValidUntil,
+ BpdmTechnicalKey Type
+);
+
+public record BpdmProfileClassificationDto(
+ string Value,
+ string Code,
+ BpdmTechnicalKey Type
+);
+
+public record BpdmDataDto(
+ string TechnicalKey,
+ string Name
+);
+
+public record BpdmTechnicalKey(
+ string TechnicalKey,
+ string Name
+);
+
+public record BpdmRelationDto(
+ BpdmTechnicalKey Type,
+ string StartBpn,
+ string EndBpn,
+ DateTimeOffset ValidFrom,
+ DateTimeOffset ValidTo
+);
+
+public record BpdmLegalEntityAddress
+(
+ string Bpnl,
+ string Name,
+ string BpnLegalEntity,
+ string BpnSite,
+ DateTimeOffset CreatedAt,
+ DateTimeOffset UpdatedAt,
+ bool IsLegalAddress,
+ bool IsMainAddress,
+ IEnumerable States,
+ IEnumerable Identifiers,
+ BpdmPhysicalPostalAddress? PhysicalPostalAddress,
+ BpdmAlternativePostalAddress? AlternativePostalAddress
+);
+
+public record BpdmLegalEntityAddressState
+(
+ string Description,
+ DateTimeOffset ValidFrom,
+ DateTimeOffset ValidTo,
+ BpdmTechnicalKey Type
+);
+
+public record BpdmLegalEntityAddressIdentifier
+(
+ string Value,
+ BpdmTechnicalKey Type
+);
+
+public record BpdmPhysicalPostalAddress(
+ BpdmGeographicCoordinatesDto? GeographicCoordinates,
+ BpdmCountry? Country,
+ string? PostalCode,
+ string? City,
+ BpdmStreet? Street,
+ BpdmAdministrativeAreaLevel? AdministrativeAreaLevel1,
+ string? AdministrativeAreaLevel2,
+ string? AdministrativeAreaLevel3,
+ string? District,
+ string? CompanyPostalCode,
+ string? IndustrialZone,
+ string? Building,
+ string? Floor,
+ string? Door
+);
+
+public record BpdmAlternativePostalAddress(
+ BpdmGeographicCoordinatesDto? GeographicCoordinates,
+ BpdmCountry? Country,
+ string? PostalCode,
+ string? City,
+ BpdmAdministrativeAreaLevel? AdministrativeAreaLevel1,
+ string? DeliveryServiceNumber,
+ string? Type,
+ string? DeliveryServiceQualifier
+);
+
+public record BpdmAdministrativeAreaLevel(
+ string? Name,
+ string? RegionCode
+);
+
+public record BpdmStreet(
+ string? NamePrefix,
+ string? AdditionalNamePrefix,
+ string Name,
+ string? NameSuffix,
+ string? AdditionalNameSuffix,
+ string? HouseNumber,
+ string? Milestone,
+ string? Direction
+);
diff --git a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityOutputData.cs b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityOutputData.cs
index 213ce20ae1..0165103730 100644
--- a/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityOutputData.cs
+++ b/src/externalsystems/Bpdm.Library/Models/BpdmLegalEntityOutputData.cs
@@ -21,49 +21,33 @@
namespace Org.Eclipse.TractusX.Portal.Backend.Bpdm.Library.Models;
public record PageOutputResponseBpdmLegalEntityData(
- IEnumerable? Content,
- IEnumerable Errors
+ IEnumerable? Content
);
public record BpdmLegalEntityOutputData(
- string ExternalId,
+ string? ExternalId,
string? Bpn,
+ string? LegalShortName,
+ string? LegalForm,
IEnumerable Identifiers,
- IEnumerable Names,
- BpdmLegalForm? LegalForm,
- BpdmStatus? Status,
- IEnumerable ProfileClassifications,
- IEnumerable Types,
- IEnumerable? BankAccounts,
- IEnumerable Roles,
- IEnumerable Relations,
+ IEnumerable States,
+ IEnumerable Classifications,
+ IEnumerable LegalNameParts,
+ IEnumerable Roles,
BpdmLegalAddressResponse LegalAddress
);
public record BpdmLegalAddressResponse(
- BpdmAddressVersionResponse Version,
- string? CareOf,
- IEnumerable Contexts,
- BpdmCountry Country,
- IEnumerable AdministrativeAreas,
- IEnumerable PostCodes,
- IEnumerable Localities,
- IEnumerable Thoroughfares,
- IEnumerable Premises,
- IEnumerable PostalDeliveryPoints,
- BpdmGeographicCoordinates? GeographicCoordinates,
- IEnumerable Types
-);
-
-public record BpdmAddressVersionResponse(
- BpdmCharacterSet CharacterSet,
- BpdmLanguage Language
-);
-
-public record BpdmCharacterSet
-(
- string TechnicalKey,
- string Name
+ string ExternalId,
+ string LegalEntityExternalId,
+ string SiteExternalId,
+ string Bpn,
+ IEnumerable NameParts,
+ IEnumerable States,
+ IEnumerable Identifiers,
+ BpdmAddressPhysicalPostalAddress PhysicalPostalAddress,
+ BpdmAddressAlternativePostalAddress AlternativePostalAddress,
+ IEnumerable Roles
);
public record BpdmCountry
@@ -71,55 +55,3 @@ public record BpdmCountry
string TechnicalKey,
string Name
);
-
-public record BpdmAdministrativeAreaResponse(
- string Value,
- string? ShortName,
- string? FipsCode,
- BpdmType Type,
- BpdmLanguage Language
-);
-
-public record BpdmPostcodeResponse(
- string Value,
- BpdmType Type
-);
-
-public record BpdmLocalityResponse(
- string Value,
- string? ShortName,
- BpdmType Type,
- BpdmLanguage Language
-);
-
-public record BpdmThoroughfareResponse(
- string Value,
- string? Name,
- string? ShortName,
- string? Number,
- string? Direction,
- BpdmType Type,
- BpdmLanguage Language
-);
-
-public record BpdmPremiseResponse(
- string Value,
- string? ShortName,
- string? Number,
- BpdmType Type,
- BpdmLanguage Language
-);
-
-public record BpdmPostalDeliveryPointResponse(
- string Value,
- string? ShortName,
- string? Number,
- BpdmType Type,
- BpdmLanguage Language
-);
-
-public record BpdmErrorInfo(
- string ErrorCode,
- string Message,
- string EntityKey
-);
diff --git a/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs b/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs
index 78b7ebf02a..bb79494fd2 100644
--- a/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs
+++ b/src/externalsystems/SdFactory.Library/BusinessLogic/SdFactoryBusinessLogic.cs
@@ -146,7 +146,6 @@ public async Task ProcessFinishSelfDescriptionLpForConnector(SelfDescriptionResp
con.SelfDescriptionMessage = data.Message!;
}
- con.LastEditorId = companyUserId;
con.DateLastChanged = DateTimeOffset.UtcNow;
});
}
diff --git a/src/framework/Framework.DBAccess/Framework.DBAccess.csproj b/src/framework/Framework.DBAccess/Framework.DBAccess.csproj
index 994a26d7fa..fe8fa9fa40 100644
--- a/src/framework/Framework.DBAccess/Framework.DBAccess.csproj
+++ b/src/framework/Framework.DBAccess/Framework.DBAccess.csproj
@@ -20,6 +20,7 @@
Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess
+ Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess
net6.0
enable
enable
diff --git a/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs b/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs
new file mode 100644
index 0000000000..1e524aad0e
--- /dev/null
+++ b/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentityServiceCollectionExtensions.cs
@@ -0,0 +1,37 @@
+/********************************************************************************
+ * Copyright (c) 2021, 2023 BMW Group AG
+ * Copyright (c) 2021, 2023 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 Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
+
+namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection;
+
+public static class ProcessIdentityServiceCollectionExtensions
+{
+ public static IServiceCollection AddProcessIdentity(this IServiceCollection services, IConfigurationSection section)
+ {
+ services.AddOptions()
+ .Bind(section)
+ .ValidateOnStart();
+
+ return services.AddTransient();
+ }
+}
diff --git a/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentitySettings.cs b/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentitySettings.cs
new file mode 100644
index 0000000000..44c3701e29
--- /dev/null
+++ b/src/framework/Framework.ProcessIdentity/DependencyInjection/ProcessIdentitySettings.cs
@@ -0,0 +1,39 @@
+/********************************************************************************
+ * Copyright (c) 2021, 2023 BMW Group AG
+ * Copyright (c) 2021, 2023 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 Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
+using System.ComponentModel.DataAnnotations;
+
+namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection;
+
+public class ProcessIdentitySettings
+{
+ [Required(AllowEmptyStrings = false)]
+ public string UserEntityId { get; set; } = null!;
+
+ [Required]
+ public Guid ProcessUserId { get; set; } = Guid.Empty;
+
+ [Required]
+ public IdentityTypeId IdentityTypeId { get; set; } = default;
+
+ [Required]
+ public Guid ProcessUserCompanyId { get; set; } = Guid.Empty;
+}
diff --git a/src/framework/Framework.ProcessIdentity/Framework.ProcessIdentity.csproj b/src/framework/Framework.ProcessIdentity/Framework.ProcessIdentity.csproj
new file mode 100644
index 0000000000..783236fbbc
--- /dev/null
+++ b/src/framework/Framework.ProcessIdentity/Framework.ProcessIdentity.csproj
@@ -0,0 +1,35 @@
+
+
+
+ net6.0
+ enable
+ enable
+ Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity
+ Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity
+
+
+
+
+
+
+
+
+
diff --git a/src/framework/Framework.ProcessIdentity/ProcessIdentityService.cs b/src/framework/Framework.ProcessIdentity/ProcessIdentityService.cs
new file mode 100644
index 0000000000..c88571f949
--- /dev/null
+++ b/src/framework/Framework.ProcessIdentity/ProcessIdentityService.cs
@@ -0,0 +1,37 @@
+/********************************************************************************
+ * Copyright (c) 2021, 2023 BMW Group AG
+ * Copyright (c) 2021, 2023 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 Microsoft.Extensions.Options;
+using Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
+
+namespace Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity;
+
+public class ProcessIdentityService : IIdentityService
+{
+ private readonly ProcessIdentitySettings _settings;
+
+ public ProcessIdentityService(IOptions options) =>
+ _settings = options.Value;
+
+ ///
+ public IdentityData IdentityData =>
+ new(_settings.UserEntityId, _settings.ProcessUserId, _settings.IdentityTypeId, _settings.ProcessUserCompanyId);
+}
diff --git a/src/framework/Framework.Web/Framework.Web.csproj b/src/framework/Framework.Web/Framework.Web.csproj
index 74511500d8..d1b6ffea9b 100644
--- a/src/framework/Framework.Web/Framework.Web.csproj
+++ b/src/framework/Framework.Web/Framework.Web.csproj
@@ -20,6 +20,7 @@
Org.Eclipse.TractusX.Portal.Backend.Framework.Web
+ Org.Eclipse.TractusX.Portal.Backend.Framework.Web
net6.0
enable
enable
diff --git a/src/framework/Framework.Web/IdentityService.cs b/src/framework/Framework.Web/IdentityService.cs
new file mode 100644
index 0000000000..821a15f567
--- /dev/null
+++ b/src/framework/Framework.Web/IdentityService.cs
@@ -0,0 +1,41 @@
+/********************************************************************************
+ * Copyright (c) 2021, 2023 BMW Group AG
+ * Copyright (c) 2021, 2023 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 Microsoft.AspNetCore.Http;
+using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
+using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
+
+namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
+
+public class IdentityService : IIdentityService
+{
+ private readonly IHttpContextAccessor _httpContextAccessor;
+
+ public IdentityService(IHttpContextAccessor httpContextAccessor)
+ {
+ _httpContextAccessor = httpContextAccessor;
+ }
+
+ ///
+ public IdentityData IdentityData =>
+ _httpContextAccessor.HttpContext?.User.GetIdentityData() ??
+ throw new ConflictException("The identity should be set here");
+}
diff --git a/src/framework/Framework.Web/StartupServiceExtensions.cs b/src/framework/Framework.Web/StartupServiceExtensions.cs
index d8b5c7a05f..3a72ac80d8 100644
--- a/src/framework/Framework.Web/StartupServiceExtensions.cs
+++ b/src/framework/Framework.Web/StartupServiceExtensions.cs
@@ -30,6 +30,7 @@
using Org.Eclipse.TractusX.Portal.Backend.Framework.Swagger;
using Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
using System.IdentityModel.Tokens.Jwt;
using System.Text.Json.Serialization;
@@ -91,8 +92,8 @@ public static IServiceCollection AddDefaultServices(this IServiceColle
services.AddHealthChecks()
.AddCheck("JwtBearerConfiguration", tags: new[] { "keycloak" });
- // This is needed for Serilog to access the request id
services.AddHttpContextAccessor();
+ services.AddScoped();
services.AddDateTimeProvider();
return services;
diff --git a/src/framework/Framework.Web/StartupServiceWebApplicationExtensions.cs b/src/framework/Framework.Web/StartupServiceWebApplicationExtensions.cs
index 46c618ef70..bc12ce44b3 100644
--- a/src/framework/Framework.Web/StartupServiceWebApplicationExtensions.cs
+++ b/src/framework/Framework.Web/StartupServiceWebApplicationExtensions.cs
@@ -33,7 +33,6 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Framework.Web;
public static class StartupServiceWebApplicationExtensions
{
-
public static WebApplication CreateApp(this WebApplication app, string apiPath, string version, IHostEnvironment environment)
{
app.UseSerilogRequestLogging();
diff --git a/src/keycloak/Keycloak.Authentication/ControllerExtensions.cs b/src/keycloak/Keycloak.Authentication/ControllerExtensions.cs
index e0aab70dbc..34294cf968 100644
--- a/src/keycloak/Keycloak.Authentication/ControllerExtensions.cs
+++ b/src/keycloak/Keycloak.Authentication/ControllerExtensions.cs
@@ -21,8 +21,8 @@
using Microsoft.AspNetCore.Mvc;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
-using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
using System.Security.Claims;
namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication;
@@ -33,7 +33,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Keycloak.Authentication;
public static class ControllerExtensions
{
public static T WithIdentityData(this ControllerBase controller, Func consumingFunction) =>
- consumingFunction(controller.GetIdentityData());
+ consumingFunction(controller.User.GetIdentityData());
public static T WithUserId(this ControllerBase controller, Func consumingFunction) =>
consumingFunction(controller.User.Claims.GetGuidFromClaim(PortalClaimTypes.IdentityId));
@@ -50,12 +50,12 @@ public static T WithBearerToken(this ControllerBase controller, Func(this ControllerBase controller, Func<(Guid UserId, string BearerToken), T> tokenConsumingFunction) =>
tokenConsumingFunction((controller.User.Claims.GetGuidFromClaim(PortalClaimTypes.IdentityId), controller.GetBearerToken()));
- private static IdentityData GetIdentityData(this ControllerBase controller)
+ public static IdentityData GetIdentityData(this ClaimsPrincipal user)
{
- var sub = controller.User.Claims.GetStringFromClaim(PortalClaimTypes.Sub);
- var identityId = controller.User.Claims.GetGuidFromClaim(PortalClaimTypes.IdentityId);
- var identityType = controller.User.Claims.GetEnumFromClaim(PortalClaimTypes.IdentityType);
- var companyId = controller.User.Claims.GetGuidFromClaim(PortalClaimTypes.CompanyId);
+ var sub = user.Claims.GetStringFromClaim(PortalClaimTypes.Sub);
+ var identityId = user.Claims.GetGuidFromClaim(PortalClaimTypes.IdentityId);
+ var identityType = user.Claims.GetEnumFromClaim(PortalClaimTypes.IdentityType);
+ var companyId = user.Claims.GetGuidFromClaim(PortalClaimTypes.CompanyId);
return new IdentityData(sub, identityId, identityType, companyId);
}
diff --git a/src/maintenance/Maintenance.App/Maintenance.App.csproj b/src/maintenance/Maintenance.App/Maintenance.App.csproj
index ca576c6fa9..997beda599 100644
--- a/src/maintenance/Maintenance.App/Maintenance.App.csproj
+++ b/src/maintenance/Maintenance.App/Maintenance.App.csproj
@@ -47,6 +47,7 @@
+
diff --git a/src/maintenance/Maintenance.App/Program.cs b/src/maintenance/Maintenance.App/Program.cs
index 5d1797482b..ab98591959 100644
--- a/src/maintenance/Maintenance.App/Program.cs
+++ b/src/maintenance/Maintenance.App/Program.cs
@@ -21,6 +21,7 @@
using Microsoft.EntityFrameworkCore;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging;
+using Org.Eclipse.TractusX.Portal.Backend.Framework.ProcessIdentity.DependencyInjection;
using Org.Eclipse.TractusX.Portal.Backend.Maintenance.App;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities;
using Serilog;
@@ -33,8 +34,10 @@
.UseSystemd()
.ConfigureServices((hostContext, services) =>
{
- services.AddDbContext(o =>
- o.UseNpgsql(hostContext.Configuration.GetConnectionString("PortalDb")));
+ services
+ .AddProcessIdentity(hostContext.Configuration.GetSection("ProcessIdentity"))
+ .AddDbContext(o =>
+ o.UseNpgsql(hostContext.Configuration.GetConnectionString("PortalDb")));
services.AddHostedService();
})
.AddLogging()
diff --git a/src/maintenance/Maintenance.App/appsettings.json b/src/maintenance/Maintenance.App/appsettings.json
index bcdea2d039..6c9bd4d060 100644
--- a/src/maintenance/Maintenance.App/appsettings.json
+++ b/src/maintenance/Maintenance.App/appsettings.json
@@ -24,5 +24,11 @@
"ConnectionStrings": {
"PortalDb": "Server=placeholder;Database=placeholder;Port=5432;User Id=placeholder;Password=placeholder;Ssl Mode=Disable;"
},
- "DeleteIntervalInDays": 80
+ "DeleteIntervalInDays": 80,
+ "ProcessIdentity": {
+ "UserEntityId": "",
+ "ProcessUserId": "",
+ "IdentityTypeId": 0,
+ "ProcessUserCompanyId": ""
+ }
}
diff --git a/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs
index 19066207ac..a646c3a9db 100644
--- a/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs
+++ b/src/marketplace/Apps.Service/BusinessLogic/AppReleaseBusinessLogic.cs
@@ -158,18 +158,15 @@ public async Task GetOfferAgreementConsentById(Guid appId
}
///
- public Task> SubmitOfferConsentAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, Guid companyId)
+ public Task> SubmitOfferConsentAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, (Guid UserId, Guid CompanyId) identity)
{
if (appId == Guid.Empty)
{
throw new ControllerArgumentException($"AppId must not be empty");
}
- return SubmitOfferConsentInternalAsync(appId, offerAgreementConsents, companyId);
+ return _offerService.CreateOrUpdateProviderOfferAgreementConsent(appId, offerAgreementConsents, identity, OfferTypeId.APP);
}
- private Task> SubmitOfferConsentInternalAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, Guid companyId) =>
- _offerService.CreateOrUpdateProviderOfferAgreementConsent(appId, offerAgreementConsents, companyId, OfferTypeId.APP);
-
///
public async Task GetAppDetailsForStatusAsync(Guid appId, Guid companyId)
{
diff --git a/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs
index 5457d95358..176f8f6287 100644
--- a/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs
+++ b/src/marketplace/Apps.Service/BusinessLogic/AppsBusinessLogic.cs
@@ -85,9 +85,9 @@ public IAsyncEnumerable GetAllActiveAppsAsync(string? languageShortName
app.UseCaseNames));
///
- public IAsyncEnumerable GetAllUserUserBusinessAppsAsync(Guid companyId) =>
+ public IAsyncEnumerable GetAllUserUserBusinessAppsAsync(Guid userId) =>
_portalRepositories.GetInstance()
- .GetAllBusinessAppDataForUserIdAsync(companyId)
+ .GetAllBusinessAppDataForUserIdAsync(userId)
.Select(x =>
new BusinessAppData(
x.OfferId,
@@ -206,7 +206,10 @@ public async Task ActivateOwnCompanyProvidedAppSubscriptionAsync(Guid subscripti
throw new ConflictException("App Name is not yet set.");
}
- offerSubscriptionRepository.AttachAndModifyOfferSubscription(subscriptionId, subscription => subscription.OfferSubscriptionStatusId = OfferSubscriptionStatusId.ACTIVE);
+ offerSubscriptionRepository.AttachAndModifyOfferSubscription(subscriptionId, subscription =>
+ {
+ subscription.OfferSubscriptionStatusId = OfferSubscriptionStatusId.ACTIVE;
+ });
_portalRepositories.GetInstance().CreateNotification(requesterId,
NotificationTypeId.APP_SUBSCRIPTION_ACTIVATION, false,
diff --git a/src/marketplace/Apps.Service/BusinessLogic/IAppChangeBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/IAppChangeBusinessLogic.cs
index c4eda4e06d..9a3cf710db 100644
--- a/src/marketplace/Apps.Service/BusinessLogic/IAppChangeBusinessLogic.cs
+++ b/src/marketplace/Apps.Service/BusinessLogic/IAppChangeBusinessLogic.cs
@@ -65,7 +65,7 @@ public interface IAppChangeBusinessLogic
/// Deactivate Offer Status by appId
///
/// Id of the app
- /// Id of the Users company
+ /// CompanyId
public Task DeactivateOfferByAppIdAsync(Guid appId, Guid companyId);
///
diff --git a/src/marketplace/Apps.Service/BusinessLogic/IAppReleaseBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/IAppReleaseBusinessLogic.cs
index 1864efd453..a5a29eb53c 100644
--- a/src/marketplace/Apps.Service/BusinessLogic/IAppReleaseBusinessLogic.cs
+++ b/src/marketplace/Apps.Service/BusinessLogic/IAppReleaseBusinessLogic.cs
@@ -80,9 +80,9 @@ public interface IAppReleaseBusinessLogic
///
///
///
- ///
+ ///
///
- Task> SubmitOfferConsentAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, Guid companyId);
+ Task> SubmitOfferConsentAsync(Guid appId, OfferAgreementConsent offerAgreementConsents, (Guid UserId, Guid CompanyId) identity);
///
/// Return Offer with Consent Status
diff --git a/src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs b/src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs
index bf69e52ef0..eddfea0c13 100644
--- a/src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs
+++ b/src/marketplace/Apps.Service/BusinessLogic/IAppsBusinessLogic.cs
@@ -41,9 +41,9 @@ public interface IAppsBusinessLogic
///
/// Get all apps that a user has been assigned roles in.
///
- /// Id of the user to get available apps for.
+ /// Id of the user to get available apps for.
/// List of available apps for user.
- public IAsyncEnumerable GetAllUserUserBusinessAppsAsync(Guid companyId);
+ public IAsyncEnumerable GetAllUserUserBusinessAppsAsync(Guid userId);
///
/// Get detailed application data for a single app by id.
diff --git a/src/marketplace/Apps.Service/Controllers/AppChangeController.cs b/src/marketplace/Apps.Service/Controllers/AppChangeController.cs
index 737426d3f3..cc72f0d7b6 100644
--- a/src/marketplace/Apps.Service/Controllers/AppChangeController.cs
+++ b/src/marketplace/Apps.Service/Controllers/AppChangeController.cs
@@ -176,6 +176,7 @@ public async Task DeactivateApp([FromRoute] Guid appId)
[Route("{appId}/subscription/{subscriptionId}/tenantUrl")]
[Authorize(Roles = "edit_apps")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
+ [Authorize(Policy = PolicyTypes.ValidIdentity)]
[ProducesResponseType(typeof(NoContentResult), StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
diff --git a/src/marketplace/Apps.Service/Controllers/AppReleaseProcessController.cs b/src/marketplace/Apps.Service/Controllers/AppReleaseProcessController.cs
index e17b5140de..a899763281 100644
--- a/src/marketplace/Apps.Service/Controllers/AppReleaseProcessController.cs
+++ b/src/marketplace/Apps.Service/Controllers/AppReleaseProcessController.cs
@@ -174,14 +174,14 @@ public Task GetOfferAgreementConsentById([FromRoute] Guid
/// App Id is incorrect.
[HttpPost]
[Authorize(Roles = "edit_apps")]
- [Authorize(Policy = PolicyTypes.ValidCompany)]
+ [Authorize(Policy = PolicyTypes.CompanyUser)]
[Route("consent/{appId}/agreementConsents")]
[ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status403Forbidden)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
public Task> SubmitOfferConsentToAgreementsAsync([FromRoute] Guid appId, [FromBody] OfferAgreementConsent offerAgreementConsents) =>
- this.WithCompanyId(companyId => _appReleaseBusinessLogic.SubmitOfferConsentAsync(appId, offerAgreementConsents, companyId));
+ this.WithUserIdAndCompanyId(identity => _appReleaseBusinessLogic.SubmitOfferConsentAsync(appId, offerAgreementConsents, identity));
///
/// Return app detail with status
diff --git a/src/marketplace/Apps.Service/Controllers/AppsController.cs b/src/marketplace/Apps.Service/Controllers/AppsController.cs
index 4588c1e182..8cf4f58acf 100644
--- a/src/marketplace/Apps.Service/Controllers/AppsController.cs
+++ b/src/marketplace/Apps.Service/Controllers/AppsController.cs
@@ -74,11 +74,11 @@ public IAsyncEnumerable GetAllActiveAppsAsync([FromQuery] string? lang
[HttpGet]
[Route("business")]
[Authorize(Roles = "view_apps")]
- [Authorize(Policy = PolicyTypes.ValidCompany)]
+ [Authorize(Policy = PolicyTypes.CompanyUser)]
[ProducesResponseType(typeof(IAsyncEnumerable), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
public IAsyncEnumerable GetAllBusinessAppsForCurrentUserAsync() =>
- this.WithCompanyId(companyId => _appsBusinessLogic.GetAllUserUserBusinessAppsAsync(companyId));
+ this.WithUserId(userId => _appsBusinessLogic.GetAllUserUserBusinessAppsAsync(userId));
///
/// Retrieves app details for an app referenced by id.
diff --git a/src/marketplace/Apps.Service/appsettings.json b/src/marketplace/Apps.Service/appsettings.json
index 658dd9f25f..a13c14064b 100644
--- a/src/marketplace/Apps.Service/appsettings.json
+++ b/src/marketplace/Apps.Service/appsettings.json
@@ -1,14 +1,11 @@
{
"SwaggerEnabled": true,
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- },
"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
- "MinimumLevel": "Information",
+ "MinimumLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ },
"WriteTo": [
{ "Name": "Console" }
],
@@ -96,7 +93,7 @@
"Setting": {
"Subject": "Decline of app {offerName}",
"EmailTemplateType": "AppRequestDecline"
- }
+ }
}
],
"Mail": {
diff --git a/src/marketplace/Offers.Library/Service/IOfferService.cs b/src/marketplace/Offers.Library/Service/IOfferService.cs
index 0bba7d3c83..42ecf0f045 100644
--- a/src/marketplace/Offers.Library/Service/IOfferService.cs
+++ b/src/marketplace/Offers.Library/Service/IOfferService.cs
@@ -23,6 +23,7 @@
using Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Identities;
namespace Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Service;
@@ -91,10 +92,10 @@ Task CreateOrUpdateOfferSubscriptionAgreementConsentAsync(Guid subscriptionId,
///
///
///
- ///
+ ///
/// OfferTypeId the agreements are associated with
///
- Task> CreateOrUpdateProviderOfferAgreementConsent(Guid offerId, OfferAgreementConsent offerAgreementConsent, Guid companyId, OfferTypeId offerTypeId);
+ Task> CreateOrUpdateProviderOfferAgreementConsent(Guid offerId, OfferAgreementConsent offerAgreementConsent, (Guid UserId, Guid CompanyId) identity, OfferTypeId offerTypeId);
///
/// Creates a new service offering
@@ -170,7 +171,7 @@ Task CreateOrUpdateOfferSubscriptionAgreementConsentAsync(Guid subscriptionId,
/// Deactivate the given offerStatus by offerId and offerType
///
/// Id of the offer that should be Deactivate
- /// Id of the users company
+ /// CompanyId of the user
/// Type of the offer
Task DeactivateOfferIdAsync(Guid offerId, Guid companyId, OfferTypeId offerTypeId);
diff --git a/src/marketplace/Offers.Library/Service/OfferService.cs b/src/marketplace/Offers.Library/Service/OfferService.cs
index 28835f48f5..dc1eb7f774 100644
--- a/src/marketplace/Offers.Library/Service/OfferService.cs
+++ b/src/marketplace/Offers.Library/Service/OfferService.cs
@@ -31,6 +31,7 @@
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 System.Text.Json;
namespace Org.Eclipse.TractusX.Portal.Backend.Offers.Library.Service;
@@ -163,9 +164,9 @@ public async Task GetProviderOfferAgreementConsentById(Gu
return result.OfferAgreementConsent;
}
- public async Task> CreateOrUpdateProviderOfferAgreementConsent(Guid offerId, OfferAgreementConsent offerAgreementConsent, Guid companyId, OfferTypeId offerTypeId)
+ public async Task> CreateOrUpdateProviderOfferAgreementConsent(Guid offerId, OfferAgreementConsent offerAgreementConsent, (Guid UserId, Guid CompanyId) identity, OfferTypeId offerTypeId)
{
- var (companyUserId, dbAgreements, requiredAgreementIds) = await GetProviderOfferAgreementConsent(offerId, companyId, OfferStatusId.CREATED, offerTypeId).ConfigureAwait(false);
+ var (dbAgreements, requiredAgreementIds) = await GetProviderOfferAgreementConsent(offerId, identity.CompanyId, OfferStatusId.CREATED, offerTypeId).ConfigureAwait(false);
var invalidConsents = offerAgreementConsent.Agreements.ExceptBy(requiredAgreementIds, consent => consent.AgreementId);
if (invalidConsents.Any())
{
@@ -177,8 +178,8 @@ public async Task> CreateOrUpdateProviderOfferAgr
dbAgreements,
offerAgreementConsent.Agreements,
offerId,
- companyId,
- companyUserId,
+ identity.CompanyId,
+ identity.UserId,
DateTimeOffset.UtcNow)
.Select(consent => new ConsentStatusData(consent.AgreementId, consent.ConsentStatusId));
diff --git a/src/marketplace/Offers.Library/Service/OfferSetupService.cs b/src/marketplace/Offers.Library/Service/OfferSetupService.cs
index 2dbfbe27b0..092aea2c19 100644
--- a/src/marketplace/Offers.Library/Service/OfferSetupService.cs
+++ b/src/marketplace/Offers.Library/Service/OfferSetupService.cs
@@ -83,7 +83,6 @@ public async Task AutoSetupOfferAsync(OfferAutoSetup
offerSubscriptionsRepository.AttachAndModifyOfferSubscription(data.RequestId, subscription =>
{
subscription.OfferSubscriptionStatusId = OfferSubscriptionStatusId.ACTIVE;
- subscription.LastEditorId = identity.UserId;
});
if (offerDetails.InstanceData.IsSingleInstance)
diff --git a/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs b/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs
index 5d462db2cc..7ecf9e37c3 100644
--- a/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs
+++ b/src/marketplace/Offers.Library/Service/OfferSubscriptionService.cs
@@ -58,7 +58,7 @@ public async Task AddOfferSubscriptionAsync(Guid offerId, IEnumerable();
var offerSubscription = offerTypeId == OfferTypeId.APP
? await HandleAppSubscriptionAsync(offerId, offerSubscriptionsRepository, companyInformation, identity.UserId).ConfigureAwait(false)
- : offerSubscriptionsRepository.CreateOfferSubscription(offerId, companyInformation.CompanyId, OfferSubscriptionStatusId.PENDING, identity.UserId, identity.UserId);
+ : offerSubscriptionsRepository.CreateOfferSubscription(offerId, companyInformation.CompanyId, OfferSubscriptionStatusId.PENDING, identity.UserId);
CreateProcessSteps(offerSubscription);
CreateConsentsForSubscription(offerSubscription.Id, offerAgreementConsentData, companyInformation.CompanyId, identity.UserId);
@@ -137,7 +137,7 @@ private static async Task HandleAppSubscriptionAsync(
Guid offerId,
IOfferSubscriptionsRepository offerSubscriptionsRepository,
CompanyInformationData companyInformation,
- Guid companyUserId)
+ Guid userId)
{
var activeOrPendingSubscriptionExists = await offerSubscriptionsRepository
.CheckPendingOrActiveSubscriptionExists(offerId, companyInformation.CompanyId, OfferTypeId.APP)
@@ -147,7 +147,7 @@ private static async Task HandleAppSubscriptionAsync(
throw new ConflictException($"company {companyInformation.CompanyId} is already subscribed to {offerId}");
}
- return offerSubscriptionsRepository.CreateOfferSubscription(offerId, companyInformation.CompanyId, OfferSubscriptionStatusId.PENDING, companyUserId, companyUserId);
+ return offerSubscriptionsRepository.CreateOfferSubscription(offerId, companyInformation.CompanyId, OfferSubscriptionStatusId.PENDING, userId);
}
private void CreateConsentsForSubscription(Guid offerSubscriptionId, IEnumerable offerAgreementConsentData, Guid companyId, Guid companyUserId)
diff --git a/src/marketplace/Services.Service/BusinessLogic/IServiceChangeBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/IServiceChangeBusinessLogic.cs
index 28bdc13225..1e40f046b4 100644
--- a/src/marketplace/Services.Service/BusinessLogic/IServiceChangeBusinessLogic.cs
+++ b/src/marketplace/Services.Service/BusinessLogic/IServiceChangeBusinessLogic.cs
@@ -29,6 +29,6 @@ public interface IServiceChangeBusinessLogic
/// Deactivate Offer Status by serviceId
///
/// Id of the service
- /// Id of the users company
+ /// CompanyId of the user
public Task DeactivateOfferByServiceIdAsync(Guid serviceId, Guid companyId);
}
diff --git a/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs
index 0d26d94033..3eb26ba49d 100644
--- a/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs
+++ b/src/marketplace/Services.Service/BusinessLogic/IServiceReleaseBusinessLogic.cs
@@ -71,8 +71,8 @@ public interface IServiceReleaseBusinessLogic
///
/// Id of the service
/// Data of the consents for the agreements
- /// Id of the users company
- Task> SubmitOfferConsentAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, Guid companyId);
+ /// Id of the users company
+ Task> SubmitOfferConsentAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, (Guid UserId, Guid CompanyId) identity);
///
/// Retrieves all in review status offer in the marketplace.
@@ -98,7 +98,7 @@ public interface IServiceReleaseBusinessLogic
///
/// Id of the service to update
/// Data of the updated entry
- /// Id of the current users company
+ /// CompanyId of User
Task UpdateServiceAsync(Guid serviceId, ServiceUpdateRequestData data, Guid companyId);
///
diff --git a/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs b/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs
index 091ff0a0a7..6f545228f3 100644
--- a/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs
+++ b/src/marketplace/Services.Service/BusinessLogic/ServiceReleaseBusinessLogic.cs
@@ -123,19 +123,16 @@ public async Task GetServiceDetailsForStatusAsync(Guid
}
///
- public Task> SubmitOfferConsentAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, Guid companyId)
+ public Task> SubmitOfferConsentAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, (Guid UserId, Guid CompanyId) identity)
{
if (serviceId == Guid.Empty)
{
throw new ControllerArgumentException("ServiceId must not be empty");
}
- return SubmitOfferConsentInternalAsync(serviceId, offerAgreementConsents, companyId);
+ return _offerService.CreateOrUpdateProviderOfferAgreementConsent(serviceId, offerAgreementConsents, identity, OfferTypeId.SERVICE);
}
- private Task> SubmitOfferConsentInternalAsync(Guid serviceId, OfferAgreementConsent offerAgreementConsents, Guid companyId) =>
- _offerService.CreateOrUpdateProviderOfferAgreementConsent(serviceId, offerAgreementConsents, companyId, OfferTypeId.SERVICE);
-
///
public Task> GetAllInReviewStatusServiceAsync(int page, int size, OfferSorting? sorting, string? serviceName, string? languageShortName, ServiceReleaseStatusIdFilter? statusId) =>
Pagination.CreateResponseAsync(page, size, 15,
diff --git a/src/marketplace/Services.Service/Controllers/ServiceReleaseController.cs b/src/marketplace/Services.Service/Controllers/ServiceReleaseController.cs
index 917871e679..5714ee1217 100644
--- a/src/marketplace/Services.Service/Controllers/ServiceReleaseController.cs
+++ b/src/marketplace/Services.Service/Controllers/ServiceReleaseController.cs
@@ -143,13 +143,13 @@ public Task GetServiceDetailsForStatusAsync([FromRoute]
[HttpPost]
[Route("consent/{serviceId}/agreementConsents")]
[Authorize(Roles = "add_service_offering")]
- [Authorize(Policy = PolicyTypes.ValidCompany)]
+ [Authorize(Policy = PolicyTypes.CompanyUser)]
[ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status403Forbidden)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status400BadRequest)]
public async Task> SubmitOfferConsentToAgreementsAsync([FromRoute] Guid serviceId, [FromBody] OfferAgreementConsent offerAgreementConsents) =>
- await this.WithCompanyId(companyId => _serviceReleaseBusinessLogic.SubmitOfferConsentAsync(serviceId, offerAgreementConsents, companyId));
+ await this.WithUserIdAndCompanyId(identity => _serviceReleaseBusinessLogic.SubmitOfferConsentAsync(serviceId, offerAgreementConsents, identity));
///
/// Retrieves all in review status service in the marketplace .
diff --git a/src/marketplace/Services.Service/appsettings.json b/src/marketplace/Services.Service/appsettings.json
index 6ca1e86fd7..9f1a71985c 100644
--- a/src/marketplace/Services.Service/appsettings.json
+++ b/src/marketplace/Services.Service/appsettings.json
@@ -1,14 +1,11 @@
{
"SwaggerEnabled": true,
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- },
"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
- "MinimumLevel": "Information",
+ "MinimumLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ },
"WriteTo": [
{ "Name": "Console" }
],
@@ -109,15 +106,15 @@
"name": "BPN",
"_ProtocolMapper": "oidc-usermodel-attribute-mapper",
"config": {
- "userAttribute": "bpn",
- "claimName": "bpn",
- "jsonTypelabel": "String",
- "idTokenClaim": "true",
- "accessTokenClaim": "true",
- "userInfoTokenClaim": "true",
- "attributeName": "true",
- "multivalued": ""
- }
+ "userAttribute": "bpn",
+ "claimName": "bpn",
+ "jsonTypelabel": "String",
+ "idTokenClaim": "true",
+ "accessTokenClaim": "true",
+ "userInfoTokenClaim": "true",
+ "attributeName": "true",
+ "multivalued": ""
+ }
},
"CentralOIDCClient": {
"surrogateAuthRequired": false,
diff --git a/src/notifications/Notifications.Service/appsettings.json b/src/notifications/Notifications.Service/appsettings.json
index 75bdbfb322..b3bbdb0384 100644
--- a/src/notifications/Notifications.Service/appsettings.json
+++ b/src/notifications/Notifications.Service/appsettings.json
@@ -1,14 +1,11 @@
{
- "Logging": {
- "LogLevel": {
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.Console" ],
+ "MinimumLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "Serilog": {
- "Using": [ "Serilog.Sinks.Console" ],
- "MinimumLevel": "Information",
+ },
"WriteTo": [
{ "Name": "Console" }
],
diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/OfferAgreementConsent.cs b/src/portalbackend/PortalBackend.DBAccess/Models/OfferAgreementConsent.cs
index 902a47788e..7c244cb71b 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Models/OfferAgreementConsent.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Models/OfferAgreementConsent.cs
@@ -26,4 +26,4 @@ public record OfferAgreementConsent(IEnumerable Agreemen
public record AppAgreementConsentStatus(Guid AgreementId, Guid ConsentId, ConsentStatusId ConsentStatusId);
-public record OfferAgreementConsentUpdate(Guid CompanyUserId, IEnumerable ExistingAgreements, IEnumerable RequiredAgreementIds);
+public record OfferAgreementConsentUpdate(IEnumerable ExistingAgreements, IEnumerable RequiredAgreementIds);
diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs
index 8ce7fca43a..fa05500faf 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionDetailData.cs
@@ -69,7 +69,7 @@ public record AppProviderSubscriptionDetailData(
IEnumerable Contact,
IEnumerable TechnicalUserData,
string? TenantUrl,
- Guid? AppInstanceId
+ string AppInstanceId
);
///
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/AgreementRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/AgreementRepository.cs
index 15deee5e15..3ece9ba54c 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/AgreementRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/AgreementRepository.cs
@@ -101,7 +101,6 @@ public IAsyncEnumerable GetAgreementDataForOfferType(Offe
offer.OfferTypeId == offerTypeId)
.Select(offer => new ValueTuple(
new OfferAgreementConsentUpdate(
- offer.ProviderCompany!.Identities.Select(companyUser => companyUser.Id).SingleOrDefault(),
offer.ConsentAssignedOffers.Select(consentAssignedOffer => new AppAgreementConsentStatus(
consentAssignedOffer.Consent!.AgreementId,
consentAssignedOffer.Consent.Id,
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanySsiDetailsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanySsiDetailsRepository.cs
index 5bc20b8004..9e19c28645 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanySsiDetailsRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/CompanySsiDetailsRepository.cs
@@ -130,6 +130,7 @@ public Task CheckSsiDetailsExistsForCompany(Guid companyId, VerifiedCreden
x.CompanyId == companyId &&
x.VerifiedCredentialTypeId == verifiedCredentialTypeId &&
x.VerifiedCredentialType!.VerifiedCredentialTypeAssignedKind!.VerifiedCredentialTypeKindId == kindId &&
+ x.CompanySsiDetailStatusId != CompanySsiDetailStatusId.INACTIVE &&
(verifiedCredentialExternalTypeUseCaseDetailId == null || x.VerifiedCredentialExternalTypeUseCaseDetailId == verifiedCredentialExternalTypeUseCaseDetailId));
///
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs
index 50105fbdda..141eaf798b 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConnectorsRepository.cs
@@ -137,11 +137,12 @@ public Connector AttachAndModifyConnector(Guid connectorId, Action? i
.SingleOrDefaultAsync();
///
- public Task<(bool IsValidConnectorId, string? DapsClientId, Guid? SelfDescriptionDocumentId, DocumentStatusId? DocumentStatusId, ConnectorStatusId ConnectorStatus, bool? DapsRegistrationSuccessful)> GetConnectorDeleteDataAsync(Guid connectorId) =>
+ public Task<(bool IsValidConnectorId, bool IsProvidingOrHostCompany, string? DapsClientId, Guid? SelfDescriptionDocumentId, DocumentStatusId? DocumentStatusId, ConnectorStatusId ConnectorStatus, bool? DapsRegistrationSuccessful)> GetConnectorDeleteDataAsync(Guid connectorId, Guid companyId) =>
_context.Connectors
.Where(x => x.Id == connectorId)
- .Select(connector => new ValueTuple(
+ .Select(connector => new ValueTuple(
true,
+ connector.ProviderId == companyId || connector.HostId == companyId,
connector.ClientDetails == null ? null : connector.ClientDetails!.ClientId,
connector.SelfDescriptionDocumentId,
connector.SelfDescriptionDocument!.DocumentStatusId,
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConsentRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConsentRepository.cs
index 814b93b5de..af9277d240 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ConsentRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ConsentRepository.cs
@@ -99,7 +99,6 @@ public IEnumerable AddAttachAndModifyOfferConsents(IEnumerable
{
consent.ConsentStatusId = modify.ConsentStatusId;
- consent.LastEditorId = companyUserId;
});
public IEnumerable AddAttachAndModifyConsents(IEnumerable initialItems, IEnumerable<(Guid AgreementId, ConsentStatusId ConsentStatusId)> modifyItems, Guid companyId, Guid companyUserId, DateTimeOffset utcNow) =>
@@ -114,6 +113,5 @@ public IEnumerable AddAttachAndModifyConsents(IEnumerable
{
consent.ConsentStatusId = modify.ConsentStatusId;
- consent.LastEditorId = companyUserId;
});
}
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs
index 9d9f46e64f..43c38e20b1 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IConnectorsRepository.cs
@@ -85,8 +85,9 @@ public interface IConnectorsRepository
/// Gets SelfDescriptionDocument Data
///
/// Id of the connector
+ /// Id of the company
/// returns SelfDescriptionDocument Data/c>
- Task<(bool IsValidConnectorId, string? DapsClientId, Guid? SelfDescriptionDocumentId, DocumentStatusId? DocumentStatusId, ConnectorStatusId ConnectorStatus, bool? DapsRegistrationSuccessful)> GetConnectorDeleteDataAsync(Guid connectorId);
+ Task<(bool IsValidConnectorId, bool IsProvidingOrHostCompany, string? DapsClientId, Guid? SelfDescriptionDocumentId, DocumentStatusId? DocumentStatusId, ConnectorStatusId ConnectorStatus, bool? DapsRegistrationSuccessful)> GetConnectorDeleteDataAsync(Guid connectorId, Guid companyId);
///
/// Creates the connector details
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs
index 05ef228a42..acfb09a867 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IOfferSubscriptionsRepository.cs
@@ -38,7 +38,7 @@ public interface IOfferSubscriptionsRepository
/// id of the app subscription status
/// id of the user that requested the subscription of the app
/// id of the creator
- OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId, Guid creatorId);
+ OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId);
///
/// Gets the provided offer subscription statuses for the user and given company
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs
index cb6907debb..855a3152b7 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IUserRepository.cs
@@ -22,6 +22,7 @@
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
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;
namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories;
@@ -31,7 +32,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositorie
public interface IUserRepository
{
IAsyncEnumerable GetApplicationsWithStatusUntrackedAsync(Guid companyId);
- CompanyUser CreateCompanyUser(Guid identityId, string? firstName, string? lastName, string email, Guid lastEditorId);
+ CompanyUser CreateCompanyUser(Guid identityId, string? firstName, string? lastName, string email);
Identity CreateIdentity(Guid companyId, UserStatusId userStatusId);
void AttachAndModifyCompanyUser(Guid companyUserId, Action? initialize, Action setOptionalParameters);
IQueryable GetOwnCompanyUserQuery(Guid companyId, Guid? companyUserId = null, string? userEntityId = null, string? firstName = null, string? lastName = null, string? email = null, IEnumerable? statusIds = null);
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/InvitationRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/InvitationRepository.cs
index 547f5a39be..1a435a024c 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/InvitationRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/InvitationRepository.cs
@@ -22,6 +22,7 @@
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories;
@@ -33,19 +34,17 @@ public InvitationRepository(PortalDbContext dbContext)
{
_dbContext = dbContext;
}
-
public IAsyncEnumerable GetInvitedUserDetailsUntrackedAsync(Guid applicationId) =>
- (from invitation in _dbContext.Invitations
- join invitationStatus in _dbContext.InvitationStatuses on invitation.InvitationStatusId equals invitationStatus.Id
- join companyuser in _dbContext.CompanyUsers on invitation.CompanyUserId equals companyuser.Id
- where invitation.CompanyApplicationId == applicationId
- select new InvitedUserDetail(
- companyuser.Identity!.UserEntityId,
- invitationStatus.Id,
- companyuser.Email
- ))
- .AsNoTracking()
- .AsAsyncEnumerable();
+ _dbContext.Invitations
+ .AsNoTracking()
+ .Where(invitation =>
+ invitation.CompanyApplicationId == applicationId &&
+ invitation.CompanyUser!.Identity!.UserStatusId != UserStatusId.DELETED)
+ .Select(invitation => new InvitedUserDetail(
+ invitation.CompanyUser!.Identity!.UserEntityId,
+ invitation.InvitationStatusId,
+ invitation.CompanyUser.Email))
+ .AsAsyncEnumerable();
public Task GetInvitationStatusAsync(Guid companyUserId) =>
_dbContext.Invitations
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs
index a47e65b0e9..3e111d2e53 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs
@@ -43,8 +43,8 @@ public OfferSubscriptionsRepository(PortalDbContext portalDbContext)
}
///
- public OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId, Guid creatorId) =>
- _context.OfferSubscriptions.Add(new OfferSubscription(Guid.NewGuid(), offerId, companyId, offerSubscriptionStatusId, requesterId, creatorId)).Entity;
+ public OfferSubscription CreateOfferSubscription(Guid offerId, Guid companyId, OfferSubscriptionStatusId offerSubscriptionStatusId, Guid requesterId) =>
+ _context.OfferSubscriptions.Add(new OfferSubscription(Guid.NewGuid(), offerId, companyId, offerSubscriptionStatusId, requesterId)).Entity;
///
public Func?>> GetOwnCompanyProvidedOfferSubscriptionStatusesUntrackedAsync(Guid userCompanyId, OfferTypeId offerTypeId, SubscriptionStatusSorting? sorting, IEnumerable statusIds, Guid? offerId) =>
@@ -169,7 +169,7 @@ public Task CheckPendingOrActiveSubscriptionExists(Guid offerId, Guid comp
///
public OfferSubscription AttachAndModifyOfferSubscription(Guid offerSubscriptionId, Action setOptionalParameters)
{
- var offerSubscription = _context.Attach(new OfferSubscription(offerSubscriptionId, Guid.Empty, Guid.Empty, default, Guid.Empty, Guid.Empty)).Entity;
+ var offerSubscription = _context.Attach(new OfferSubscription(offerSubscriptionId, Guid.Empty, Guid.Empty, default, Guid.Empty)).Entity;
setOptionalParameters.Invoke(offerSubscription);
return offerSubscription;
}
@@ -237,10 +237,10 @@ public OfferSubscription AttachAndModifyOfferSubscription(Guid offerSubscription
x.Subscription.Offer!.Name,
x.Company!.Name,
x.Company.BusinessPartnerNumber,
- x.Company.Identities.Where(x => x.IdentityTypeId == IdentityTypeId.COMPANY_USER).Select(i => i.CompanyUser!).Where(cu => cu.Email != null && cu.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Any(ur => userRoleIds.Contains(ur.Id))).Select(cu => cu.Email!),
+ x.Company.Identities.Where(i => i.IdentityTypeId == IdentityTypeId.COMPANY_USER).Select(id => id.CompanyUser!).Where(cu => cu.Email != null && cu.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Any(ur => userRoleIds.Contains(ur.Id))).Select(cu => cu.Email!),
x.Subscription.CompanyServiceAccounts.Select(sa => new SubscriptionTechnicalUserData(sa.Id, sa.Name, sa.Identity!.IdentityAssignedRoles.Select(ur => ur.UserRole!).Select(ur => ur.UserRoleText))),
x.Subscription.AppSubscriptionDetail!.AppSubscriptionUrl,
- x.Subscription.AppSubscriptionDetail!.AppInstanceId)
+ x.Subscription.AppSubscriptionDetail!.AppInstance!.IamClient!.ClientClientId)
: null))
.SingleOrDefaultAsync();
diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs
index 7abf3db99f..9fcb030f03 100644
--- a/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs
+++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/UserRepository.cs
@@ -25,6 +25,7 @@
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities;
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;
namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories;
@@ -53,8 +54,8 @@ public IAsyncEnumerable GetApplicationsWithStatusU
})
.AsAsyncEnumerable();
- public CompanyUser CreateCompanyUser(Guid identityId, string? firstName, string? lastName, string email, Guid lastEditorId) =>
- _dbContext.CompanyUsers.Add(new CompanyUser(identityId, lastEditorId)
+ public CompanyUser CreateCompanyUser(Guid identityId, string? firstName, string? lastName, string email) =>
+ _dbContext.CompanyUsers.Add(new CompanyUser(identityId)
{
Firstname = firstName,
Lastname = lastName,
@@ -73,9 +74,7 @@ public Identity CreateIdentity(Guid companyId, UserStatusId userStatusId) =>
public void AttachAndModifyCompanyUser(Guid companyUserId, Action? initialize, Action setOptionalParameters)
{
- var companyUser = new CompanyUser(companyUserId,
- // Guid.Empty, default, default,
- Guid.Empty);
+ var companyUser = new CompanyUser(companyUserId);
initialize?.Invoke(companyUser);
var updatedEntity = _dbContext.Attach(companyUser).Entity;
setOptionalParameters.Invoke(updatedEntity);
diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.Designer.cs
new file mode 100644
index 0000000000..62059ffa8c
--- /dev/null
+++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230731123725_1.6.0-rc4.Designer.cs
@@ -0,0 +1,7197 @@
+/********************************************************************************
+ * Copyright (c) 2021, 2023 BMW Group AG
+ * Copyright (c) 2021, 2023 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 Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities;
+
+#nullable disable
+
+namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations
+{
+ [DbContext(typeof(PortalDbContext))]
+ [Migration("20230731123725_1.6.0-rc4")]
+ partial class _160rc4
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasDefaultSchema("portal")
+ .UseCollation("en_US.utf8")
+ .HasAnnotation("ProductVersion", "6.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.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.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("ProviderId")
+ .HasColumnType("uuid")
+ .HasColumnName("provider_id");
+
+ b.Property("SelfDescriptionDocumentId")
+ .HasColumnType("uuid")
+ .HasColumnName("self_description_document_id");
+
+ b.Property("SelfDescriptionMessage")
+ .HasColumnType("text")
+ .HasColumnName("self_description_message");
+
+ b.Property("StatusId")
+ .HasColumnType("integer")
+ .HasColumnName("status_id");
+
+ b.Property("TypeId")
+ .HasColumnType("integer")
+ .HasColumnName("type_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_connector20230405");
+
+ b.ToTable("audit_connector20230405", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConnector20230503", 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("CompanyServiceAccountId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_service_account_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("ProviderId")
+ .HasColumnType("uuid")
+ .HasColumnName("provider_id");
+
+ b.Property("SelfDescriptionDocumentId")
+ .HasColumnType("uuid")
+ .HasColumnName("self_description_document_id");
+
+ b.Property("SelfDescriptionMessage")
+ .HasColumnType("text")
+ .HasColumnName("self_description_message");
+
+ b.Property("StatusId")
+ .HasColumnType("integer")
+ .HasColumnName("status_id");
+
+ b.Property("TypeId")
+ .HasColumnType("integer")
+ .HasColumnName("type_id");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_connector20230503");
+
+ b.ToTable("audit_connector20230503", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditConsent20230412", b =>
+ {
+ b.Property("AuditV1Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("audit_v1id");
+
+ b.Property("AgreementId")
+ .HasColumnType("uuid")
+ .HasColumnName("agreement_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("Comment")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("comment");
+
+ b.Property("CompanyId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_id");
+
+ b.Property("CompanyUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("company_user_id");
+
+ b.Property("ConsentStatusId")
+ .HasColumnType("integer")
+ .HasColumnName("consent_status_id");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_created");
+
+ b.Property("DocumentId")
+ .HasColumnType("uuid")
+ .HasColumnName("document_id");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("Target")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("target");
+
+ b.HasKey("AuditV1Id")
+ .HasName("pk_audit_consent20230412");
+
+ b.ToTable("audit_consent20230412", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditIdentityAssignedRole20230522", 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("IdentityId")
+ .HasColumnType("uuid")
+ .HasColumnName("identity_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_identity_assigned_role20230522");
+
+ b.ToTable("audit_identity_assigned_role20230522", "portal");
+ });
+
+ modelBuilder.Entity("Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.AuditEntities.AuditOffer20230119", 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("ContactEmail")
+ .HasColumnType("text")
+ .HasColumnName("contact_email");
+
+ b.Property("ContactNumber")
+ .HasColumnType("text")
+ .HasColumnName("contact_number");
+
+ 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("DateReleased")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date_released");
+
+ b.Property("Id")
+ .HasColumnType("uuid")
+ .HasColumnName("id");
+
+ b.Property("LastEditorId")
+ .HasColumnType("uuid")
+ .HasColumnName("last_editor_id");
+
+ b.Property("MarketingUrl")
+ .HasColumnType("text")
+ .HasColumnName("marketing_url");
+
+ b.Property("Name")
+ .HasColumnType("text")
+ .HasColumnName("name");
+
+ b.Property("OfferStatusId")
+ .HasColumnType("integer")
+ .HasColumnName("offer_status_id");
+
+ b.Property