Working on tenants and config

This commit is contained in:
Janus Knudsen 2025-01-21 17:40:23 +01:00
parent c10de11bbe
commit f3352318f5
12 changed files with 309 additions and 19 deletions

View file

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Insight.Database;
namespace Database.Tenants
{
@ -18,13 +14,13 @@ namespace Database.Tenants
_db = db;
}
public async Task CreateTenant(string schema)
public async Task CreateTenantInDatabase(string schema, string user, string password)
{
if (!Regex.IsMatch(schema, "^[a-zA-Z0-9_]+$"))
{
throw new ArgumentException("Invalid schema name");
}
await CreateUser(user, password);
await CreateSchema(schema);
await CreateRolesTable(schema);
await CreatePermissionsTable(schema);