Skip to content

Commit

Permalink
build: merge release into main #985
Browse files Browse the repository at this point in the history
Reviewed-By: Evelyn Gurschler <[email protected]>
  • Loading branch information
Phil91 authored Sep 10, 2024
2 parents 87a73db + 3744239 commit 48ea112
Show file tree
Hide file tree
Showing 45 changed files with 742 additions and 431 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@

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

## 2.2.0-RC4

### Bugfixes

* **Connectors**
* add filter for COMPANY_CONNECTOR [#972](https://github.com/eclipse-tractusx/portal-backend/pull/972)
* adjust connector deletion process [#968](https://github.com/eclipse-tractusx/portal-backend/pull/968)
* **Idp**
* add search functionality to idp endpoint [#982](https://github.com/eclipse-tractusx/portal-backend/pull/982)
* **Offer Management**
* adjust status query param for subscription-status [#969](https://github.com/eclipse-tractusx/portal-backend/pull/969)

## 2.2.0-RC3

### Bugfixes

* **REgistration Process**
* **Registration Process**
* removed DIM authentication details from logs [#951](https://github.com/eclipse-tractusx/portal-backend/pull/951)
* adjust retrigger process for sd creation [#938](https://github.com/eclipse-tractusx/portal-backend/pull/938)
* **Connector creation**
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.2.0</VersionPrefix>
<VersionSuffix>RC3</VersionSuffix>
<VersionSuffix>RC4</VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class ConnectorsBusinessLogic(
IOptions<ConnectorsSettings> options,
ISdFactoryBusinessLogic sdFactoryBusinessLogic,
IIdentityService identityService,
IServiceAccountManagement serviceAccountManagement,
ILogger<ConnectorsBusinessLogic> logger)
: IConnectorsBusinessLogic
{
Expand Down Expand Up @@ -242,22 +243,26 @@ await sdFactoryBusinessLogic
}

/// <inheritdoc/>
public async Task DeleteConnectorAsync(Guid connectorId)
public async Task DeleteConnectorAsync(Guid connectorId, bool deleteServiceAccount)
{
var companyId = _identityData.CompanyId;
var connectorsRepository = portalRepositories.GetInstance<IConnectorsRepository>();
var result = await connectorsRepository.GetConnectorDeleteDataAsync(connectorId, companyId).ConfigureAwait(ConfigureAwaitOptions.None) ?? throw NotFoundException.Create(AdministrationConnectorErrors.CONNECTOR_NOT_FOUND, new ErrorParameter[] { new("connectorId", connectorId.ToString()) });
var processStepsToFilter = new[]
{
ProcessStepTypeId.CREATE_DIM_TECHNICAL_USER, ProcessStepTypeId.RETRIGGER_CREATE_DIM_TECHNICAL_USER,
ProcessStepTypeId.AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE,
ProcessStepTypeId.RETRIGGER_AWAIT_CREATE_DIM_TECHNICAL_USER_RESPONSE
};

var result = await connectorsRepository.GetConnectorDeleteDataAsync(connectorId, companyId, processStepsToFilter).ConfigureAwait(ConfigureAwaitOptions.None) ?? throw NotFoundException.Create(AdministrationConnectorErrors.CONNECTOR_NOT_FOUND, new ErrorParameter[] { new("connectorId", connectorId.ToString()) });
if (!result.IsProvidingOrHostCompany)
{
throw ForbiddenException.Create(AdministrationConnectorErrors.CONNECTOR_NOT_PROVIDER_COMPANY_NOR_HOST, new ErrorParameter[] { new("companyId", companyId.ToString()), new("connectorId", connectorId.ToString()) });
}

if (result.ServiceAccountId.HasValue && result.UserStatusId != UserStatusId.INACTIVE)
if (result is { ServiceAccountId: not null, UserStatusId: UserStatusId.ACTIVE or UserStatusId.PENDING } && deleteServiceAccount)
{
portalRepositories.GetInstance<IUserRepository>().AttachAndModifyIdentity(result.ServiceAccountId.Value, null, i =>
{
i.UserStatusId = UserStatusId.INACTIVE;
});
await serviceAccountManagement.DeleteServiceAccount(result.ServiceAccountId!.Value, result.DeleteServiceAccountData).ConfigureAwait(false);
}

switch (result.ConnectorStatus)
Expand Down Expand Up @@ -290,6 +295,7 @@ private async Task DeleteUpdateConnectorDetail(Guid connectorId, IConnectorsRepo
{
connectorsRepository.AttachAndModifyConnector(connectorId, null, con =>
{
con.CompanyServiceAccountId = null;
con.StatusId = ConnectorStatusId.INACTIVE;
con.DateLastChanged = DateTimeOffset.UtcNow;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public interface IConnectorsBusinessLogic
/// Remove a connector from persistence layer by id.
/// </summary>
/// <param name="connectorId">ID of the connector to be deleted.</param>
Task DeleteConnectorAsync(Guid connectorId);
/// <param name="deleteServiceAccount">if <c>true</c> the linked service account will be deleted, otherwise the connection to the connector will just be removed</param>
Task DeleteConnectorAsync(Guid connectorId, bool deleteServiceAccount);

/// <summary>
/// Retrieve connector end point along with bpns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLog

public interface IIdentityProviderBusinessLogic
{
IAsyncEnumerable<IdentityProviderDetails> GetOwnCompanyIdentityProvidersAsync();
IAsyncEnumerable<IdentityProviderDetails> GetOwnCompanyIdentityProvidersAsync(string? displayName, string? alias);
ValueTask<IdentityProviderDetails> CreateOwnCompanyIdentityProviderAsync(IamIdentityProviderProtocol protocol, IdentityProviderTypeId typeId, string? displayName);
ValueTask<IdentityProviderDetails> GetOwnCompanyIdentityProviderAsync(Guid identityProviderId);
ValueTask<IdentityProviderDetails> SetOwnCompanyIdentityProviderStatusAsync(Guid identityProviderId, bool enabled);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/********************************************************************************
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;

public interface IServiceAccountManagement
{
Task DeleteServiceAccount(Guid serviceAccountId, DeleteServiceAccountData result);
}
Loading

0 comments on commit 48ea112

Please sign in to comment.