From be8f1d7c5f1cad45ac55e38130b02d68c0c4071a Mon Sep 17 00:00:00 2001 From: "Dhirender Singh (Cofinity-X)" <144212607+dhiren-singh-007@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:57:17 +0200 Subject: [PATCH] fix(OSP Invite): handle theme for shared realm (#852) https://github.com/eclipse-tractusx/portal-backend/issues/848 --- .../Repositories/ApplicationRepository.cs | 4 ++-- .../Repositories/IApplicationRepository.cs | 2 +- .../ApplicationActivationService.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationRepository.cs index e28337c649..fe7a37738a 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/ApplicationRepository.cs @@ -206,7 +206,7 @@ public IQueryable GetExternalCompanyApplicationsFilteredQuer .SingleOrDefaultAsync(); /// - public Task<(Guid CompanyId, string CompanyName, string? BusinessPartnerNumber, IEnumerable IamIdpAliasse, CompanyApplicationTypeId ApplicationTypeId, Guid? NetworkRegistrationProcessId)> GetCompanyAndApplicationDetailsForApprovalAsync(Guid applicationId) => + public Task<(Guid CompanyId, string CompanyName, string? BusinessPartnerNumber, IEnumerable SharedIdpAliase, CompanyApplicationTypeId ApplicationTypeId, Guid? NetworkRegistrationProcessId)> GetCompanyAndApplicationDetailsForApprovalAsync(Guid applicationId) => portalDbContext.CompanyApplications.Where(companyApplication => companyApplication.Id == applicationId && companyApplication.ApplicationStatusId == CompanyApplicationStatusId.SUBMITTED) @@ -214,7 +214,7 @@ public IQueryable GetExternalCompanyApplicationsFilteredQuer ca.CompanyId, ca.Company!.Name, ca.Company.BusinessPartnerNumber, - ca.Company.IdentityProviders.Select(x => x.IamIdentityProvider!.IamIdpAlias), + ca.Company.IdentityProviders.Where(x => x.IdentityProviderTypeId == IdentityProviderTypeId.SHARED && x.IamIdentityProvider != null).Select(x => x.IamIdentityProvider!.IamIdpAlias), ca.CompanyApplicationTypeId, ca.CompanyApplicationTypeId == CompanyApplicationTypeId.EXTERNAL ? ca.Company.NetworkRegistration!.ProcessId : diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/IApplicationRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/IApplicationRepository.cs index e82b9f21fc..15d068306c 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/IApplicationRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/IApplicationRepository.cs @@ -38,7 +38,7 @@ public interface IApplicationRepository Task GetCompanyApplicationDetailDataAsync(Guid applicationId, Guid userCompanyId, Guid? companyId); Task<(string CompanyName, string? FirstName, string? LastName, string? Email, IEnumerable<(Guid ApplicationId, CompanyApplicationStatusId ApplicationStatusId, IEnumerable<(string? FirstName, string? LastName, string? Email)> InvitedUsers)> Applications)> GetCompanyApplicationsDeclineData(Guid companyUserId, IEnumerable applicationStatusIds); Task<(bool IsValidApplicationId, Guid CompanyId, bool IsSubmitted)> GetCompanyIdSubmissionStatusForApplication(Guid applicationId); - Task<(Guid CompanyId, string CompanyName, string? BusinessPartnerNumber, IEnumerable IamIdpAliasse, CompanyApplicationTypeId ApplicationTypeId, Guid? NetworkRegistrationProcessId)> GetCompanyAndApplicationDetailsForApprovalAsync(Guid applicationId); + Task<(Guid CompanyId, string CompanyName, string? BusinessPartnerNumber, IEnumerable SharedIdpAliase, CompanyApplicationTypeId ApplicationTypeId, Guid? NetworkRegistrationProcessId)> GetCompanyAndApplicationDetailsForApprovalAsync(Guid applicationId); Task<(Guid CompanyId, string CompanyName, string? BusinessPartnerNumber)> GetCompanyAndApplicationDetailsForCreateWalletAsync(Guid applicationId); IAsyncEnumerable GetInvitedUsersDataByApplicationIdUntrackedAsync(Guid applicationId); IAsyncEnumerable GetEmailDataUntrackedAsync(Guid applicationId); diff --git a/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs b/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs index 8672b2aedf..32ba5df5a0 100644 --- a/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs +++ b/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs @@ -90,7 +90,7 @@ public ApplicationActivationService( throw new ConflictException($"CompanyApplication {context.ApplicationId} is not in status SUBMITTED"); } - var (companyId, companyName, businessPartnerNumber, iamIdpAliasse, applicationTypeId, networkRegistrationProcessId) = result; + var (companyId, companyName, businessPartnerNumber, sharedIdpAliase, applicationTypeId, networkRegistrationProcessId) = result; if (string.IsNullOrWhiteSpace(businessPartnerNumber)) { throw new ConflictException($"BusinessPartnerNumber (bpn) for CompanyApplications {context.ApplicationId} company {companyId} is empty"); @@ -99,7 +99,7 @@ public ApplicationActivationService( var userRolesRepository = _portalRepositories.GetInstance(); var assignedRoles = await AssignRolesAndBpn(context.ApplicationId, userRolesRepository, applicationRepository, businessPartnerNumber).ConfigureAwait(ConfigureAwaitOptions.None); await RemoveRegistrationRoles(context.ApplicationId, userRolesRepository).ConfigureAwait(ConfigureAwaitOptions.None); - await SetTheme(iamIdpAliasse).ConfigureAwait(ConfigureAwaitOptions.None); + await SetTheme(sharedIdpAliase).ConfigureAwait(ConfigureAwaitOptions.None); applicationRepository.AttachAndModifyCompanyApplication(context.ApplicationId, ca => {