Skip to content

Commit

Permalink
Merge pull request #832 from eclipse-tractusx/release/v2.1.0-RC1
Browse files Browse the repository at this point in the history
build(2.1.0-rc1): merge main into main
  • Loading branch information
evegufy authored Jul 15, 2024
2 parents 70b1dbf + 1816125 commit e20a452
Show file tree
Hide file tree
Showing 19 changed files with 329 additions and 284 deletions.
33 changes: 32 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

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

## 2.1.0-RC1

### Change
- App Services [#827](https://github.com/eclipse-tractusx/portal-backend/pull/827)
- updated endpoint authorization rule setting of `GET /api/apps/AppChange/{appId}/roles` => new permission validation to `edit_apps`
- updated endpoint authorization rule setting of `GET /api/apps/AppReleaseProcess/{appId}/roles` => new permission validation to `add_apps`
- Process Worker
- moved email validation in decline application process api from child method to parent method [#822](https://github.com/eclipse-tractusx/portal-backend/pull/822)
- removed mail process creation of the decline registration mail if the user self-triggered the decline [#806](https://github.com/eclipse-tractusx/portal-backend/pull/806)

### Feature
- Registration Process (Administration Service)
- added configuration toggle to deactivate the GX compliance service interface dependency incl. SD factory connectivity to enable registration and connector creation without external dependency [#793](https://github.com/eclipse-tractusx/portal-backend/pull/793)

### Technical Support
- changed from emulation to cross-compile for building multi-platform images [#803](https://github.com/eclipse-tractusx/portal-backend/pull/803)
- improved dockerfiles by removing unnecessary base stage and aligning environment variables [#803](https://github.com/eclipse-tractusx/portal-backend/pull/803)
- running the app from top-level program has been changed from synchronous to asynchronous execution [#786](https://github.com/eclipse-tractusx/portal-backend/pull/786)
- changed querying db-sequences from synchronous to asynchronous execution [#786](https://github.com/eclipse-tractusx/portal-backend/pull/786)
- added exception-handling to the crypto helper to properly map the system exceptions that are thrown by the Aes-classes to configuration respective conflict exceptions [#790](https://github.com/eclipse-tractusx/portal-backend/pull/790)
- updated GitHub actions [#785](https://github.com/eclipse-tractusx/portal-backend/pull/785)/[#777](https://github.com/eclipse-tractusx/portal-backend/pull/777)
- **Clean-up unused Code** [#783](https://github.com/eclipse-tractusx/portal-backend/pull/783)
- removed all company credential (SSI) related endpoints
- removed all company credential (SSI) related database tables

### Bugfixes
- fixed nullability-issue in IdentityProviderBusinessLogic [#786](https://github.com/eclipse-tractusx/portal-backend/pull/786)
- fixed ambiguity in IfAny nullable return type declaration [#786](https://github.com/eclipse-tractusx/portal-backend/pull/786)
- added locking for the `invite process` process worker [#788](https://github.com/eclipse-tractusx/portal-backend/pull/788)
- fixed support of null setting of the attribute `url` for offer provider autosetup url configuration endpoint `PUT /api/administration/SubscriptionConfiguration/owncompany` [#783](https://github.com/eclipse-tractusx/portal-backend/pull/783)

## 2.0.0

### Change
Expand Down Expand Up @@ -138,7 +169,7 @@ The following are known issues identified in the current release:
* **Validation Limitations:**
* Pattern validation for URL inputs in `POST` and `PUT` endpoints is currently limited, potentially allowing invalid URLs to be accepted. [#587](https://github.com/eclipse-tractusx/portal-backend/issues/587)
* **Validation of File Upload Limitation:**
* It is recommended to make make use of an existing trustworthy 3rd party virus-scan service for a more broad scan for known malicious signatures. [#779](https://github.com/eclipse-tractusx/portal-backend/issues/779)
* It is recommended to make use of an existing trustworthy 3rd party virus-scan service for a more broad scan for known malicious signatures. [#779](https://github.com/eclipse-tractusx/portal-backend/issues/779)
* **In Memory Storage Limitation**:
* Sensitive information (such as passwords) is read in an unencrypted manner in memory.

Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionSuffix>RC1</VersionSuffix>
</PropertyGroup>
</Project>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public class ConnectorsSettings
/// </summary>
[Required(AllowEmptyStrings = false)]
public string SelfDescriptionDocumentUrl { get; set; } = null!;

/// <summary>
/// If <c>true</c> all sd factory calls are disabled and won't be called. The respective process steps will be skipped.
/// </summary>
public bool ClearinghouseConnectDisabled { get; set; }
}

public static class ConnectorsSettingsExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@ public async Task ApproveRegistrationVerification(Guid applicationId)

public async Task DeclineRegistrationVerification(Guid applicationId, string comment, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(comment))
{
throw new ConflictException("No comment set.");
}

var result = await _portalRepositories.GetInstance<IApplicationRepository>().GetCompanyIdNameForSubmittedApplication(applicationId).ConfigureAwait(ConfigureAwaitOptions.None);
if (result == default)
{
Expand Down Expand Up @@ -546,11 +551,6 @@ public async Task DeclineRegistrationVerification(Guid applicationId, string com

private void PostRegistrationCancelEmailAsync(ICollection<EmailData> emailData, string companyName, string comment)
{
if (string.IsNullOrWhiteSpace(comment))
{
throw new ConflictException("No comment set.");
}

foreach (var user in emailData)
{
var userName = string.Join(" ", new[] { user.FirstName, user.LastName }.Where(item => !string.IsNullOrWhiteSpace(item)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using Microsoft.Extensions.Options;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories;
Expand All @@ -28,31 +29,38 @@

namespace Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library.BusinessLogic;

public class SdFactoryBusinessLogic : ISdFactoryBusinessLogic
public class SdFactoryBusinessLogic(
ISdFactoryService sdFactoryService,
IPortalRepositories portalRepositories,
IApplicationChecklistService checklistService,
IOptions<SdFactorySettings> options)
: ISdFactoryBusinessLogic
{
private readonly ISdFactoryService _sdFactoryService;
private readonly IPortalRepositories _portalRepositories;
private readonly IApplicationChecklistService _checklistService;

public SdFactoryBusinessLogic(ISdFactoryService sdFactoryService, IPortalRepositories portalRepositories,
IApplicationChecklistService checklistService)
{
_sdFactoryService = sdFactoryService;
_portalRepositories = portalRepositories;
_checklistService = checklistService;
}
private readonly SdFactorySettings _settings = options.Value;

/// <inheritdoc />
public Task RegisterConnectorAsync(
Guid connectorId,
string selfDescriptionDocumentUrl,
string businessPartnerNumber,
CancellationToken cancellationToken) =>
_sdFactoryService.RegisterConnectorAsync(connectorId, selfDescriptionDocumentUrl, businessPartnerNumber, cancellationToken);
sdFactoryService.RegisterConnectorAsync(connectorId, selfDescriptionDocumentUrl, businessPartnerNumber, cancellationToken);

/// <inheritdoc />
public async Task<IApplicationChecklistService.WorkerChecklistProcessStepExecutionResult> StartSelfDescriptionRegistration(IApplicationChecklistService.WorkerChecklistProcessStepData context, CancellationToken cancellationToken)
{
if (_settings.ClearinghouseConnectDisabled)
{
return new IApplicationChecklistService.WorkerChecklistProcessStepExecutionResult(
ProcessStepStatusId.DONE,
entry => entry.ApplicationChecklistEntryStatusId = ApplicationChecklistEntryStatusId.DONE,
new[] { ProcessStepTypeId.ACTIVATE_APPLICATION },
null,
true,
null
);
}

await RegisterSelfDescriptionInternalAsync(context.ApplicationId, cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);

Expand All @@ -70,7 +78,7 @@ private async Task RegisterSelfDescriptionInternalAsync(
Guid applicationId,
CancellationToken cancellationToken)
{
var result = await _portalRepositories.GetInstance<IApplicationRepository>()
var result = await portalRepositories.GetInstance<IApplicationRepository>()
.GetCompanyAndApplicationDetailsWithUniqueIdentifiersAsync(applicationId)
.ConfigureAwait(ConfigureAwaitOptions.None);
if (result == default)
Expand All @@ -86,15 +94,15 @@ private async Task RegisterSelfDescriptionInternalAsync(
$"BusinessPartnerNumber (bpn) for CompanyApplications {applicationId} company {companyId} is empty");
}

await _sdFactoryService
await sdFactoryService
.RegisterSelfDescriptionAsync(applicationId, uniqueIdentifiers, countryCode, businessPartnerNumber, cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);
}

public async Task ProcessFinishSelfDescriptionLpForApplication(SelfDescriptionResponseData data, Guid companyId, CancellationToken cancellationToken)
{
var confirm = ValidateData(data);
var context = await _checklistService
var context = await checklistService
.VerifyChecklistEntryAndProcessSteps(
data.ExternalId,
ApplicationChecklistEntryTypeId.SELF_DESCRIPTION_LP,
Expand All @@ -106,11 +114,11 @@ public async Task ProcessFinishSelfDescriptionLpForApplication(SelfDescriptionRe
if (confirm)
{
var documentId = await ProcessDocument(SdFactoryResponseModelTitle.LegalPerson, data, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
_portalRepositories.GetInstance<ICompanyRepository>().AttachAndModifyCompany(companyId, null,
portalRepositories.GetInstance<ICompanyRepository>().AttachAndModifyCompany(companyId, null,
c => { c.SelfDescriptionDocumentId = documentId; });
}

_checklistService.FinalizeChecklistEntryAndProcessSteps(
checklistService.FinalizeChecklistEntryAndProcessSteps(
context,
null,
item =>
Expand All @@ -133,7 +141,7 @@ public async Task ProcessFinishSelfDescriptionLpForConnector(SelfDescriptionResp
{
documentId = await ProcessDocument(SdFactoryResponseModelTitle.Connector, data, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
}
_portalRepositories.GetInstance<IConnectorsRepository>().AttachAndModifyConnector(data.ExternalId, null, con =>
portalRepositories.GetInstance<IConnectorsRepository>().AttachAndModifyConnector(data.ExternalId, null, con =>
{
if (documentId != null)
{
Expand Down Expand Up @@ -175,7 +183,7 @@ private async Task<Guid> ProcessDocument(SdFactoryResponseModelTitle title, Self
var documentContent = ms.ToArray();
var hash = SHA512.HashData(documentContent);

var document = _portalRepositories.GetInstance<IDocumentRepository>().CreateDocument(
var document = portalRepositories.GetInstance<IDocumentRepository>().CreateDocument(
$"SelfDescription_{title}.json",
documentContent,
hash,
Expand Down
22 changes: 4 additions & 18 deletions src/externalsystems/SdFactory.Library/SdFactoryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,14 @@ namespace Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library;
/// <summary>
/// Service to handle communication with the connectors sd factory
/// </summary>
public class SdFactoryService : ISdFactoryService
public class SdFactoryService(ITokenService tokenService, IOptions<SdFactorySettings> options) : ISdFactoryService
{
private readonly ITokenService _tokenService;
private readonly SdFactorySettings _settings;

/// <summary>
/// Creates a new instance of <see cref="SdFactoryService"/>
/// </summary>
/// <param name="tokenService">Access to the token service</param>
/// <param name="options">The options</param>
public SdFactoryService(
ITokenService tokenService,
IOptions<SdFactorySettings> options)
{
_settings = options.Value;
_tokenService = tokenService;
}
private readonly SdFactorySettings _settings = options.Value;

/// <inheritdoc />
public async Task RegisterConnectorAsync(Guid connectorId, string selfDescriptionDocumentUrl, string businessPartnerNumber, CancellationToken cancellationToken)
{
var httpClient = await _tokenService.GetAuthorizedClient<SdFactoryService>(_settings, cancellationToken)
var httpClient = await tokenService.GetAuthorizedClient<SdFactoryService>(_settings, cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);
var requestModel = new ConnectorSdFactoryRequestModel(
connectorId.ToString(),
Expand All @@ -70,7 +56,7 @@ await httpClient.PostAsJsonAsync(default(string?), requestModel, cancellationTok
/// <inheritdoc />
public async Task RegisterSelfDescriptionAsync(Guid applicationId, IEnumerable<(UniqueIdentifierId Id, string Value)> uniqueIdentifiers, string countryCode, string businessPartnerNumber, CancellationToken cancellationToken)
{
var httpClient = await _tokenService.GetAuthorizedClient<SdFactoryService>(_settings, cancellationToken)
var httpClient = await tokenService.GetAuthorizedClient<SdFactoryService>(_settings, cancellationToken)
.ConfigureAwait(ConfigureAwaitOptions.None);
var requestModel = new SdFactoryRequestModel(
applicationId.ToString(),
Expand Down
5 changes: 5 additions & 0 deletions src/externalsystems/SdFactory.Library/SdFactorySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ namespace Org.Eclipse.TractusX.Portal.Backend.SdFactory.Library;
/// </summary>
public class SdFactorySettings : KeyVaultAuthSettings
{
/// <summary>
/// If <c>true</c> all sd factory calls are disabled and won't be called. The respective process steps will be skipped.
/// </summary>
public bool ClearinghouseConnectDisabled { get; set; }

/// <summary>
/// SD Factory endpoint for registering connectors.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public async Task<NoContentResult> CreateActiveAppDocumentAsync([FromRoute] Guid
/// <response code="400">The language does not exist.</response>
/// <response code="404">The app was not found.</response>
[HttpGet]
[Authorize(Roles = "view_client_roles")]
[Authorize(Roles = "edit_apps")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("{appId}/roles")]
[ProducesResponseType(typeof(IEnumerable<ActiveAppRoleDetails>), StatusCodes.Status200OK)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public async Task<NoContentResult> CreateAndUpdateTechnicalUserProfiles([FromRou
/// <response code="404">The app was not found.</response>
/// <response code="403">The app is not the provider of the company</response>
[HttpGet]
[Authorize(Roles = "view_client_roles")]
[Authorize(Roles = "add_apps")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("{appId}/roles")]
[ProducesResponseType(typeof(IEnumerable<ActiveAppRoleDetails>), StatusCodes.Status200OK)]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations
{
/// <inheritdoc />
public partial class _538RemoveSsiDetails : Migration
public partial class _210rc1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
Expand Down
Loading

0 comments on commit e20a452

Please sign in to comment.