Skip to content

Commit

Permalink
Merge pull request #488 from Strongminds/master
Browse files Browse the repository at this point in the history
12.1.4.1
  • Loading branch information
strongmindsmhs authored Dec 15, 2023
2 parents 775c3ac + f055b45 commit e6cad57
Show file tree
Hide file tree
Showing 94 changed files with 9,230 additions and 5,225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Core.ApplicationServices.Organizations.Handlers
{
public class AuthorizedUpdateOrganizationFromFKOrganisationCommandHandler : ICommandHandler<AuthorizedUpdateOrganizationFromFKOrganisationCommand, Maybe<OperationError>>
{
private readonly IStsOrganizationUnitService _stsOrganizationUnitService;
private readonly IStsOrganizationSystemService _stsOrganizationSystemService;
private readonly IGenericRepository<OrganizationUnit> _organizationUnitRepository;
private readonly ILogger _logger;
private readonly IDomainEvents _domainEvents;
Expand All @@ -28,7 +28,7 @@ public class AuthorizedUpdateOrganizationFromFKOrganisationCommandHandler : ICom
private readonly IGenericRepository<StsOrganizationChangeLog> _stsChangeLogRepository;

public AuthorizedUpdateOrganizationFromFKOrganisationCommandHandler(
IStsOrganizationUnitService stsOrganizationUnitService,
IStsOrganizationSystemService stsOrganizationSystemService,
IGenericRepository<OrganizationUnit> organizationUnitRepository,
ILogger logger,
IDomainEvents domainEvents,
Expand All @@ -38,7 +38,7 @@ public AuthorizedUpdateOrganizationFromFKOrganisationCommandHandler(
IOperationClock operationClock,
IGenericRepository<StsOrganizationChangeLog> stsChangeLogRepository)
{
_stsOrganizationUnitService = stsOrganizationUnitService;
_stsOrganizationSystemService = stsOrganizationSystemService;
_organizationUnitRepository = organizationUnitRepository;
_logger = logger;
_domainEvents = domainEvents;
Expand All @@ -59,7 +59,7 @@ public Maybe<OperationError> Execute(AuthorizedUpdateOrganizationFromFKOrganisat
//Load the external tree if not already provided
var organizationTree = command
.PreloadedExternalTree
.Match(tree => tree, () => _stsOrganizationUnitService.ResolveOrganizationTree(organization));
.Match(tree => tree, () => _stsOrganizationSystemService.ResolveOrganizationTree(organization));
if (organizationTree.Failed)
{
var error = organizationTree.Error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ namespace Core.ApplicationServices.Organizations.Handlers
public class ReportPendingFkOrganizationChangesToStakeHoldersHandler : ICommandHandler<ReportPendingFkOrganizationChangesToStakeHolders, Maybe<OperationError>>

{
private readonly IStsOrganizationUnitService _stsOrganizationUnitService;
private readonly IStsOrganizationSystemService _stsOrganizationSystemService;
private readonly ILogger _logger;
private readonly ITransactionManager _transactionManager;
private readonly IOperationClock _operationClock;
private readonly IDatabaseControl _databaseControl;
private readonly IDomainEvents _domainEvents;

public ReportPendingFkOrganizationChangesToStakeHoldersHandler(
IStsOrganizationUnitService stsOrganizationUnitService,
IStsOrganizationSystemService stsOrganizationSystemService,
ILogger logger,
ITransactionManager transactionManager,
IOperationClock operationClock,
IDatabaseControl databaseControl,
IDomainEvents domainEvents)
{
_stsOrganizationUnitService = stsOrganizationUnitService;
_stsOrganizationSystemService = stsOrganizationSystemService;
_logger = logger;
_transactionManager = transactionManager;
_operationClock = operationClock;
Expand All @@ -46,7 +46,7 @@ public Maybe<OperationError> Execute(ReportPendingFkOrganizationChangesToStakeHo
//Load the external tree if not already provided
var organization = command.Organization;
var connection = command.Connection;
var organizationTree = _stsOrganizationUnitService.ResolveOrganizationTree(organization);
var organizationTree = _stsOrganizationSystemService.ResolveOrganizationTree(organization);

if (organizationTree.Failed)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Core.ApplicationServices.Organizations
{
public class StsOrganizationSynchronizationService : IStsOrganizationSynchronizationService
{
private readonly IStsOrganizationUnitService _stsOrganizationUnitService;
private readonly IStsOrganizationSystemService _stsOrganizationSystemService;
private readonly IOrganizationService _organizationService;
private readonly ILogger _logger;
private readonly IStsOrganizationService _stsOrganizationService;
Expand All @@ -38,7 +38,7 @@ public class StsOrganizationSynchronizationService : IStsOrganizationSynchroniza

public StsOrganizationSynchronizationService(
IAuthorizationContext authorizationContext,
IStsOrganizationUnitService stsOrganizationUnitService,
IStsOrganizationSystemService stsOrganizationSystemService,
IOrganizationService organizationService,
ILogger logger,
IStsOrganizationService stsOrganizationService,
Expand All @@ -50,7 +50,7 @@ public StsOrganizationSynchronizationService(
IOperationClock operationClock,
ICommandBus commandBus)
{
_stsOrganizationUnitService = stsOrganizationUnitService;
_stsOrganizationSystemService = stsOrganizationSystemService;
_organizationService = organizationService;
_logger = logger;
_stsOrganizationService = stsOrganizationService;
Expand Down Expand Up @@ -188,7 +188,7 @@ public Result<IEnumerable<IExternalConnectionChangelog>, OperationError> GetChan

private Result<ExternalOrganizationUnit, OperationError> LoadOrganizationUnits(Organization organization)
{
return _stsOrganizationUnitService.ResolveOrganizationTree(organization).Match<Result<ExternalOrganizationUnit, OperationError>>(root => root, detailedOperationError => new OperationError($"Failed to load organization tree:{detailedOperationError.Detail:G}:{detailedOperationError.FailureType:G}:{detailedOperationError.Message}", detailedOperationError.FailureType));
return _stsOrganizationSystemService.ResolveOrganizationTree(organization).Match<Result<ExternalOrganizationUnit, OperationError>>(root => root, detailedOperationError => new OperationError($"Failed to load organization tree:{detailedOperationError.Detail:G}:{detailedOperationError.FailureType:G}:{detailedOperationError.Message}", detailedOperationError.FailureType));
}

private Result<Organization, OperationError> GetOrganizationWithImportPermission(Guid organizationId)
Expand Down
2 changes: 1 addition & 1 deletion Core.DomainServices/Core.DomainServices.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<Compile Include="Notifications\UserNotificationService.cs" />
<Compile Include="Organizations\IStsOrganizationCompanyLookupService.cs" />
<Compile Include="Organizations\IStsOrganizationService.cs" />
<Compile Include="Organizations\IStsOrganizationUnitService.cs" />
<Compile Include="Organizations\IStsOrganizationSystemService.cs" />
<Compile Include="Organizations\OrgUnitService.cs" />
<Compile Include="Model\StsOrganization\ResolveOrganizationUuidError.cs" />
<Compile Include="Queries\Contract\QueryBySupplierUuid.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Core.DomainServices.Organizations
{
public interface IStsOrganizationUnitService
public interface IStsOrganizationSystemService
{
Result<ExternalOrganizationUnit, DetailedOperationError<ResolveOrganizationTreeError>> ResolveOrganizationTree(Organization organization);
}
Expand Down
9 changes: 8 additions & 1 deletion DeploymentScripts/DeployWebsite.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Function Deploy-Website($packageDirectory, $msDeployUrl, $msDeployUser, $msDeployPassword, $logLevel, $esUrl, $securityKeyString, $smtpFromMail, $smtpNwHost, $resetPwTtl, $mailSuffix, $baseUrl, $kitosEnvName, $buildNumber, $kitosDbConnectionString, $hangfireConnectionString, $defaultUserPassword, $useDefaultUserPassword, $ssoServiceProviderServer, $ssoIDPEndPoints, $ssoServiceProviderId, $ssoCertificateThumbPrint, $stsOrganisationEndpointHost, $robotsFileName, $smtpNetworkPort, $smtpNetworkUsername, $smtpNetworkPassword) {

$msdeploy = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe";

#Base64 encode $kitosContext variable, and add base64: at the beggining
$kitosContext = "base64:" + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($kitosDbConnectionString))

#Base64 encode $hangfireConnectionString variable, and add base64: at the beggining
$hangfireContext = "base64:" + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($hangfireConnectionString))

$fullCommand=$(("`"{0}`" " +
"-verb:sync " +
"-source:package=`"{1}\Presentation.Web.zip`" " +
Expand Down Expand Up @@ -34,7 +41,7 @@ Function Deploy-Website($packageDirectory, $msDeployUrl, $msDeployUser, $msDeplo
"-setParam:name=`"SmtpPort`",value=`"{25}`" " +
"-setParam:name=`"SmtpUserName`",value=`"{26}`" " +
"-setParam:name=`"SmtpPassword`",value=`"{27}`"") `
-f $msdeploy, $packageDirectory, $msDeployUrl, $msDeployUser, $msDeployPassword, $logLevel, $esUrl, $securityKeyString, $smtpFromMail, $smtpNwHost, $resetPwTtl, $baseUrl, $mailSuffix, $kitosEnvName, $buildNumber, $kitosDbConnectionString, $hangfireConnectionString, $defaultUserPassword, $useDefaultUserPassword, $ssoServiceProviderServer, $ssoIDPEndPoints, $ssoServiceProviderId, $ssoCertificateThumbPrint, $stsOrganisationEndpointHost, $robotsFileName, $smtpNetworkPort, $smtpNetworkUsername, $smtpNetworkPassword)
-f $msdeploy, $packageDirectory, $msDeployUrl, $msDeployUser, $msDeployPassword, $logLevel, $esUrl, $securityKeyString, $smtpFromMail, $smtpNwHost, $resetPwTtl, $baseUrl, $mailSuffix, $kitosEnvName, $buildNumber, $kitosContext, $hangfireContext, $defaultUserPassword, $useDefaultUserPassword, $ssoServiceProviderServer, $ssoIDPEndPoints, $ssoServiceProviderId, $ssoCertificateThumbPrint, $stsOrganisationEndpointHost, $robotsFileName, $smtpNetworkPort, $smtpNetworkUsername, $smtpNetworkPassword)

& cmd.exe /C $fullCommand

Expand Down
2 changes: 2 additions & 0 deletions Infrastructure.DataAccess/Infrastructure.DataAccess.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
Expand Down Expand Up @@ -1054,6 +1055,7 @@
<Compile Include="Services\PocoTypeFromProxyResolver.cs" />
<Compile Include="Services\WithinAmbienTransaction.cs" />
<Compile Include="Services\TransactionManager.cs" />
<Compile Include="Tools\ConnectionStringTools.cs" />
<Compile Include="Tools\SqlMigrationScriptRepository.cs" />
<Compile Include="TypeConfigurationExtensions.cs" />
<Compile Include="TypeMapping.cs" />
Expand Down
5 changes: 3 additions & 2 deletions Infrastructure.DataAccess/KitosContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
using Core.DomainModel.Notification;
using Core.DomainModel.Tracking;
using Core.DomainModel.UIConfiguration;
using Infrastructure.DataAccess.Tools;

namespace Infrastructure.DataAccess
{
public class KitosContext : DbContext
{
public KitosContext() : this("KitosContext") { }

public KitosContext() : this(ConnectionStringTools.GetConnectionString("KitosContext")) { }
public KitosContext(string nameOrConnectionString)
: base(nameOrConnectionString)
{
Expand Down
19 changes: 19 additions & 0 deletions Infrastructure.DataAccess/Tools/ConnectionStringTools.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;

namespace Infrastructure.DataAccess.Tools
{
public class ConnectionStringTools
{
public static string GetConnectionString(string dbName)
{
var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings[dbName]?.ConnectionString ?? dbName;
if (!connectionString.StartsWith("base64:"))
return connectionString;

var base64EncodedString = connectionString.Substring("base64:".Length);
var base64EncodedBytes = Convert.FromBase64String(base64EncodedString);
connectionString = System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
return connectionString;
}
}
}
2 changes: 2 additions & 0 deletions Infrastructure.Ninject/Infrastructure.Ninject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Ninject, Version=3.3.6.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<schema xmlns:sts="urn:oio:sts:1.1.3.0" xmlns:sd="urn:oio:sagdok:3.0.0" xmlns:adresse="urn:oio:sts:organisation:adresse:1.1.3.0" xmlns:oio="urn:oio:definitions:1.0.0" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:oio:sts:organisation:adresse:1.1.3.0" oio:mapping="urn:oio:sagdok:MPD:3.0.0" xmlns="http://www.w3.org/2001/XMLSchema">
<import schemaLocation="../common/SagDokObjekt.xsd" namespace="urn:oio:sagdok:3.0.0" />
<import schemaLocation="GenerelleDefinitioner.xsd" namespace="urn:oio:sts:1.1.3.0" />
<element oio:definition="urn:oio:sagdok:adresse:ADD:2.0.0" name="Adresse" type="adresse:AdresseType" />
<complexType oio:definition="urn:oio:sagdok:adresse:ADD:2.0.0" name="AdresseType">
<complexContent mixed="false">
<extension base="sd:SagDokObjektType">
<sequence>
<element oio:content="registreringer" maxOccurs="unbounded" ref="adresse:Registrering" />
</sequence>
</extension>
</complexContent>
</complexType>
<element oio:definition="urn:oio:sagdok:adresseattributliste:ADD:2.0.0" name="AttributListe" type="adresse:AttributListeType" />
<complexType oio:definition="urn:oio:sagdok:adresseattributliste:ADD:2.0.0" name="AttributListeType">
<sequence>
<element oio:content="egenskaber" minOccurs="0" maxOccurs="unbounded" ref="adresse:Egenskab" />
</sequence>
</complexType>
<element oio:definition="urn:oio:sagdok:adressetilstandliste:ADD:2.0.0" name="TilstandListe" type="adresse:TilstandListeType" />
<complexType oio:definition="urn:oio:sagdok:adressetilstandliste:ADD:2.0.0" name="TilstandListeType">
<sequence />
</complexType>
<element oio:definition="urn:oio:sagdok:adresserelationliste:ADD:2.0.0" name="RelationListe" type="adresse:RelationListeType" />
<complexType oio:definition="urn:oio:sagdok:adresserelationliste:ADD:2.0.0" name="RelationListeType">
<sequence />
</complexType>
<element oio:definition="urn:oio:sagdok:adresseregistrering:ADD:2.0.0" name="Registrering" type="adresse:RegistreringType" />
<complexType oio:definition="urn:oio:sagdok:adresseregistrering:ADD:2.0.0" name="RegistreringType">
<complexContent mixed="false">
<extension base="sd:RegistreringType">
<sequence>
<element oio:content="attributter" ref="adresse:AttributListe" />
<element oio:content="tilstande" ref="adresse:TilstandListe" />
<element oio:content="relationer" ref="adresse:RelationListe" />
</sequence>
</extension>
</complexContent>
</complexType>
<element oio:definition="urn:oio:sagdok:adresseegenskaber:ADD:1.0.0" name="Egenskab" type="adresse:EgenskabType" />
<complexType oio:definition="urn:oio:sagdok:adresseegenskaber:ADD:1.0.0" name="EgenskabType">
<sequence>
<element oio:content="virkning" minOccurs="0" ref="sd:Virkning" />
<element oio:content="brugervendtnoegle" minOccurs="0" ref="sd:BrugervendtNoegleTekst" />
<element oio:content="adresse" minOccurs="0" ref="sts:AdresseTekst" />
</sequence>
</complexType>
</schema>
Loading

0 comments on commit e6cad57

Please sign in to comment.