From 9174935c7161117c19e5b360b8d03c0ac0241968 Mon Sep 17 00:00:00 2001 From: Karsten Thiems <150006841+typecastcloud@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:47:43 +0200 Subject: [PATCH 1/7] feat(tech user): add internal invitation tech user Allows adding technical user for invitation api as CX Operator. Refs: eclipse-tractusx/portal-backend#932 --- .../Seeder/Data/user_role_assigned_collections.json | 4 ++++ .../Seeder/Data/user_role_descriptions.json | 10 ++++++++++ .../Seeder/Data/user_roles.json | 6 ++++++ .../CompanyRoleCollectionRolesViewTests.cs | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_role_assigned_collections.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_role_assigned_collections.json index 7a398fa23e..3719f30efd 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_role_assigned_collections.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_role_assigned_collections.json @@ -31,6 +31,10 @@ "user_role_id": "607818be-4978-41f4-bf63-fa6d2de51262", "user_role_collection_id": "1a24eca5-901f-4191-84a7-4ef09a894575" }, + { + "user_role_id": "34c42896-a003-4653-af8f-ba06ca595754", + "user_role_collection_id": "1a24eca5-901f-4191-84a7-4ef09a894575" + }, { "user_role_id": "58f897ec-0aad-4588-8ffa-5f45d6638633", "user_role_collection_id": "8cb12ea2-aed4-4d75-b041-ba297df3d2f2" diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_role_descriptions.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_role_descriptions.json index 879d177b50..1c4b9e622e 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_role_descriptions.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_role_descriptions.json @@ -258,5 +258,15 @@ "user_role_id": "c01818be-4978-41f4-bf63-fa6d2de53267", "language_short_name": "en", "description": "BPDM Pool Sharing Consumer" + }, + { + "user_role_id": "34c42896-a003-4653-af8f-ba06ca595754", + "language_short_name": "de", + "description": "Technischer User für die Invitation API zur Integration von Drittanbieter-Software." + }, + { + "user_role_id": "34c42896-a003-4653-af8f-ba06ca595754", + "language_short_name": "en", + "description": "Technical user enabling the invitation API to integrate 3rd party software." } ] diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_roles.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_roles.json index 3ee20a0609..854f7655b6 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_roles.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_roles.json @@ -160,5 +160,11 @@ "user_role": "BPDM Pool Sharing Consumer", "offer_id": "0ffcb416-1101-4ba6-8d4a-a9dfa31745a4", "last_editor_id": null + }, + { + "id": "34c42896-a003-4653-af8f-ba06ca595754", + "user_role": "Registration Internal", + "offer_id": "9b957704-3505-4445-822c-d7ef80f27fcd", + "last_editor_id": null } ] diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanyRoleCollectionRolesViewTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanyRoleCollectionRolesViewTests.cs index d8a86d112d..f27af43a74 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanyRoleCollectionRolesViewTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanyRoleCollectionRolesViewTests.cs @@ -45,7 +45,7 @@ public async Task CompanyRoleCollectionRolesView_GetAll_ReturnsExpected() // Act var result = await sut.CompanyRoleCollectionRolesView.ToListAsync(); - result.Should().HaveCount(56); + result.Should().HaveCount(57); } [Fact] From 2de7c396671d711eaff9f1c5c46bc975c02a95ae Mon Sep 17 00:00:00 2001 From: Karsten Thiems <150006841+typecastcloud@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:44:32 +0200 Subject: [PATCH 2/7] Update offer id for Registration Internal Use "Technical User Management" instead of "Portal". --- .../PortalBackend.Migrations/Seeder/Data/user_roles.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_roles.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_roles.json index 854f7655b6..6265354c59 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_roles.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/user_roles.json @@ -164,7 +164,7 @@ { "id": "34c42896-a003-4653-af8f-ba06ca595754", "user_role": "Registration Internal", - "offer_id": "9b957704-3505-4445-822c-d7ef80f27fcd", + "offer_id": "0ffcb416-1101-4ba6-8d4a-a9dfa31745a4", "last_editor_id": null } ] From 788e055157066c710041832359ec2b49a197385a Mon Sep 17 00:00:00 2001 From: Karsten Thiems <150006841+typecastcloud@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:57:02 +0200 Subject: [PATCH 3/7] Update test cases Technical User Management as offer id in Registration Internal requires updated tests. --- .../PortalBackend.DBAccess.Tests/CompanyRepositoryTests.cs | 2 +- .../PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanyRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanyRepositoryTests.cs index b56259eb7d..6fd014eb57 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanyRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanyRepositoryTests.cs @@ -688,7 +688,7 @@ public async Task GetCompanyIdAndBpnForIamUserUntrackedAsync_WithValidData_Retur // Assert result.Should().NotBe(default); result.Bpn.Should().Be("BPNL00000003CRHK"); - result.TechnicalUserRoleIds.Should().HaveCount(13).And.OnlyHaveUniqueItems(); + result.TechnicalUserRoleIds.Should().HaveCount(14).And.OnlyHaveUniqueItems(); } #endregion diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs index 38e6421a67..c069fb979f 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs @@ -57,7 +57,7 @@ public async Task GetCoreOfferRolesAsync_WithValidData_ReturnsExpected() var data = await sut.GetCoreOfferRolesAsync(_validCompanyId, "en", ClientId).ToListAsync(); // Assert - data.Should().HaveCount(13); + data.Should().HaveCount(14); } #endregion @@ -135,7 +135,7 @@ public async Task GetServiceAccountRolesAsync_WithValidData_ReturnsExpected() var data = await sut.GetServiceAccountRolesAsync(_validCompanyId, ClientId, Enumerable.Repeat(new Guid("607818be-4978-41f4-bf63-fa8d2de51157"), 1), Constants.DefaultLanguage).ToListAsync(); // Assert - data.Should().HaveCount(13); + data.Should().HaveCount(14); data.Should().OnlyHaveUniqueItems(); data.Where(x => x.RoleType == UserRoleType.Internal).Should().HaveCount(12); data.Where(x => x.RoleType == UserRoleType.External).Should().ContainSingle(); From 927bc1ac00b4bb322c16ee9e762045ff5f37fc6e Mon Sep 17 00:00:00 2001 From: Karsten Thiems <150006841+typecastcloud@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:09:05 +0200 Subject: [PATCH 4/7] Add changelog entry --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5beff5ba74..8f89e1443b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,9 @@ New features, fixed bugs, known defects and other noteworthy changes to each rel * **Invitation** * enabled creation of application and company on invite to remove the delay of the company application after invite [#960](https://github.com/eclipse-tractusx/portal-backend/pull/960) * allowed access to invitation endpoint to technical user [#933](https://github.com/eclipse-tractusx/portal-backend/pull/933) -* **Technical User**: new parameters for api expansion for technical user data [#997](https://github.com/eclipse-tractusx/portal-backend/pull/997) +* **Technical User** + * new parameters for api expansion for technical user data [#997](https://github.com/eclipse-tractusx/portal-backend/pull/997) + * add Registration Internal as Operator technical user for invite API [#1002](https://github.com/eclipse-tractusx/portal-backend/pull/1002) * **Administration**: introduced validating og bpn before adding to company user [#902](https://github.com/eclipse-tractusx/portal-backend/pull/902) * **Business Partner Data Management**: add sharing state ready toggle [#905](https://github.com/eclipse-tractusx/portal-backend/pull/905) @@ -1391,4 +1393,4 @@ n/a * Feature - DB enhancements (User "DELETE" enum, creation of service tables, etc.) * Feature - App Release Management PUT endpoint implementation for "CREATE App" and "App Details" * Feature - Static Data endpoints implemented - GET use cases, language, company data -* Feature - DB Auditing released for app subscription, company user, company application, user assigned roles \ No newline at end of file +* Feature - DB Auditing released for app subscription, company user, company application, user assigned roles From 053f90a4b59ebafae25c64df7088a611197c6372 Mon Sep 17 00:00:00 2001 From: Karsten Thiems <150006841+typecastcloud@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:03:43 +0200 Subject: [PATCH 5/7] Revert "Add changelog entry" This reverts commit 927bc1ac00b4bb322c16ee9e762045ff5f37fc6e. --- CHANGELOG.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f89e1443b..5beff5ba74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,9 +12,7 @@ New features, fixed bugs, known defects and other noteworthy changes to each rel * **Invitation** * enabled creation of application and company on invite to remove the delay of the company application after invite [#960](https://github.com/eclipse-tractusx/portal-backend/pull/960) * allowed access to invitation endpoint to technical user [#933](https://github.com/eclipse-tractusx/portal-backend/pull/933) -* **Technical User** - * new parameters for api expansion for technical user data [#997](https://github.com/eclipse-tractusx/portal-backend/pull/997) - * add Registration Internal as Operator technical user for invite API [#1002](https://github.com/eclipse-tractusx/portal-backend/pull/1002) +* **Technical User**: new parameters for api expansion for technical user data [#997](https://github.com/eclipse-tractusx/portal-backend/pull/997) * **Administration**: introduced validating og bpn before adding to company user [#902](https://github.com/eclipse-tractusx/portal-backend/pull/902) * **Business Partner Data Management**: add sharing state ready toggle [#905](https://github.com/eclipse-tractusx/portal-backend/pull/905) @@ -1393,4 +1391,4 @@ n/a * Feature - DB enhancements (User "DELETE" enum, creation of service tables, etc.) * Feature - App Release Management PUT endpoint implementation for "CREATE App" and "App Details" * Feature - Static Data endpoints implemented - GET use cases, language, company data -* Feature - DB Auditing released for app subscription, company user, company application, user assigned roles +* Feature - DB Auditing released for app subscription, company user, company application, user assigned roles \ No newline at end of file From 1778a7294e946a5234c1e07bb436bcad916a242d Mon Sep 17 00:00:00 2001 From: Karsten Thiems <150006841+typecastcloud@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:07:03 +0200 Subject: [PATCH 6/7] Add changelog for unreleased feature --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5beff5ba74..a278c4f798 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ New features, fixed bugs, known defects and other noteworthy changes to each release of the Catena-X Portal Backend. +## Unreleased + +## Feature + +* **Technical User** + * add Registration Internal as Operator technical user for invite API [#1002](https://github.com/eclipse-tractusx/portal-backend/pull/1002) + ## 2.3.0-alpha.1 ## Feature From bb3f40a3edac1ec64fb388dc8efc1f8c860042bb Mon Sep 17 00:00:00 2001 From: Karsten Thiems <150006841+typecastcloud@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:28:29 +0200 Subject: [PATCH 7/7] Update new test Co-authored-by: Norbert Truchsess --- .../PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs index c069fb979f..b8ea838d09 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/UserRolesRepositoryTests.cs @@ -137,7 +137,7 @@ public async Task GetServiceAccountRolesAsync_WithValidData_ReturnsExpected() // Assert data.Should().HaveCount(14); data.Should().OnlyHaveUniqueItems(); - data.Where(x => x.RoleType == UserRoleType.Internal).Should().HaveCount(12); + data.Where(x => x.RoleType == UserRoleType.Internal).Should().HaveCount(13); data.Where(x => x.RoleType == UserRoleType.External).Should().ContainSingle(); }