Skip to content

Commit

Permalink
Merge pull request #776 from eclipse-tractusx/release/v2.0.0-RC10
Browse files Browse the repository at this point in the history
build(2.0.0-rc10): merge release into main
  • Loading branch information
evegufy authored May 28, 2024
2 parents a0b4b0d + c04509d commit 2348e52
Show file tree
Hide file tree
Showing 101 changed files with 13,826 additions and 520 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

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

## 2.0.0-RC10

### Feature
* **Processes Worker**
* added process to decline own companies registration
* **Administration Service**
* enabled the retrieval of service accounts with userstatusid != DELETED
* include pending serviceaccounts and add userstatus to result

### Changes
* **Seeding**
* add bpdm roles

### Bugfix
* **Registration Service**
* adjusted permission for /declineregistration
* add valid company policy
* **Administration Service**
* allowed deletion of configured url for own company
* fixed old autosetup process for dim technical user creation
* fixed conflict errors for inactive and pending service accounts
* fixed error "Sequence contains more than one element" for GET /serviceAccounts/{serviceAccountID} endpoint

## 2.0.0-RC9

### Changes
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.0.0</VersionPrefix>
<VersionSuffix>RC9</VersionSuffix>
<VersionSuffix>RC10</VersionSuffix>
</PropertyGroup>
</Project>
62 changes: 61 additions & 1 deletion src/Portal.Backend.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32407.343
MinimumVisualStudioVersion = 10.0.40219.1
Expand Down Expand Up @@ -274,6 +274,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DimUserCreationProcess.Exec
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DimUserCreationProcess.Executor.Tests", "..\tests\processes\DimUserCreationProcess.Executor.Tests\DimUserCreationProcess.Executor.Tests.csproj", "{143433B2-2792-4C5F-A3C2-E5C91D68E30D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityProviderProvisioning.Executor", "processes\IdentityProviderProvisioning.Executor\IdentityProviderProvisioning.Executor.csproj", "{9636BEC8-6929-4852-8DC8-8B41609630A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserProvisioning.Executor", "processes\UserProvisioning.Executor\UserProvisioning.Executor.csproj", "{E5494227-BDFE-41F2-A12F-54292D76C29F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityProviderProvisioning.Executor.Tests", "..\tests\processes\IdentityProviderProvisioning.Executor.Tests\IdentityProviderProvisioning.Executor.Tests.csproj", "{CD76A7FF-D003-41DE-9442-F9AB223C6051}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserProvisioning.Executor.Tests", "..\tests\processes\UserProvisioning.Executor.Tests\UserProvisioning.Executor.Tests.csproj", "{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1738,6 +1746,54 @@ Global
{143433B2-2792-4C5F-A3C2-E5C91D68E30D}.Release|x64.Build.0 = Release|Any CPU
{143433B2-2792-4C5F-A3C2-E5C91D68E30D}.Release|x86.ActiveCfg = Release|Any CPU
{143433B2-2792-4C5F-A3C2-E5C91D68E30D}.Release|x86.Build.0 = Release|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Debug|x64.ActiveCfg = Debug|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Debug|x64.Build.0 = Debug|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Debug|x86.ActiveCfg = Debug|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Debug|x86.Build.0 = Debug|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Release|Any CPU.Build.0 = Release|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Release|x64.ActiveCfg = Release|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Release|x64.Build.0 = Release|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Release|x86.ActiveCfg = Release|Any CPU
{9636BEC8-6929-4852-8DC8-8B41609630A3}.Release|x86.Build.0 = Release|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Debug|x64.ActiveCfg = Debug|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Debug|x64.Build.0 = Debug|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Debug|x86.ActiveCfg = Debug|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Debug|x86.Build.0 = Debug|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Release|Any CPU.Build.0 = Release|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Release|x64.ActiveCfg = Release|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Release|x64.Build.0 = Release|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Release|x86.ActiveCfg = Release|Any CPU
{E5494227-BDFE-41F2-A12F-54292D76C29F}.Release|x86.Build.0 = Release|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Debug|x64.ActiveCfg = Debug|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Debug|x64.Build.0 = Debug|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Debug|x86.ActiveCfg = Debug|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Debug|x86.Build.0 = Debug|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Release|Any CPU.Build.0 = Release|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Release|x64.ActiveCfg = Release|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Release|x64.Build.0 = Release|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Release|x86.ActiveCfg = Release|Any CPU
{CD76A7FF-D003-41DE-9442-F9AB223C6051}.Release|x86.Build.0 = Release|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Debug|x64.ActiveCfg = Debug|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Debug|x64.Build.0 = Debug|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Debug|x86.ActiveCfg = Debug|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Debug|x86.Build.0 = Debug|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|Any CPU.Build.0 = Release|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|x64.ActiveCfg = Release|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|x64.Build.0 = Release|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|x86.ActiveCfg = Release|Any CPU
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -1746,6 +1802,8 @@ Global
SolutionGuid = {2EB6265F-323A-4BF3-969E-003D64A14B64}
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0CBCC851-99A1-4005-9BBA-E6A20A0AEDAA} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{CD76A7FF-D003-41DE-9442-F9AB223C6051} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{A43B5ACA-1209-46E9-84DB-A48553ED623E} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{A5BEDD89-7280-466E-8D14-EC5E177AAD07} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{5E80DEEA-B254-425C-8220-27EEF47C10BD} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
Expand Down Expand Up @@ -1868,5 +1926,7 @@ Global
{C8E23437-963C-4277-8A65-FDE330C20AAC} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{AD692510-23BA-4021-A44D-DE480A771C23} = {282CEF03-292F-4A49-83C6-997567D0FF5F}
{143433B2-2792-4C5F-A3C2-E5C91D68E30D} = {323C198D-A8C6-4EB0-8B79-72624275E35F}
{9636BEC8-6929-4852-8DC8-8B41609630A3} = {282CEF03-292F-4A49-83C6-997567D0FF5F}
{E5494227-BDFE-41F2-A12F-54292D76C29F} = {282CEF03-292F-4A49-83C6-997567D0FF5F}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/********************************************************************************
* Copyright (c) 2022 BMW Group AG
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
Expand Down Expand Up @@ -107,4 +106,28 @@ public interface IRegistrationBusinessLogic
/// <param name="data">the response data</param>
/// <param name="cancellationToken">cancellation token</param>
Task ProcessIssuerMembershipResponseAsync(IssuerResponseData data, CancellationToken cancellationToken);

/// <summary>
/// Retrigger the DeleteIdpSharedRealm ProcessStepType
/// </summary>
/// <param name="processId">Id of the Process</param>
Task RetriggerDeleteIdpSharedRealm(Guid processId);

/// <summary>
/// Retrigger the DeleteIdpSharedServiceAccount ProcessStepType
/// </summary>
/// <param name="processId">Id of the Process</param>
Task RetriggerDeleteIdpSharedServiceAccount(Guid processId);

/// <summary>
/// Retrigger the DeleteCentralIdentityProvider ProcessStepType
/// </summary>
/// <param name="processId">Id of the Process</param>
Task RetriggerDeleteCentralIdentityProvider(Guid processId);

/// <summary>
/// Retrigger the DeleteCentralUser ProcessStepType
/// </summary>
/// <param name="processId">Id of the Process</param>
Task RetriggerDeleteCentralUser(Guid processId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Org.Eclipse.TractusX.Portal.Backend.Dim.Library.Models;
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.Provisioning.Library.Models;

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.BusinessLogic;
Expand All @@ -32,7 +33,7 @@ public interface IServiceAccountBusinessLogic
Task<ServiceAccountConnectorOfferData> GetOwnCompanyServiceAccountDetailsAsync(Guid serviceAccountId);
Task<ServiceAccountDetails> UpdateOwnCompanyServiceAccountDetailsAsync(Guid serviceAccountId, ServiceAccountEditableDetails serviceAccountDetails);
Task<ServiceAccountDetails> ResetOwnCompanyServiceAccountSecretAsync(Guid serviceAccountId);
Task<Pagination.Response<CompanyServiceAccountData>> GetOwnCompanyServiceAccountsDataAsync(int page, int size, string? clientId, bool? isOwner, bool filterForInactive);
Task<Pagination.Response<CompanyServiceAccountData>> GetOwnCompanyServiceAccountsDataAsync(int page, int size, string? clientId, bool? isOwner, bool filterForInactive, IEnumerable<UserStatusId>? userStatusIds);
IAsyncEnumerable<UserRoleWithDescription> GetServiceAccountRolesAsync(string? languageShortName);
Task HandleServiceAccountCreationCallback(Guid processId, AuthenticationDetail callbackData);
}
Original file line number Diff line number Diff line change
Expand Up @@ -376,24 +376,11 @@ public async ValueTask DeleteCompanyIdentityProviderAsync(Guid identityProviderI
{
await DeleteManagedIdpLinks(identityProviderId, alias, ownerCompanyName, identityProviderRepository).ConfigureAwait(ConfigureAwaitOptions.None);
}
else
{
await DeleteOwnCompanyIdpLinks(identityProviderId, identityProviderRepository).ConfigureAwait(ConfigureAwaitOptions.None);
}

identityProviderRepository.DeleteIdentityProvider(identityProviderId);
await _portalRepositories.SaveAsync().ConfigureAwait(ConfigureAwaitOptions.None);
}

private async Task DeleteOwnCompanyIdpLinks(Guid identityProviderId, IIdentityProviderRepository identityProviderRepository)
{
var companyId = _identityData.CompanyId;
var companyUserIds = await identityProviderRepository.GetIdpLinkedCompanyUserIds(identityProviderId, companyId).ToListAsync();

identityProviderRepository.DeleteCompanyIdentityProvider(companyId, identityProviderId);
_portalRepositories.GetInstance<IUserRepository>().RemoveCompanyUserAssignedIdentityProviders(companyUserIds.Select(id => (id, identityProviderId)));
}

private async Task DeleteManagedIdpLinks(Guid identityProviderId, string? alias, string ownerCompanyName, IIdentityProviderRepository identityProviderRepository)
{
var roleIds = await _mailingProcessCreation.GetRoleData(_settings.DeleteIdpRoles).ConfigureAwait(ConfigureAwaitOptions.None);
Expand All @@ -417,9 +404,6 @@ private async Task DeleteManagedIdpLinks(Guid identityProviderId, string? alias,
await DeleteKeycloakUsers(data.Identities.Select(i => i.IdentityId));
}

identityProviderRepository.DeleteCompanyIdentityProvider(data.CompanyId, identityProviderId);
userRepository.RemoveCompanyUserAssignedIdentityProviders(data.Identities.Where(x => x.IsLinkedCompanyUser).Select(x => (x.IdentityId, identityProviderId)));

foreach (var userData in data.Identities.Where(i => i is { IsInUserRoles: true, Userdata.UserMail: not null }).Select(i => i.Userdata))
{
var userName = string.Join(" ", new[] { userData.FirstName, userData.LastName }.Where(item => !string.IsNullOrWhiteSpace(item)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Enums;
using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library;
using Org.Eclipse.TractusX.Portal.Backend.Processes.Library;
using Org.Eclipse.TractusX.Portal.Backend.Processes.Mailing.Library;
using Org.Eclipse.TractusX.Portal.Backend.Provisioning.Library;
using Org.Eclipse.TractusX.Portal.Backend.Registration.Common;
Expand Down Expand Up @@ -491,14 +492,18 @@ public async Task DeclineRegistrationVerification(Guid applicationId, string com
await _provisioningManager.DeleteSharedIdpRealmAsync(idpAlias).ConfigureAwait(false);
}

identityProviderRepository.DeleteCompanyIdentityProvider(companyId, idpId);
if (idpType is IdentityProviderTypeId.OWN or IdentityProviderTypeId.SHARED)
{
await _provisioningManager.DeleteCentralIdentityProviderAsync(idpAlias).ConfigureAwait(ConfigureAwaitOptions.None);
identityProviderRepository.DeleteIamIdentityProvider(idpAlias);
identityProviderRepository.DeleteIdentityProvider(idpId);
}
userRepository.RemoveCompanyUserAssignedIdentityProviders(linkedUserIds.Select(userId => (userId, idpId)));
else
{
// a managed identityprovider is just unlinked from company and users
identityProviderRepository.DeleteCompanyIdentityProvider(companyId, idpId);
userRepository.RemoveCompanyUserAssignedIdentityProviders(linkedUserIds.Select(userId => (userId, idpId)));
}
}

_portalRepositories.GetInstance<IApplicationRepository>().AttachAndModifyCompanyApplication(applicationId, application =>
Expand Down Expand Up @@ -631,4 +636,38 @@ private async Task<Guid> GetApplicationIdByBpn(IssuerResponseData data, Cancella

return result.Single();
}

public Task RetriggerDeleteIdpSharedRealm(Guid processId) => RetriggerProcessStepInternal(processId, ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_REALM);

/// <inheritdoc />
public Task RetriggerDeleteIdpSharedServiceAccount(Guid processId) => RetriggerProcessStepInternal(processId, ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_SERVICEACCOUNT);

/// <inheritdoc />
public Task RetriggerDeleteCentralIdentityProvider(Guid processId) => RetriggerProcessStepInternal(processId, ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_IDENTITY_PROVIDER);

public Task RetriggerDeleteCentralUser(Guid processId) => RetriggerProcessStepInternal(processId, ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_USER);

private async Task RetriggerProcessStepInternal(Guid processId, ProcessStepTypeId stepToTrigger)
{
var (processType, nextStep) = stepToTrigger switch
{
ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_REALM => (ProcessTypeId.IDENTITYPROVIDER_PROVISIONING, ProcessStepTypeId.DELETE_IDP_SHARED_REALM),
ProcessStepTypeId.RETRIGGER_DELETE_IDP_SHARED_SERVICEACCOUNT => (ProcessTypeId.IDENTITYPROVIDER_PROVISIONING, ProcessStepTypeId.DELETE_IDP_SHARED_SERVICEACCOUNT),
ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_IDENTITY_PROVIDER => (ProcessTypeId.IDENTITYPROVIDER_PROVISIONING, ProcessStepTypeId.DELETE_CENTRAL_IDENTITY_PROVIDER),
ProcessStepTypeId.RETRIGGER_DELETE_CENTRAL_USER => (ProcessTypeId.USER_PROVISIONING, ProcessStepTypeId.DELETE_CENTRAL_USER),
_ => throw new UnexpectedConditionException($"Step {stepToTrigger} is not retriggerable")
};

var (validProcessId, processData) = await _portalRepositories.GetInstance<IProcessStepRepository>().IsValidProcess(processId, processType, Enumerable.Repeat(stepToTrigger, 1)).ConfigureAwait(false);
if (!validProcessId)
{
throw new NotFoundException($"process {processId} does not exist");
}

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

context.ScheduleProcessSteps(Enumerable.Repeat(nextStep, 1));
context.FinalizeProcessStep();
await _portalRepositories.SaveAsync().ConfigureAwait(false);
}
}
Loading

0 comments on commit 2348e52

Please sign in to comment.