Application User setup WIP
This commit is contained in:
parent
c83442b4af
commit
cb6dd39596
16 changed files with 362 additions and 314 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Core\Core.csproj" />
|
<ProjectReference Include="..\Core\Core.csproj" />
|
||||||
|
<ProjectReference Include="..\Database\Database.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace PlanTempus
|
||||||
}
|
}
|
||||||
public void ConfigureContainer(ContainerBuilder builder)
|
public void ConfigureContainer(ContainerBuilder builder)
|
||||||
{
|
{
|
||||||
builder.RegisterModule(new Core.ModuleRegistry.DbPostgreSqlModule
|
builder.RegisterModule(new Database.ModuleRegistry.DbPostgreSqlModule
|
||||||
{
|
{
|
||||||
ConnectionString = ConfigurationRoot.GetConnectionString("ptdb")
|
ConnectionString = ConfigurationRoot.GetConnectionString("ptdb")
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
using Autofac;
|
|
||||||
using Npgsql;
|
|
||||||
using System.Data;
|
|
||||||
namespace Core.ModuleRegistry
|
|
||||||
{
|
|
||||||
public class DbPostgreSqlModule : Module
|
|
||||||
{
|
|
||||||
public required string ConnectionString { get; set; }
|
|
||||||
protected override void Load(ContainerBuilder builder)
|
|
||||||
{
|
|
||||||
Insight.Database.Providers.PostgreSQL.PostgreSQLInsightDbProvider.RegisterProvider();
|
|
||||||
|
|
||||||
builder.Register(c =>
|
|
||||||
{
|
|
||||||
IDbConnection connection = new NpgsqlConnection(ConnectionString);
|
|
||||||
return connection;
|
|
||||||
})
|
|
||||||
.InstancePerLifetimeScope();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,66 +6,66 @@ using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel;
|
||||||
|
|
||||||
namespace Core.ModuleRegistry
|
namespace Core.ModuleRegistry
|
||||||
{
|
{
|
||||||
public class TelemetryModule : Module
|
public class TelemetryModule : Module
|
||||||
{
|
{
|
||||||
public TelemetryConfig TelemetryConfig { get; set; }
|
public TelemetryConfig TelemetryConfig { get; set; }
|
||||||
protected override void Load(ContainerBuilder builder)
|
protected override void Load(ContainerBuilder builder)
|
||||||
{
|
{
|
||||||
if (TelemetryConfig == null)
|
if (TelemetryConfig == null)
|
||||||
throw new Exceptions.ConfigurationException("TelemetryConfig is missing");
|
throw new Exceptions.ConfigurationException("TelemetryConfig is missing");
|
||||||
|
|
||||||
//builder.Register(c =>
|
//builder.Register(c =>
|
||||||
//{
|
//{
|
||||||
// var channel = new Telemetry.DualTelemetryChannel("C:\\logs\\telemetry.log");
|
// var channel = new Telemetry.DualTelemetryChannel("C:\\logs\\telemetry.log");
|
||||||
// channel.DeveloperMode = true;
|
// channel.DeveloperMode = true;
|
||||||
// var config = new TelemetryConfiguration
|
// var config = new TelemetryConfiguration
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// ConnectionString = TelemetryConfig.ConnectionString,
|
// ConnectionString = TelemetryConfig.ConnectionString,
|
||||||
// TelemetryChannel = channel
|
// TelemetryChannel = channel
|
||||||
// };
|
// };
|
||||||
// return new TelemetryClient(config);
|
// return new TelemetryClient(config);
|
||||||
//}).InstancePerLifetimeScope();
|
//}).InstancePerLifetimeScope();
|
||||||
|
|
||||||
var telemetryChannel = new InMemoryChannel
|
var telemetryChannel = new InMemoryChannel
|
||||||
{
|
{
|
||||||
DeveloperMode = true
|
DeveloperMode = true
|
||||||
};
|
};
|
||||||
|
|
||||||
//var configuration = new TelemetryConfiguration
|
//var configuration = new TelemetryConfiguration
|
||||||
//{
|
//{
|
||||||
// ConnectionString = TelemetryConfig.ConnectionString,
|
// ConnectionString = TelemetryConfig.ConnectionString,
|
||||||
// TelemetryChannel = telemetryChannel
|
// TelemetryChannel = telemetryChannel
|
||||||
//};
|
//};
|
||||||
|
|
||||||
//telemetryChannel.Initialize(configuration);
|
//telemetryChannel.Initialize(configuration);
|
||||||
|
|
||||||
|
|
||||||
var tmc = Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.CreateDefault();
|
var tmc = Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.CreateDefault();
|
||||||
tmc.ConnectionString = TelemetryConfig.ConnectionString;
|
tmc.ConnectionString = TelemetryConfig.ConnectionString;
|
||||||
tmc.TelemetryChannel.DeveloperMode = true;
|
tmc.TelemetryChannel.DeveloperMode = true;
|
||||||
var channel = new Telemetry.DebugTelemetryChannel("C:\\logs\\telemetry.log");
|
var channel = new Telemetry.DebugTelemetryChannel("C:\\logs\\telemetry.log");
|
||||||
|
|
||||||
tmc.TelemetryChannel = channel;
|
tmc.TelemetryChannel = channel;
|
||||||
|
|
||||||
////var r = new Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryProcessorChainBuilder(tmc);
|
////var r = new Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryProcessorChainBuilder(tmc);
|
||||||
////r.Use(next => new Domain.EventTelemetryEnrichers.EnrichWithMetaTelemetry(next));
|
////r.Use(next => new Domain.EventTelemetryEnrichers.EnrichWithMetaTelemetry(next));
|
||||||
////r.Build();
|
////r.Build();
|
||||||
|
|
||||||
//builder.RegisterInstance(configuration);
|
//builder.RegisterInstance(configuration);
|
||||||
builder.Register(c => new TelemetryClient(tmc)).InstancePerLifetimeScope();
|
builder.Register(c => new TelemetryClient(tmc)).InstancePerLifetimeScope();
|
||||||
|
|
||||||
//builder.RegisterType<Microsoft.ApplicationInsights.TelemetryClient>()
|
//builder.RegisterType<Microsoft.ApplicationInsights.TelemetryClient>()
|
||||||
// .InstancePerLifetimeScope();
|
// .InstancePerLifetimeScope();
|
||||||
|
|
||||||
//builder.RegisterType<Microsoft.ApplicationInsights.TelemetryClient>()
|
//builder.RegisterType<Microsoft.ApplicationInsights.TelemetryClient>()
|
||||||
// .As<Telemetry.ITelemetryClient>()
|
// .As<Telemetry.ITelemetryClient>()
|
||||||
// .InstancePerLifetimeScope();
|
// .InstancePerLifetimeScope();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TelemetryConfig
|
public class TelemetryConfig
|
||||||
{
|
{
|
||||||
public string ConnectionString { get; set; }
|
public string ConnectionString { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,35 +2,42 @@
|
||||||
using Database.Common;
|
using Database.Common;
|
||||||
using Insight.Database;
|
using Insight.Database;
|
||||||
|
|
||||||
namespace Database.Core.DataControlLanguage
|
namespace Database.Core.DCL
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only a superadmin or similar can create Application Users
|
/// Only a superadmin or similar can create Application Users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SetupApplicationUser
|
public class SetupApplicationUser : IDbConfigure<SetupApplicationUser.Command>
|
||||||
{
|
{
|
||||||
|
public class Command
|
||||||
|
{
|
||||||
|
public required string Schema { get; init; }
|
||||||
|
public required string User { get; init; }
|
||||||
|
public required string Password { get; init; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IDbConnection _db;
|
IDbConnection _db;
|
||||||
string _schema;
|
Command _command;
|
||||||
string _user;
|
|
||||||
string _password;
|
|
||||||
|
|
||||||
public SetupApplicationUser(IDbConnection db)
|
public SetupApplicationUser(IDbConnection db)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateUserWithSchemaInDatabase(string schema, string user, string password)
|
public void Setup(string schema = null)
|
||||||
{
|
{
|
||||||
_schema = schema;
|
throw new NotImplementedException();
|
||||||
_password = password;
|
}
|
||||||
_user = user;
|
public void With(Command command)
|
||||||
|
{
|
||||||
|
_command = command;
|
||||||
|
|
||||||
if (!Validations.IsValidSchemaName(_schema))
|
if (!Validations.IsValidSchemaName(_command.Schema))
|
||||||
throw new ArgumentException("Invalid schema name", _schema);
|
throw new ArgumentException("Invalid schema name", _command.Schema);
|
||||||
|
|
||||||
using (var transaction = _db.BeginTransaction())
|
using (var transaction = _db.OpenWithTransaction())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -55,32 +62,56 @@ namespace Database.Core.DataControlLanguage
|
||||||
|
|
||||||
private void CreateSchema()
|
private void CreateSchema()
|
||||||
{
|
{
|
||||||
var sql = $"CREATE SCHEMA IF NOT EXISTS {_schema}";
|
var sql = $"CREATE SCHEMA IF NOT EXISTS {_command.Schema}";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateRole()
|
private void CreateRole()
|
||||||
{
|
{
|
||||||
var sql = $"CREATE ROLE {_user} WITH CREATEDB CREATEROLE LOGIN PASSWORD '{_password}';";
|
var sql = $@"
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '{_command.User}') THEN
|
||||||
|
CREATE ROLE {_command.User} WITH CREATEDB CREATEROLE LOGIN PASSWORD '{_command.Password}';
|
||||||
|
END IF;
|
||||||
|
END $$;";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
|
|
||||||
var sql1 = $"ALTER ROLE {_user} SET search_path='{_schema}';";
|
var sql1 = $"ALTER ROLE {_command.User} SET search_path='{_command.Schema}';";
|
||||||
ExecuteSql(sql1);
|
ExecuteSql(sql1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GrantSchemaRights()
|
private void GrantSchemaRights()
|
||||||
{
|
{
|
||||||
var sql = $"GRANT USAGE ON SCHEMA {_schema} TO {_user};";
|
// Grant USAGE og alle CREATE rettigheder på schema niveau
|
||||||
|
var sql = $@"
|
||||||
|
GRANT USAGE ON SCHEMA {_command.Schema} TO {_command.User};
|
||||||
|
GRANT ALL ON SCHEMA {_command.Schema} TO {_command.User};";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
|
|
||||||
var sql1 = $"ALTER DEFAULT PRIVILEGES IN SCHEMA {_schema} " +
|
// Grant rettigheder på eksisterende og fremtidige tabeller
|
||||||
$"GRANT INSERT, SELECT, UPDATE PRIVILEGES ON TABLES TO {_user};";
|
var sql1 = $"GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA {_command.Schema} TO {_command.User};";
|
||||||
ExecuteSql(sql1);
|
ExecuteSql(sql1);
|
||||||
|
|
||||||
var sql2 = $"GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA {_schema} TO {_user};";
|
var sql2 = $"ALTER DEFAULT PRIVILEGES IN SCHEMA {_command.Schema} GRANT ALL PRIVILEGES ON TABLES TO {_command.User};";
|
||||||
ExecuteSql(sql2);
|
ExecuteSql(sql2);
|
||||||
|
|
||||||
|
// Grant sequence rettigheder
|
||||||
|
var sql3 = $"GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA {_command.Schema} TO {_command.User};";
|
||||||
|
ExecuteSql(sql3);
|
||||||
|
|
||||||
|
// Grant execute på functions
|
||||||
|
var sql4 = $"GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA {_command.Schema} TO {_command.User};";
|
||||||
|
ExecuteSql(sql4);
|
||||||
|
|
||||||
|
// Grant for fremtidige functions
|
||||||
|
var sql5 = $"ALTER DEFAULT PRIVILEGES IN SCHEMA {_command.Schema} GRANT EXECUTE ON FUNCTIONS TO {_command.User};";
|
||||||
|
ExecuteSql(sql5);
|
||||||
|
|
||||||
|
// Grant for fremtidige sequences
|
||||||
|
var sql6 = $"ALTER DEFAULT PRIVILEGES IN SCHEMA {_command.Schema} GRANT USAGE ON SEQUENCES TO {_command.User};";
|
||||||
|
ExecuteSql(sql6);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,33 @@
|
||||||
using Database.Common;
|
using Database.Common;
|
||||||
using Insight.Database;
|
using Insight.Database;
|
||||||
|
|
||||||
namespace Database.Core.DataControlLanguage
|
namespace Database.Core.DCL
|
||||||
{
|
{
|
||||||
public class SetupOrganization
|
public class SetupOrganization : IDbConfigure<SetupOrganization.Command>
|
||||||
{
|
{
|
||||||
|
public class Command
|
||||||
|
{
|
||||||
|
public required string Schema { get; init; }
|
||||||
|
public required string User { get; init; }
|
||||||
|
public required string Password { get; init; }
|
||||||
|
}
|
||||||
|
|
||||||
IDbConnection _db;
|
IDbConnection _db;
|
||||||
string _schema;
|
Command _command;
|
||||||
string _user;
|
|
||||||
string _password;
|
|
||||||
|
|
||||||
public SetupOrganization(IDbConnection db)
|
public SetupOrganization(IDbConnection db)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateUserWithSchemaInDatabase(string schema, string user, string password)
|
public void With(Command command)
|
||||||
{
|
{
|
||||||
|
|
||||||
_schema = schema;
|
_command = command;
|
||||||
_password = password;
|
|
||||||
_user = user;
|
|
||||||
|
|
||||||
if (!Validations.IsValidSchemaName(_schema))
|
|
||||||
throw new ArgumentException("Invalid schema name", _schema);
|
if (!Validations.IsValidSchemaName(_command.Schema))
|
||||||
|
throw new ArgumentException("Invalid schema name", _command.Schema);
|
||||||
|
|
||||||
using (var transaction = _db.BeginTransaction())
|
using (var transaction = _db.BeginTransaction())
|
||||||
{
|
{
|
||||||
|
|
@ -44,9 +47,6 @@ namespace Database.Core.DataControlLanguage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void ExecuteSql(string sql)
|
private void ExecuteSql(string sql)
|
||||||
{
|
{
|
||||||
|
|
@ -55,32 +55,39 @@ namespace Database.Core.DataControlLanguage
|
||||||
|
|
||||||
private void CreateSchema()
|
private void CreateSchema()
|
||||||
{
|
{
|
||||||
var sql = $"CREATE SCHEMA IF NOT EXISTS {_schema}";
|
var sql = $"CREATE SCHEMA IF NOT EXISTS {_command.Schema}";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateRole()
|
private void CreateRole()
|
||||||
{
|
{
|
||||||
var sql = $"CREATE ROLE {_user} LOGIN PASSWORD '{_password}';";
|
var sql = $"CREATE ROLE {_command.User} LOGIN PASSWORD '{_command.Password}';";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
|
|
||||||
var sql1 = $"ALTER ROLE {_user} SET search_path='{_schema}';";
|
var sql1 = $"ALTER ROLE {_command.User} SET search_path='{_command.Schema}';";
|
||||||
ExecuteSql(sql1);
|
ExecuteSql(sql1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GrantSchemaRights()
|
private void GrantSchemaRights()
|
||||||
{
|
{
|
||||||
var sql = $"GRANT USAGE ON SCHEMA {_schema} TO {_user};";
|
var sql = $"GRANT USAGE ON SCHEMA {_command.Schema} TO {_command.User};";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
|
|
||||||
var sql1 = $"ALTER DEFAULT PRIVILEGES IN SCHEMA {_schema} " +
|
var sql1 = $"ALTER DEFAULT PRIVILEGES IN SCHEMA {_command.Schema} " +
|
||||||
$"GRANT INSERT, SELECT, UPDATE PRIVILEGES ON TABLES TO {_user};";
|
$"GRANT INSERT, SELECT, UPDATE PRIVILEGES ON TABLES TO {_command.User};";
|
||||||
ExecuteSql(sql1);
|
ExecuteSql(sql1);
|
||||||
|
|
||||||
var sql2 = $"GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA {_schema} TO {_user};";
|
var sql2 = $"GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA {_command.Schema} TO {_command.User};";
|
||||||
ExecuteSql(sql2);
|
ExecuteSql(sql2);
|
||||||
|
|
||||||
|
var sql3 = $"GRANT CREATE TABLE ON SCHEMA {_command.Schema} TO {_command.User};";
|
||||||
|
ExecuteSql(sql3);
|
||||||
|
}
|
||||||
|
public void RevokeCreateTable()
|
||||||
|
{
|
||||||
|
var sql = $"REVOKE CREATE TABLE ON SCHEMA {_command.Schema} FROM {_command.User};";
|
||||||
|
ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,67 +1,64 @@
|
||||||
using Insight.Database;
|
using Insight.Database;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
||||||
namespace Database.Core.DataDefinitionLanguage
|
namespace Database.Core.DDL
|
||||||
{
|
{
|
||||||
public interface IDbSetup
|
/// <summary>
|
||||||
{
|
/// This is by purpose not async await
|
||||||
void CreateSystem(string schema = null);
|
/// It is intended that this is created with the correct Application User, which is why the schema name is omitted.
|
||||||
}
|
/// </summary>
|
||||||
|
public class SetupIdentitySystem : IDbConfigure<SetupIdentitySystem.Command>
|
||||||
|
{
|
||||||
|
public class Command { }
|
||||||
|
|
||||||
/// <summary>
|
readonly IDbConnection _db;
|
||||||
/// This is by purpose not async await
|
IDbTransaction _transaction = null;
|
||||||
/// </summary>
|
string _schema;
|
||||||
public class SetupIdentitySystem : IDbSetup
|
|
||||||
{
|
|
||||||
readonly IDbConnection _db;
|
|
||||||
IDbTransaction _transaction = null;
|
|
||||||
string _schema;
|
|
||||||
|
|
||||||
public SetupIdentitySystem(IDbConnection db)
|
public SetupIdentitySystem(IDbConnection db)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the system tables in the specified schema within a transaction.
|
/// Creates the system tables in the specified schema within a transaction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="schema">The schema name where the tables will be created.</param>
|
/// <param name="schema">The schema name where the tables will be created.</param>
|
||||||
public void CreateSystem(string schema = null)
|
public void With(Command emptyByIntention)
|
||||||
{
|
{
|
||||||
|
using (_transaction = _db.BeginTransaction())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CreateUsersTable();
|
||||||
|
CreateTenantsTable();
|
||||||
|
CreateUserTenantsTable();
|
||||||
|
SetupRLS();
|
||||||
|
|
||||||
using (_transaction = _db.BeginTransaction())
|
_transaction.Commit();
|
||||||
{
|
}
|
||||||
try
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
CreateUsersTable();
|
_transaction.Rollback();
|
||||||
CreateTenantsTable();
|
throw new InvalidOperationException("Failed to SetupIdentitySystem. Transaction is rolled back", ex);
|
||||||
CreateUserTenantsTable();
|
}
|
||||||
SetupRLS();
|
}
|
||||||
|
}
|
||||||
|
private void ExecuteSql(string sql)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(sql))
|
||||||
|
throw new ArgumentNullException(nameof(sql));
|
||||||
|
|
||||||
_transaction.Commit();
|
_db.ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_transaction.Rollback();
|
|
||||||
throw new InvalidOperationException("Failed to create system tables.", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ExecuteSql(string sql)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(sql))
|
|
||||||
throw new ArgumentNullException(nameof(sql));
|
|
||||||
|
|
||||||
_db.ExecuteSql(sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the users table
|
/// Creates the users table
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CreateUsersTable()
|
public void CreateUsersTable()
|
||||||
{
|
{
|
||||||
var sql = @"
|
var sql = @"
|
||||||
CREATE TABLE IF NOT EXISTS users (
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
email VARCHAR(256) NOT NULL UNIQUE,
|
email VARCHAR(256) NOT NULL UNIQUE,
|
||||||
|
|
@ -76,16 +73,16 @@ namespace Database.Core.DataDefinitionLanguage
|
||||||
last_login_at TIMESTAMPTZ NULL
|
last_login_at TIMESTAMPTZ NULL
|
||||||
);";
|
);";
|
||||||
|
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the tenants table
|
/// Creates the tenants table
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CreateTenantsTable()
|
public void CreateTenantsTable()
|
||||||
{
|
{
|
||||||
var sql = @"
|
var sql = @"
|
||||||
CREATE TABLE IF NOT EXISTS tenants (
|
CREATE TABLE IF NOT EXISTS tenants (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
connection_string VARCHAR(500) NOT NULL,
|
connection_string VARCHAR(500) NOT NULL,
|
||||||
|
|
@ -94,16 +91,16 @@ namespace Database.Core.DataDefinitionLanguage
|
||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
);";
|
);";
|
||||||
|
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the user_tenants table
|
/// Creates the user_tenants table
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CreateUserTenantsTable()
|
public void CreateUserTenantsTable()
|
||||||
{
|
{
|
||||||
var sql = @"
|
var sql = @"
|
||||||
CREATE TABLE IF NOT EXISTS user_tenants (
|
CREATE TABLE IF NOT EXISTS user_tenants (
|
||||||
user_id INTEGER NOT NULL REFERENCES users(id),
|
user_id INTEGER NOT NULL REFERENCES users(id),
|
||||||
tenant_id INTEGER NOT NULL REFERENCES tenants(id),
|
tenant_id INTEGER NOT NULL REFERENCES tenants(id),
|
||||||
|
|
@ -112,37 +109,37 @@ namespace Database.Core.DataDefinitionLanguage
|
||||||
PRIMARY KEY (user_id, tenant_id)
|
PRIMARY KEY (user_id, tenant_id)
|
||||||
);";
|
);";
|
||||||
|
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets up Row Level Security (RLS) for the tenants and user_tenants tables.
|
/// Sets up Row Level Security (RLS) for the tenants and user_tenants tables.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetupRLS()
|
public void SetupRLS()
|
||||||
{
|
{
|
||||||
var sql = new[]
|
var sql = new[]
|
||||||
{
|
{
|
||||||
"ALTER TABLE tenants ENABLE ROW LEVEL SECURITY;",
|
"ALTER TABLE tenants ENABLE ROW LEVEL SECURITY;",
|
||||||
"ALTER TABLE user_tenants ENABLE ROW LEVEL SECURITY;",
|
"ALTER TABLE user_tenants ENABLE ROW LEVEL SECURITY;",
|
||||||
"DROP POLICY IF EXISTS tenant_access ON tenants;",
|
"DROP POLICY IF EXISTS tenant_access ON tenants;",
|
||||||
@"CREATE POLICY tenant_access ON tenants
|
@"CREATE POLICY tenant_access ON tenants
|
||||||
USING (id IN (
|
USING (id IN (
|
||||||
SELECT tenant_id
|
SELECT tenant_id
|
||||||
FROM user_tenants
|
FROM user_tenants
|
||||||
WHERE user_id = current_setting('app.user_id', TRUE)::INTEGER
|
WHERE user_id = current_setting('app.user_id', TRUE)::INTEGER
|
||||||
));",
|
));",
|
||||||
"DROP POLICY IF EXISTS user_tenant_access ON user_tenants;",
|
"DROP POLICY IF EXISTS user_tenant_access ON user_tenants;",
|
||||||
@"CREATE POLICY user_tenant_access ON user_tenants
|
@"CREATE POLICY user_tenant_access ON user_tenants
|
||||||
USING (user_id = current_setting('app.user_id', TRUE)::INTEGER);"
|
USING (user_id = current_setting('app.user_id', TRUE)::INTEGER);"
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var statement in sql)
|
foreach (var statement in sql)
|
||||||
{
|
{
|
||||||
ExecuteSql(statement);
|
ExecuteSql(statement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
7
Database/Core/IDbConfigure.cs
Normal file
7
Database/Core/IDbConfigure.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Database.Core
|
||||||
|
{
|
||||||
|
public interface IDbConfigure<T>
|
||||||
|
{
|
||||||
|
void With(T command);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Database/ModuleRegistry/DbPostgreSqlModule.cs
Normal file
22
Database/ModuleRegistry/DbPostgreSqlModule.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
using Autofac;
|
||||||
|
using Npgsql;
|
||||||
|
using System.Data;
|
||||||
|
namespace Database.ModuleRegistry
|
||||||
|
{
|
||||||
|
public class DbPostgreSqlModule : Module
|
||||||
|
{
|
||||||
|
public required string ConnectionString { get; set; }
|
||||||
|
protected override void Load(ContainerBuilder builder)
|
||||||
|
{
|
||||||
|
Insight.Database.Providers.PostgreSQL.PostgreSQLInsightDbProvider.RegisterProvider();
|
||||||
|
|
||||||
|
builder.Register(c =>
|
||||||
|
{
|
||||||
|
IDbConnection connection = new NpgsqlConnection(ConnectionString);
|
||||||
|
return connection;
|
||||||
|
})
|
||||||
|
.InstancePerLifetimeScope();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,22 +14,22 @@ namespace Database.NavigationSystem
|
||||||
}
|
}
|
||||||
public void CreateSystem()
|
public void CreateSystem()
|
||||||
{
|
{
|
||||||
//await CreateNavigationLinkTemplatesTable(schema);
|
//await CreateNavigationLinkTemplatesTable(schema);
|
||||||
//await CreateNavigationLinkTemplateTranslationsTable(schema);
|
//await CreateNavigationLinkTemplateTranslationsTable(schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CreateNavigationLinkTemplatesTable(string schema)
|
private async Task CreateNavigationLinkTemplatesTable()
|
||||||
{
|
{
|
||||||
var sql = $@"
|
var sql = $@"
|
||||||
CREATE TABLE IF NOT EXISTS {schema}.navigation_link_templates (
|
CREATE TABLE IF NOT EXISTS navigation_link_templates (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
parent_id INTEGER NULL,
|
parent_id INTEGER NULL,
|
||||||
url VARCHAR(500) NOT NULL,
|
url VARCHAR(500) NOT NULL,
|
||||||
permission_id INTEGER NULL,
|
permission_id INTEGER NULL,
|
||||||
icon VARCHAR(100) NULL,
|
icon VARCHAR(100) NULL,
|
||||||
default_order INTEGER NOT NULL,
|
default_order INTEGER NOT NULL,
|
||||||
FOREIGN KEY (permission_id) REFERENCES {schema}.permissions(id),
|
FOREIGN KEY (permission_id) REFERENCES permissions(id),
|
||||||
FOREIGN KEY (parent_id) REFERENCES {schema}.navigation_link_templates(id)
|
FOREIGN KEY (parent_id) REFERENCES navigation_link_templates(id)
|
||||||
)";
|
)";
|
||||||
await _db.ExecuteAsync(sql);
|
await _db.ExecuteAsync(sql);
|
||||||
}
|
}
|
||||||
|
|
@ -37,17 +37,14 @@ namespace Database.NavigationSystem
|
||||||
private async Task CreateNavigationLinkTemplateTranslationsTable(string schema)
|
private async Task CreateNavigationLinkTemplateTranslationsTable(string schema)
|
||||||
{
|
{
|
||||||
var sql = $@"
|
var sql = $@"
|
||||||
CREATE TABLE IF NOT EXISTS {schema}.navigation_link_template_translations (
|
CREATE TABLE IF NOT EXISTS navigation_link_template_translations (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
template_id INTEGER NOT NULL,
|
template_id INTEGER NOT NULL,
|
||||||
language VARCHAR(10) NOT NULL,
|
language VARCHAR(10) NOT NULL,
|
||||||
display_name VARCHAR(100) NOT NULL,
|
display_name VARCHAR(100) NOT NULL,
|
||||||
FOREIGN KEY (template_id) REFERENCES {schema}.navigation_link_templates(id)
|
FOREIGN KEY (template_id) REFERENCES navigation_link_templates(id)
|
||||||
)";
|
)";
|
||||||
await _db.ExecuteAsync(sql);
|
await _db.ExecuteAsync(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,95 +4,97 @@ using Insight.Database;
|
||||||
|
|
||||||
namespace Database.RolesPermissionSystem
|
namespace Database.RolesPermissionSystem
|
||||||
{
|
{
|
||||||
public class Setup
|
/// <summary>
|
||||||
{
|
/// This is by purpose not async await
|
||||||
IDbConnection _db;
|
/// It is intended that this is created with the correct Application User, which is why the schema name is omitted.
|
||||||
string _schema;
|
/// </summary>
|
||||||
|
public class Setup
|
||||||
|
{
|
||||||
|
IDbConnection _db;
|
||||||
|
|
||||||
public Setup(IDbConnection db)
|
public Setup(IDbConnection db)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the system tables in the specified schema within a transaction.
|
/// Creates the system tables in the specified schema within a transaction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="schema">The schema name where the tables will be created.</param>
|
/// <param name="schema">The schema name where the tables will be created.</param>
|
||||||
public void CreateSystem(string schema)
|
public void CreateSystem()
|
||||||
{
|
{
|
||||||
_schema = schema;
|
|
||||||
|
|
||||||
if (!Validations.IsValidSchemaName(_schema))
|
//if (!Validations.IsValidSchemaName(_schema))
|
||||||
throw new ArgumentException("Invalid schema name", _schema);
|
// throw new ArgumentException("Invalid schema name", _schema);
|
||||||
|
|
||||||
using (var transaction = _db.BeginTransaction())
|
using (var transaction = _db.BeginTransaction())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CreateRolesTable();
|
CreateRolesTable();
|
||||||
CreatePermissionsTable();
|
CreatePermissionsTable();
|
||||||
CreatePermissionTypesTable();
|
CreatePermissionTypesTable();
|
||||||
CreateRolePermissionsTable();
|
CreateRolePermissionsTable();
|
||||||
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
transaction.Rollback();
|
transaction.Rollback();
|
||||||
throw new InvalidOperationException("Failed to create system tables.", ex);
|
throw new InvalidOperationException("Failed to create system tables.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ExecuteSql(string sql)
|
private void ExecuteSql(string sql)
|
||||||
{
|
{
|
||||||
_db.ExecuteSql(sql);
|
_db.ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreatePermissionTypesTable()
|
private void CreatePermissionTypesTable()
|
||||||
{
|
{
|
||||||
var sql = $@"
|
var sql = $@"
|
||||||
CREATE TABLE IF NOT EXISTS {_schema}.permission_types (
|
CREATE TABLE IF NOT EXISTS permission_types (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
name VARCHAR(100) NOT NULL UNIQUE
|
name VARCHAR(100) NOT NULL UNIQUE
|
||||||
)";
|
)";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreatePermissionsTable()
|
private void CreatePermissionsTable()
|
||||||
{
|
{
|
||||||
var sql = $@"
|
var sql = $@"
|
||||||
CREATE TABLE IF NOT EXISTS {_schema}.permissions (
|
CREATE TABLE IF NOT EXISTS permissions (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
name VARCHAR(100) NOT NULL UNIQUE,
|
name VARCHAR(100) NOT NULL UNIQUE,
|
||||||
type_id INTEGER NOT NULL,
|
type_id INTEGER NOT NULL,
|
||||||
FOREIGN KEY (type_id) REFERENCES {_schema}.permission_types(id)
|
FOREIGN KEY (type_id) REFERENCES permission_types(id)
|
||||||
)";
|
)";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateRolesTable()
|
private void CreateRolesTable()
|
||||||
{
|
{
|
||||||
var sql = $@"
|
var sql = $@"
|
||||||
CREATE TABLE IF NOT EXISTS {_schema}.roles (
|
CREATE TABLE IF NOT EXISTS roles (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
name VARCHAR(100) NOT NULL UNIQUE
|
name VARCHAR(100) NOT NULL UNIQUE
|
||||||
)";
|
)";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateRolePermissionsTable()
|
private void CreateRolePermissionsTable()
|
||||||
{
|
{
|
||||||
var sql = $@"
|
var sql = $@"
|
||||||
CREATE TABLE IF NOT EXISTS {_schema}.role_permissions (
|
CREATE TABLE IF NOT EXISTS role_permissions (
|
||||||
role_id INTEGER NOT NULL,
|
role_id INTEGER NOT NULL,
|
||||||
permission_id INTEGER NOT NULL,
|
permission_id INTEGER NOT NULL,
|
||||||
PRIMARY KEY (role_id, permission_id),
|
PRIMARY KEY (role_id, permission_id),
|
||||||
FOREIGN KEY (role_id) REFERENCES {_schema}.roles(id),
|
FOREIGN KEY (role_id) REFERENCES roles(id),
|
||||||
FOREIGN KEY (permission_id) REFERENCES {_schema}.permissions(id)
|
FOREIGN KEY (permission_id) REFERENCES permissions(id)
|
||||||
)";
|
)";
|
||||||
ExecuteSql(sql);
|
ExecuteSql(sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -29,7 +29,7 @@ namespace SetupInfrastructure
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Console.WriteLine("Input <username>:<password>");
|
Console.WriteLine("Input username:password for a superadmin role");
|
||||||
userPass = Console.ReadLine() ?? string.Empty;
|
userPass = Console.ReadLine() ?? string.Empty;
|
||||||
} while (!userPass.Contains(":") || userPass.Split(":").Length != 2 ||
|
} while (!userPass.Contains(":") || userPass.Split(":").Length != 2 ||
|
||||||
string.IsNullOrEmpty(userPass.Split(":")[0]) ||
|
string.IsNullOrEmpty(userPass.Split(":")[0]) ||
|
||||||
|
|
@ -41,8 +41,10 @@ namespace SetupInfrastructure
|
||||||
);
|
);
|
||||||
_container = new Startup().ConfigureContainer(ctp);
|
_container = new Startup().ConfigureContainer(ctp);
|
||||||
|
|
||||||
if (TestDbRole())
|
if (IsSuperAdmin())
|
||||||
{
|
{
|
||||||
|
var setup = _container.Resolve<Database.Core.DCL.SetupApplicationUser>();
|
||||||
|
setup.With(new Database.Core.DCL.SetupApplicationUser.Command { Password = "3911", Schema = "system", User = "sathumper" });
|
||||||
|
|
||||||
// SetupApplicationUser
|
// SetupApplicationUser
|
||||||
// SetupIdentitySystem
|
// SetupIdentitySystem
|
||||||
|
|
@ -70,7 +72,7 @@ namespace SetupInfrastructure
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool TestDbRole()
|
static bool IsSuperAdmin()
|
||||||
{
|
{
|
||||||
var backgroundColor = Console.BackgroundColor;
|
var backgroundColor = Console.BackgroundColor;
|
||||||
var foregroundColor = Console.ForegroundColor;
|
var foregroundColor = Console.ForegroundColor;
|
||||||
|
|
|
||||||
|
|
@ -5,37 +5,41 @@ using Core.Configurations.JsonConfigProvider;
|
||||||
|
|
||||||
namespace SetupInfrastructure
|
namespace SetupInfrastructure
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public virtual IConfigurationRoot Configuration()
|
public virtual IConfigurationRoot Configuration()
|
||||||
{
|
{
|
||||||
var configuration = new ConfigurationBuilder()
|
var configuration = new ConfigurationBuilder()
|
||||||
.AddJsonFile("appconfiguration.json")
|
.AddJsonFile("appconfiguration.json")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IContainer ConfigureContainer(ConnectionStringTemplateParameters ctp)
|
public IContainer ConfigureContainer(ConnectionStringTemplateParameters ctp)
|
||||||
{
|
{
|
||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
var configuration = Configuration();
|
var configuration = Configuration();
|
||||||
|
|
||||||
|
|
||||||
builder.RegisterModule(new Core.ModuleRegistry.DbPostgreSqlModule
|
builder.RegisterModule(new Database.ModuleRegistry.DbPostgreSqlModule
|
||||||
{
|
{
|
||||||
ConnectionString = configuration.GetConnectionString("DefaultConnection").Replace("{usr}", ctp.user).Replace("{pwd}", ctp.pwd)
|
ConnectionString = configuration.GetConnectionString("DefaultConnection").Replace("{usr}", ctp.user).Replace("{pwd}", ctp.pwd)
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.RegisterModule(new Core.ModuleRegistry.TelemetryModule
|
builder.RegisterModule(new Core.ModuleRegistry.TelemetryModule
|
||||||
{
|
{
|
||||||
TelemetryConfig = configuration.GetSection("ApplicationInsights").ToObject<Core.ModuleRegistry.TelemetryConfig>()
|
TelemetryConfig = configuration.GetSection("ApplicationInsights").ToObject<Core.ModuleRegistry.TelemetryConfig>()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.RegisterAssemblyTypes(typeof(Database.Core.IDbConfigure<>).Assembly)
|
||||||
|
.AsClosedTypesOf(typeof(Database.Core.IDbConfigure<>))
|
||||||
|
.AsSelf();
|
||||||
|
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public record ConnectionStringTemplateParameters(string user, string pwd);
|
public record ConnectionStringTemplateParameters(string user, string pwd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"resources":{"Scripts/Script-1.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"postgres"},"Scripts/Script-2.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptdb01"},"Scripts/Script-3.sql":{"default-datasource":"postgres-jdbc-19484872d85-cd2a4a40116e706","default-catalog":"ptdb01","default-schema":"ptmain"},"Scripts/Script-4.sql":{"default-datasource":"postgres-jdbc-19484872d85-cd2a4a40116e706","default-catalog":"ptdb01","default-schema":"ptmain"},"Scripts/Script-5.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/Script.sql":{"default-datasource":"postgres-jdbc-19484872d85-cd2a4a40116e706","default-catalog":"sandbox","default-schema":"public"},"Scripts/SmartConfigSystem.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/grant-privileges.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptdb01"}}}
|
{"resources":{"Scripts/Script-11.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/SmartConfigSystem.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/grant-privileges.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"}}}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"resources":{"Scripts/SmartConfigSystem.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/grant-privileges.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptdb01"}}}
|
{"resources":{"Scripts/Script-11.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/SmartConfigSystem.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/grant-privileges.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"}}}
|
||||||
|
|
@ -59,8 +59,8 @@ namespace Tests
|
||||||
{
|
{
|
||||||
var conn = Container.Resolve<IDbConnection>();
|
var conn = Container.Resolve<IDbConnection>();
|
||||||
|
|
||||||
var identitySystem = new Database.Core.SetupIdentitySystem(conn);
|
var identitySystem = new Database.Core.DDL.SetupIdentitySystem(conn);
|
||||||
identitySystem.CreateSystem("swp");
|
// identitySystem..CreateSystem("swp");
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue