From 308bd555a412f7afc7ecd58605a0f21067c7e74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Tom=C3=A9?= <108268980+r-tome@users.noreply.github.com> Date: Fri, 7 Jun 2024 19:32:09 +0100 Subject: [PATCH] =?UTF-8?q?[AC-2286]=C2=A0Include=20the=20OrganizationUser?= =?UTF-8?q?Id=20for=20each=20Organization=20in=20the=20user=20sync=20data?= =?UTF-8?q?=20(#4142)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [AC-2286] Include the OrganizationUserId for each Organization in the user sync data * Make OrganizationUserId property non-nullable --- .../ProfileOrganizationResponseModel.cs | 2 + .../OrganizationUserOrganizationDetails.cs | 1 + ...izationUserOrganizationDetailsViewQuery.cs | 1 + ...rganizationUserOrganizationDetailsView.sql | 1 + .../OrganizationUserRepositoryTests.cs | 78 ++++++++++++++++++ ...rganizationDetailsView_AddOrgUserIdCol.sql | 81 +++++++++++++++++++ 6 files changed, 164 insertions(+) create mode 100644 util/Migrator/DbScripts/2024-05-30_00_OrganizationUserOrganizationDetailsView_AddOrgUserIdCol.sql diff --git a/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs b/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs index 55c1d9cb1..ed75de7bf 100644 --- a/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs +++ b/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs @@ -48,6 +48,7 @@ public class ProfileOrganizationResponseModel : ResponseModel Permissions = CoreHelpers.LoadClassFromJsonData(organization.Permissions); ResetPasswordEnrolled = organization.ResetPasswordKey != null; UserId = organization.UserId; + OrganizationUserId = organization.OrganizationUserId; ProviderId = organization.ProviderId; ProviderName = organization.ProviderName; ProviderType = organization.ProviderType; @@ -138,6 +139,7 @@ public class ProfileOrganizationResponseModel : ResponseModel public Permissions Permissions { get; set; } public bool ResetPasswordEnrolled { get; set; } public Guid? UserId { get; set; } + public Guid OrganizationUserId { get; set; } public bool HasPublicAndPrivateKeys { get; set; } public Guid? ProviderId { get; set; } [JsonConverter(typeof(HtmlEncodingStringConverter))] diff --git a/src/Core/AdminConsole/Models/Data/Organizations/OrganizationUsers/OrganizationUserOrganizationDetails.cs b/src/Core/AdminConsole/Models/Data/Organizations/OrganizationUsers/OrganizationUserOrganizationDetails.cs index 383505af4..141076df3 100644 --- a/src/Core/AdminConsole/Models/Data/Organizations/OrganizationUsers/OrganizationUserOrganizationDetails.cs +++ b/src/Core/AdminConsole/Models/Data/Organizations/OrganizationUsers/OrganizationUserOrganizationDetails.cs @@ -8,6 +8,7 @@ public class OrganizationUserOrganizationDetails { public Guid OrganizationId { get; set; } public Guid? UserId { get; set; } + public Guid OrganizationUserId { get; set; } [JsonConverter(typeof(HtmlEncodingStringConverter))] public string Name { get; set; } public bool UsePolicies { get; set; } diff --git a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/Queries/OrganizationUserOrganizationDetailsViewQuery.cs b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/Queries/OrganizationUserOrganizationDetailsViewQuery.cs index 5465a0f86..965e1d879 100644 --- a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/Queries/OrganizationUserOrganizationDetailsViewQuery.cs +++ b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/Queries/OrganizationUserOrganizationDetailsViewQuery.cs @@ -23,6 +23,7 @@ public class OrganizationUserOrganizationDetailsViewQuery : IQuery