Merge remote-tracking branch 'upstream/dev' into sql-server
This commit is contained in:
commit
d83eac5af3
63
Oqtane.Client/Installer/Controls/LocalDBConfig.razor
Normal file
63
Oqtane.Client/Installer/Controls/LocalDBConfig.razor
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
@namespace Oqtane.Installer.Controls
|
||||||
|
|
||||||
|
@using System.ComponentModel.Design.Serialization
|
||||||
|
@implements Oqtane.Interfaces.IDatabaseConfigControl
|
||||||
|
|
||||||
|
@inject IStringLocalizer<Installer> Localizer
|
||||||
|
|
||||||
|
@{
|
||||||
|
foreach (var field in _connectionStringFields)
|
||||||
|
{
|
||||||
|
var fieldId = field.Name.ToLowerInvariant();
|
||||||
|
field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
|
||||||
|
|
||||||
|
if (IsInstaller)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="@fieldId" type="text" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public bool IsInstaller { get; set; }
|
||||||
|
|
||||||
|
private readonly List<ConnectionStringField> _connectionStringFields = new()
|
||||||
|
{
|
||||||
|
new() {Name = "Server", FriendlyName = "Server", Value = "(LocalDb)\\MSSQLLocalDB", HelpText="Enter the database server"},
|
||||||
|
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"}
|
||||||
|
};
|
||||||
|
|
||||||
|
public string GetConnectionString()
|
||||||
|
{
|
||||||
|
var connectionString = String.Empty;
|
||||||
|
|
||||||
|
var server = _connectionStringFields[0].Value;
|
||||||
|
var database = _connectionStringFields[1].Value;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database))
|
||||||
|
{
|
||||||
|
connectionString = $"Data Source={server};AttachDbFilename=|DataDirectory|\\{database}.mdf;Initial Catalog={database};Integrated Security=SSPI;";
|
||||||
|
}
|
||||||
|
|
||||||
|
return connectionString;
|
||||||
|
}
|
||||||
|
}
|
73
Oqtane.Client/Installer/Controls/MySQLConfig.razor
Normal file
73
Oqtane.Client/Installer/Controls/MySQLConfig.razor
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
@namespace Oqtane.Installer.Controls
|
||||||
|
|
||||||
|
@implements Oqtane.Interfaces.IDatabaseConfigControl
|
||||||
|
|
||||||
|
@inject IStringLocalizer<Installer> Localizer
|
||||||
|
|
||||||
|
@{
|
||||||
|
foreach (var field in _connectionStringFields)
|
||||||
|
{
|
||||||
|
var fieldId = field.Name.ToLowerInvariant();
|
||||||
|
var fieldType = (field.Name == "Pwd") ? "password" : "text";
|
||||||
|
field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
|
||||||
|
|
||||||
|
if (IsInstaller)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="@fieldType" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="@fieldId" type="@fieldType" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public bool IsInstaller { get; set; }
|
||||||
|
|
||||||
|
private readonly List<ConnectionStringField> _connectionStringFields = new()
|
||||||
|
{
|
||||||
|
new() {Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText="Enter the database server"},
|
||||||
|
new() {Name = "Port", FriendlyName = "Port", Value = "3306", HelpText="Enter the port used to connect to the server"},
|
||||||
|
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"},
|
||||||
|
new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"},
|
||||||
|
new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"}
|
||||||
|
};
|
||||||
|
|
||||||
|
public string GetConnectionString()
|
||||||
|
{
|
||||||
|
var connectionString = String.Empty;
|
||||||
|
|
||||||
|
var server = _connectionStringFields[0].Value;
|
||||||
|
var port = _connectionStringFields[1].Value;
|
||||||
|
var database = _connectionStringFields[2].Value;
|
||||||
|
var userId = _connectionStringFields[3].Value;
|
||||||
|
var password = _connectionStringFields[4].Value;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
connectionString = $"Server={server};Database={database};Uid={userId};Pwd={password};";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(port))
|
||||||
|
{
|
||||||
|
connectionString += $"Port={port};";
|
||||||
|
}
|
||||||
|
return connectionString;
|
||||||
|
}
|
||||||
|
}
|
131
Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor
Normal file
131
Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
@namespace Oqtane.Installer.Controls
|
||||||
|
|
||||||
|
@implements Oqtane.Interfaces.IDatabaseConfigControl
|
||||||
|
|
||||||
|
@inject IStringLocalizer<Installer> Localizer
|
||||||
|
|
||||||
|
@{
|
||||||
|
foreach (var field in _connectionStringFields)
|
||||||
|
{
|
||||||
|
var fieldId = field.Name.ToLowerInvariant();
|
||||||
|
if (field.Name != "IntegratedSecurity")
|
||||||
|
{
|
||||||
|
var isVisible = "";
|
||||||
|
var fieldType = (field.Name == "Pwd") ? "password" : "text";
|
||||||
|
if ((field.Name == "Uid" || field.Name == "Pwd") )
|
||||||
|
{
|
||||||
|
var intSecurityField = _connectionStringFields.Single(f => f.Name == "IntegratedSecurity");
|
||||||
|
if (intSecurityField != null)
|
||||||
|
{
|
||||||
|
isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
|
||||||
|
|
||||||
|
if (IsInstaller)
|
||||||
|
{
|
||||||
|
<tr style="@isVisible">
|
||||||
|
<td>
|
||||||
|
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="@fieldType" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<tr style="@isVisible">
|
||||||
|
<td>
|
||||||
|
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="@fieldId" type="@fieldType" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsInstaller)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="custom-select" @bind="@field.Value">
|
||||||
|
<option value="true" selected>@Localizer["True"]</option>
|
||||||
|
<option value="false">@Localizer["False"]</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select id="@fieldId" class="custom-select" @bind="@field.Value">
|
||||||
|
<option value="true" selected>@Localizer["True"]</option>
|
||||||
|
<option value="false">@Localizer["False"]</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public bool IsInstaller { get; set; }
|
||||||
|
|
||||||
|
private readonly List<ConnectionStringField> _connectionStringFields = new()
|
||||||
|
{
|
||||||
|
new() {Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText="Enter the database server"},
|
||||||
|
new() {Name = "Port", FriendlyName = "Port", Value = "5432", HelpText="Enter the port used to connect to the server"},
|
||||||
|
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"},
|
||||||
|
new() {Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText="Select if you want integrated security or not"},
|
||||||
|
new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"},
|
||||||
|
new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"}
|
||||||
|
};
|
||||||
|
|
||||||
|
public string GetConnectionString()
|
||||||
|
{
|
||||||
|
var connectionString = String.Empty;
|
||||||
|
|
||||||
|
var server = _connectionStringFields[0].Value;
|
||||||
|
var port = _connectionStringFields[1].Value;
|
||||||
|
var database = _connectionStringFields[2].Value;
|
||||||
|
var integratedSecurity = Boolean.Parse(_connectionStringFields[3].Value);
|
||||||
|
var userId = _connectionStringFields[4].Value;
|
||||||
|
var password = _connectionStringFields[5].Value;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(port))
|
||||||
|
{
|
||||||
|
connectionString = $"Server={server};Port={port};Database={database};";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (integratedSecurity)
|
||||||
|
{
|
||||||
|
connectionString += "Integrated Security=true;";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
connectionString += $"User ID={userId};Password={password};";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connectionString = String.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return connectionString;
|
||||||
|
}
|
||||||
|
}
|
131
Oqtane.Client/Installer/Controls/SqlServerConfig.razor
Normal file
131
Oqtane.Client/Installer/Controls/SqlServerConfig.razor
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
@namespace Oqtane.Installer.Controls
|
||||||
|
|
||||||
|
@implements Oqtane.Interfaces.IDatabaseConfigControl
|
||||||
|
|
||||||
|
@inject IStringLocalizer<Installer> Localizer
|
||||||
|
|
||||||
|
@{
|
||||||
|
foreach (var field in _connectionStringFields)
|
||||||
|
{
|
||||||
|
var fieldId = field.Name.ToLowerInvariant();
|
||||||
|
if (field.Name != "IntegratedSecurity")
|
||||||
|
{
|
||||||
|
var isVisible = "";
|
||||||
|
var fieldType = (field.Name == "Pwd") ? "password" : "text";
|
||||||
|
if ((field.Name == "Uid" || field.Name == "Pwd") )
|
||||||
|
{
|
||||||
|
var intSecurityField = _connectionStringFields.Single(f => f.Name == "IntegratedSecurity");
|
||||||
|
if (intSecurityField != null)
|
||||||
|
{
|
||||||
|
isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
|
||||||
|
|
||||||
|
if (IsInstaller)
|
||||||
|
{
|
||||||
|
<tr style="@isVisible">
|
||||||
|
<td>
|
||||||
|
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="@fieldType" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<tr style="@isVisible">
|
||||||
|
<td>
|
||||||
|
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="@fieldId" type="@fieldType" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsInstaller)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="custom-select" @bind="@field.Value">
|
||||||
|
<option value="true" selected>@Localizer["True"]</option>
|
||||||
|
<option value="false">@Localizer["False"]</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select id="@fieldId" class="custom-select" @bind="@field.Value">
|
||||||
|
<option value="true" selected>@Localizer["True"]</option>
|
||||||
|
<option value="false">@Localizer["False"]</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool IsInstaller { get; set; }
|
||||||
|
|
||||||
|
private readonly List<ConnectionStringField> _connectionStringFields = new()
|
||||||
|
{
|
||||||
|
new() {Name = "Server", FriendlyName = "Server", Value = ".", HelpText="Enter the database server"},
|
||||||
|
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"},
|
||||||
|
new() {Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText="Select if you want integrated security or not"},
|
||||||
|
new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"},
|
||||||
|
new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"}
|
||||||
|
};
|
||||||
|
|
||||||
|
public string GetConnectionString()
|
||||||
|
{
|
||||||
|
var connectionString = String.Empty;
|
||||||
|
|
||||||
|
var server = _connectionStringFields[0].Value;
|
||||||
|
var database = _connectionStringFields[1].Value;
|
||||||
|
var integratedSecurity = Boolean.Parse(_connectionStringFields[2].Value);
|
||||||
|
var userId = _connectionStringFields[3].Value;
|
||||||
|
var password = _connectionStringFields[4].Value;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database))
|
||||||
|
{
|
||||||
|
connectionString = $"Data Source={server};Initial Catalog={database};";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (integratedSecurity)
|
||||||
|
{
|
||||||
|
connectionString += "Integrated Security=SSPI;";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
connectionString += $"User ID={userId};Password={password};";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connectionString = String.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return connectionString;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
60
Oqtane.Client/Installer/Controls/SqliteConfig.razor
Normal file
60
Oqtane.Client/Installer/Controls/SqliteConfig.razor
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
@namespace Oqtane.Installer.Controls
|
||||||
|
|
||||||
|
@implements Oqtane.Interfaces.IDatabaseConfigControl
|
||||||
|
|
||||||
|
@inject IStringLocalizer<Installer> Localizer
|
||||||
|
|
||||||
|
@{
|
||||||
|
foreach (var field in _connectionStringFields)
|
||||||
|
{
|
||||||
|
var fieldId = field.Name.ToLowerInvariant();
|
||||||
|
field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
|
||||||
|
|
||||||
|
if (IsInstaller)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="@fieldId" type="text" class="form-control" @bind="@field.Value" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public bool IsInstaller { get; set; }
|
||||||
|
|
||||||
|
private readonly List<ConnectionStringField> _connectionStringFields = new()
|
||||||
|
{
|
||||||
|
new() {Name = "Server", FriendlyName = "File Name", Value = "Oqtane-{{Date}}.db", HelpText="Enter the file name to use for the database"}
|
||||||
|
};
|
||||||
|
|
||||||
|
public string GetConnectionString()
|
||||||
|
{
|
||||||
|
var connectionstring = String.Empty;
|
||||||
|
|
||||||
|
var server = _connectionStringFields[0].Value;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(server))
|
||||||
|
{
|
||||||
|
connectionstring = $"Data Source={server};";
|
||||||
|
}
|
||||||
|
|
||||||
|
return connectionstring;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
|
@namespace Oqtane.Installer
|
||||||
@using Oqtane.Interfaces
|
@using Oqtane.Interfaces
|
||||||
@using System.Reflection
|
@using Oqtane.Installer.Controls
|
||||||
@namespace Oqtane.UI
|
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IInstallationService InstallationService
|
@inject IInstallationService InstallationService
|
||||||
@inject ISiteService SiteService
|
@inject ISiteService SiteService
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@inject IJSRuntime JSRuntime
|
@inject IJSRuntime JSRuntime
|
||||||
@inject IStringLocalizer<Installer> Localizer
|
@inject IStringLocalizer<Installer> Localizer
|
||||||
@inject IEnumerable<IOqtaneDatabase> Databases
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -24,61 +24,21 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label" style="font-weight: bold">@Localizer["Database Type:"] </label>
|
<label class="control-label" style="font-weight: bold">@Localizer["Database Type:"]</label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="custom-select" @bind="@_databaseType">
|
<select class="custom-select" value="@_databaseName" @onchange="(e => DatabaseChanged(e))">
|
||||||
@{
|
@foreach (var database in _databases)
|
||||||
foreach (var database in Databases)
|
|
||||||
{
|
{
|
||||||
<option value="@database.Name">@Localizer[@database.FriendlyName]</option>
|
<option value="@database.Name">@Localizer[@database.FriendlyName]</option>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@{
|
@{
|
||||||
_selectedDatabase = Databases.Single(d => d.Name == _databaseType);
|
if (_databaseConfigType != null)
|
||||||
foreach (var field in _selectedDatabase.ConnectionStringFields)
|
|
||||||
{
|
{
|
||||||
if (field.Name != "IntegratedSecurity")
|
@DatabaseConfigComponent;
|
||||||
{
|
|
||||||
var isVisible = "";
|
|
||||||
var fieldType = (field.Name == "Pwd") ? "password" : "text";
|
|
||||||
if ((field.Name == "Uid" || field.Name == "Pwd") && _selectedDatabase.Name != "MySQL" )
|
|
||||||
{
|
|
||||||
var intSecurityField = _selectedDatabase.ConnectionStringFields.Single(f => f.Name == "IntegratedSecurity");
|
|
||||||
if (intSecurityField != null)
|
|
||||||
{
|
|
||||||
isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
|
|
||||||
|
|
||||||
<tr style="@isVisible">
|
|
||||||
<td>
|
|
||||||
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="@fieldType" class="form-control" @bind="@field.Value" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label class="control-label" style="font-weight: bold">@Localizer[$"{field.FriendlyName}:"]</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<select class="custom-select" @bind="@field.Value">
|
|
||||||
<option value="true" selected>@Localizer["True"]</option>
|
|
||||||
<option value="false">@Localizer["False"]</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -135,8 +95,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private IOqtaneDatabase _selectedDatabase;
|
private IList<Database> _databases;
|
||||||
private string _databaseType = "LocalDB";
|
private string _databaseName = "LocalDB";
|
||||||
|
private Type _databaseConfigType;
|
||||||
|
private object _databaseConfig;
|
||||||
|
private RenderFragment DatabaseConfigComponent { get; set; }
|
||||||
|
|
||||||
private string _hostUsername = UserNames.Host;
|
private string _hostUsername = UserNames.Host;
|
||||||
private string _hostPassword = string.Empty;
|
private string _hostPassword = string.Empty;
|
||||||
private string _confirmPassword = string.Empty;
|
private string _confirmPassword = string.Empty;
|
||||||
|
@ -144,6 +108,77 @@
|
||||||
private string _message = string.Empty;
|
private string _message = string.Empty;
|
||||||
private string _loadingDisplay = "display: none;";
|
private string _loadingDisplay = "display: none;";
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
base.OnInitialized();
|
||||||
|
|
||||||
|
_databases = new List<Database>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "LocalDB",
|
||||||
|
FriendlyName = "Local Database",
|
||||||
|
Type = "Oqtane.Installer.Controls.LocalDBConfig, Oqtane.Client"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "SqlServer",
|
||||||
|
FriendlyName = "SQL Server",
|
||||||
|
Type = "Oqtane.Installer.Controls.SqlServerConfig, Oqtane.Client"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Sqlite",
|
||||||
|
FriendlyName = "Sqlite",
|
||||||
|
Type = "Oqtane.Installer.Controls.SqliteConfig, Oqtane.Client"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "MySQL",
|
||||||
|
FriendlyName = "MySQL",
|
||||||
|
Type = "Oqtane.Installer.Controls.MySQLConfig, Oqtane.Client"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "PostgreSQL",
|
||||||
|
FriendlyName = "PostgreSQL",
|
||||||
|
Type = "Oqtane.Installer.Controls.PostgreSQLConfig, Oqtane.Client"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LoadDatabaseConfigComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DatabaseChanged(ChangeEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_databaseName = (string)eventArgs.Value;
|
||||||
|
|
||||||
|
LoadDatabaseConfigComponent();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
_message = Localizer["Error loading Database Configuration Control"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadDatabaseConfigComponent()
|
||||||
|
{
|
||||||
|
var database = _databases.SingleOrDefault(d => d.Name == _databaseName);
|
||||||
|
if (database != null)
|
||||||
|
{
|
||||||
|
_databaseConfigType = Type.GetType(database.Type);
|
||||||
|
DatabaseConfigComponent = builder =>
|
||||||
|
{
|
||||||
|
builder.OpenComponent(0, _databaseConfigType);
|
||||||
|
builder.AddAttribute(1, "IsInstaller", true);
|
||||||
|
builder.AddComponentReferenceCapture(2, inst => { _databaseConfig = Convert.ChangeType(inst, _databaseConfigType); });
|
||||||
|
builder.CloseComponent();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
|
@ -155,7 +190,11 @@
|
||||||
|
|
||||||
private async Task Install()
|
private async Task Install()
|
||||||
{
|
{
|
||||||
var connectionString = _selectedDatabase.BuildConnectionString();
|
var connectionString = String.Empty;
|
||||||
|
if (_databaseConfig is IDatabaseConfigControl databaseConfigControl)
|
||||||
|
{
|
||||||
|
connectionString = databaseConfigControl.GetConnectionString();
|
||||||
|
}
|
||||||
|
|
||||||
if (connectionString != "" && _hostUsername != "" && _hostPassword.Length >= 6 && _hostPassword == _confirmPassword && _hostEmail != "")
|
if (connectionString != "" && _hostUsername != "" && _hostPassword.Length >= 6 && _hostPassword == _confirmPassword && _hostEmail != "")
|
||||||
{
|
{
|
||||||
|
@ -166,7 +205,7 @@
|
||||||
|
|
||||||
var config = new InstallConfig
|
var config = new InstallConfig
|
||||||
{
|
{
|
||||||
DatabaseType = _databaseType,
|
DatabaseType = _databaseName,
|
||||||
ConnectionString = connectionString,
|
ConnectionString = connectionString,
|
||||||
Aliases = uri.Authority,
|
Aliases = uri.Authority,
|
||||||
HostEmail = _hostEmail,
|
HostEmail = _hostEmail,
|
47
Oqtane.Client/Localization/SharedResources.cs
Normal file
47
Oqtane.Client/Localization/SharedResources.cs
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
namespace Oqtane
|
||||||
|
{
|
||||||
|
public class SharedResources
|
||||||
|
{
|
||||||
|
public static readonly string UserLogin = "User Login";
|
||||||
|
|
||||||
|
public static readonly string UserRegistration = "User Registration";
|
||||||
|
|
||||||
|
public static readonly string PasswordReset = "Password Reset";
|
||||||
|
|
||||||
|
public static readonly string UserProfile = "User Profile";
|
||||||
|
|
||||||
|
public static readonly string AdminDashboard = "Admin Dashboard";
|
||||||
|
|
||||||
|
public static readonly string SiteSettings = "Site Settings";
|
||||||
|
|
||||||
|
public static readonly string PageManagement = "Page Management";
|
||||||
|
|
||||||
|
public static readonly string UserManagement = "User Management";
|
||||||
|
|
||||||
|
public static readonly string ProfileManagement = "Profile Management";
|
||||||
|
|
||||||
|
public static readonly string RoleManagement = "Role Management";
|
||||||
|
|
||||||
|
public static readonly string FileManagement = "File Management";
|
||||||
|
|
||||||
|
public static readonly string RecycleBin = "Recycle Bin";
|
||||||
|
|
||||||
|
public static readonly string EventLog = "Event Log";
|
||||||
|
|
||||||
|
public static readonly string SiteManagement = "Site Management";
|
||||||
|
|
||||||
|
public static readonly string ModuleManagement = "Module Management";
|
||||||
|
|
||||||
|
public static readonly string ThemeManagement = "Theme Management";
|
||||||
|
|
||||||
|
public static readonly string LanguageManagement = "Language Management";
|
||||||
|
|
||||||
|
public static readonly string ScheduledJobs = "Scheduled Jobs";
|
||||||
|
|
||||||
|
public static readonly string SqlManagement = "Sql Management";
|
||||||
|
|
||||||
|
public static readonly string SystemInfo = "System Info";
|
||||||
|
|
||||||
|
public static readonly string SystemUpdate = "System Update";
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject IPageService PageService
|
@inject IPageService PageService
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
@inject IStringLocalizer<SharedResources> Localizer
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@foreach (var p in _pages)
|
@foreach (var p in _pages)
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
string url = NavigateUrl(p.Path);
|
string url = NavigateUrl(p.Path);
|
||||||
<div class="col-md-2 mx-auto text-center">
|
<div class="col-md-2 mx-auto text-center">
|
||||||
<NavLink class="nav-link" href="@url" Match="NavLinkMatch.All">
|
<NavLink class="nav-link" href="@url" Match="NavLinkMatch.All">
|
||||||
<h2><span class="@p.Icon" aria-hidden="true"></span></h2>@p.Name
|
<h2><span class="@p.Icon" aria-hidden="true"></span></h2>@Localizer[p.Name]
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,10 @@ else
|
||||||
{
|
{
|
||||||
AddModuleMessage(Localizer["The Only Supported Culture That Has Been Defined Is English"], MessageType.Warning);
|
AddModuleMessage(Localizer["The Only Supported Culture That Has Been Defined Is English"], MessageType.Warning);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_supportedCultures = _supportedCultures.Where(c => !c.Name.Equals(Constants.DefaultCulture));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveLanguage()
|
private async Task SaveLanguage()
|
||||||
|
|
|
@ -288,7 +288,7 @@
|
||||||
Page page = null;
|
Page page = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && _containertype != "-")
|
if (!string.IsNullOrEmpty(_name) && !string.IsNullOrEmpty(_themetype) && _containertype != "-")
|
||||||
{
|
{
|
||||||
page = new Page();
|
page = new Page();
|
||||||
page.SiteId = PageState.Page.SiteId;
|
page.SiteId = PageState.Page.SiteId;
|
||||||
|
|
|
@ -58,12 +58,16 @@ else
|
||||||
<Pager Items="@userroles">
|
<Pager Items="@userroles">
|
||||||
<Header>
|
<Header>
|
||||||
<th>@Localizer["Users"]</th>
|
<th>@Localizer["Users"]</th>
|
||||||
|
<th>@Localizer["Effective"]</th>
|
||||||
|
<th>@Localizer["Expiry"]</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td>@context.User.DisplayName</td>
|
<td>@context.User.DisplayName</td>
|
||||||
|
<td>@context.EffectiveDate</td>
|
||||||
|
<td>@context.ExpiryDate</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>@Localizer["Delete"]</button>
|
<ActionDialog Header="Remove User" Message="@Localizer["Are You Sure You Wish To Remove {0} From This Role?", context.User.DisplayName]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUserRole(context.UserRoleId))" Disabled="@(context.Role.IsAutoAssigned)" ResourceKey="DeleteUserRole" />
|
||||||
</td>
|
</td>
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
|
@ -140,9 +144,10 @@ else
|
||||||
await UserRoleService.AddUserRoleAsync(userrole);
|
await UserRoleService.AddUserRoleAsync(userrole);
|
||||||
}
|
}
|
||||||
|
|
||||||
await GetUserRoles();
|
|
||||||
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
|
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
|
||||||
AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
|
AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
|
||||||
|
await GetUserRoles();
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -161,9 +166,10 @@ else
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
|
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
|
||||||
await GetUserRoles();
|
|
||||||
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
|
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
|
||||||
AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
|
AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
|
||||||
|
await GetUserRoles();
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,60 +127,17 @@ else
|
||||||
<Label For="databaseType" HelpText="Select the database type for the tenant" ResourceKey="DatabaseType">Database Type: </Label>
|
<Label For="databaseType" HelpText="Select the database type for the tenant" ResourceKey="DatabaseType">Database Type: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="databaseType" class="custom-select" @bind="@_databaseType">
|
<select id="databaseType" class="custom-select" value="@_databaseName" @onchange="(e => DatabaseChanged(e))">
|
||||||
@{
|
@foreach (var database in _databases)
|
||||||
foreach (var database in Databases)
|
|
||||||
{
|
{
|
||||||
<option value="@database.Name">@Localizer[@database.FriendlyName]</option>
|
<option value="@database.Name">@Localizer[@database.FriendlyName]</option>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
if (_databaseConfigType != null)
|
||||||
{
|
{
|
||||||
_selectedDatabase = Databases.Single(d => d.Name == _databaseType);
|
@DatabaseConfigComponent;
|
||||||
foreach (var field in _selectedDatabase.ConnectionStringFields)
|
|
||||||
{
|
|
||||||
var fieldId = field.Name.ToLowerInvariant();
|
|
||||||
if (field.Name != "IntegratedSecurity")
|
|
||||||
{
|
|
||||||
var isVisible = "";
|
|
||||||
var fieldType = (field.Name == "Pwd") ? "password" : "text";
|
|
||||||
if ((field.Name == "Uid" || field.Name == "Pwd") && _selectedDatabase.Name != "MySQL" )
|
|
||||||
{
|
|
||||||
var intSecurityField = _selectedDatabase.ConnectionStringFields.Single(f => f.Name == "IntegratedSecurity");
|
|
||||||
if (intSecurityField != null)
|
|
||||||
{
|
|
||||||
isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm"));
|
|
||||||
|
|
||||||
<tr style="@isVisible">
|
|
||||||
<td>
|
|
||||||
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input id="@fieldId" type="@fieldType" class="form-control" @bind="@field.Value" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<Label For="@fieldId" HelpText="@field.HelpText" ResourceKey="@field.Name">@Localizer[$"{field.FriendlyName}:"]</Label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<select id="@fieldId" class="custom-select" @bind="@field.Value">
|
|
||||||
<option value="true" selected>@Localizer["True"]</option>
|
|
||||||
<option value="false">@Localizer["False"]</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -205,6 +162,13 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
private IList<Database> _databases;
|
||||||
|
private string _databaseName = "LocalDB";
|
||||||
|
private Type _databaseConfigType;
|
||||||
|
private object _databaseConfig;
|
||||||
|
private RenderFragment DatabaseConfigComponent { get; set; }
|
||||||
|
|
||||||
|
|
||||||
private List<Theme> _themeList;
|
private List<Theme> _themeList;
|
||||||
private List<ThemeControl> _themes = new List<ThemeControl>();
|
private List<ThemeControl> _themes = new List<ThemeControl>();
|
||||||
private List<ThemeControl> _containers = new List<ThemeControl>();
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
|
@ -213,8 +177,6 @@ else
|
||||||
private string _tenantid = "-";
|
private string _tenantid = "-";
|
||||||
|
|
||||||
private string _tenantName = string.Empty;
|
private string _tenantName = string.Empty;
|
||||||
private IOqtaneDatabase _selectedDatabase;
|
|
||||||
private string _databaseType = "LocalDB";
|
|
||||||
|
|
||||||
private string _hostUserName = UserNames.Host;
|
private string _hostUserName = UserNames.Host;
|
||||||
private string _hostpassword = string.Empty;
|
private string _hostpassword = string.Empty;
|
||||||
|
@ -235,6 +197,72 @@ else
|
||||||
_themeList = await ThemeService.GetThemesAsync();
|
_themeList = await ThemeService.GetThemesAsync();
|
||||||
_themes = ThemeService.GetThemeControls(_themeList);
|
_themes = ThemeService.GetThemeControls(_themeList);
|
||||||
_siteTemplates = await SiteTemplateService.GetSiteTemplatesAsync();
|
_siteTemplates = await SiteTemplateService.GetSiteTemplatesAsync();
|
||||||
|
|
||||||
|
_databases = new List<Database>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "LocalDB",
|
||||||
|
FriendlyName = "Local Database",
|
||||||
|
Type = "Oqtane.Installer.Controls.LocalDBConfig, Oqtane.Client"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "SqlServer",
|
||||||
|
FriendlyName = "SQL Server",
|
||||||
|
Type = "Oqtane.Installer.Controls.SqlServerConfig, Oqtane.Client"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "Sqlite",
|
||||||
|
FriendlyName = "Sqlite",
|
||||||
|
Type = "Oqtane.Installer.Controls.SqliteConfig, Oqtane.Client"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "MySQL",
|
||||||
|
FriendlyName = "MySQL",
|
||||||
|
Type = "Oqtane.Installer.Controls.MySQLConfig, Oqtane.Client"
|
||||||
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Name = "PostgreSQL",
|
||||||
|
FriendlyName = "PostgreSQL",
|
||||||
|
Type = "Oqtane.Installer.Controls.PostGreSQLConfig, Oqtane.Client"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LoadDatabaseConfigComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DatabaseChanged(ChangeEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_databaseName = (string)eventArgs.Value;
|
||||||
|
|
||||||
|
LoadDatabaseConfigComponent();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
AddModuleMessage(Localizer["Error loading Database Configuration Control"], MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadDatabaseConfigComponent()
|
||||||
|
{
|
||||||
|
var database = _databases.SingleOrDefault(d => d.Name == _databaseName);
|
||||||
|
if (database != null)
|
||||||
|
{
|
||||||
|
_databaseConfigType = Type.GetType(database.Type);
|
||||||
|
DatabaseConfigComponent = builder =>
|
||||||
|
{
|
||||||
|
builder.OpenComponent(0, _databaseConfigType);
|
||||||
|
builder.AddAttribute(1, "IsInstaller", false);
|
||||||
|
builder.AddComponentReferenceCapture(2, inst => { _databaseConfig = Convert.ChangeType(inst, _databaseConfigType); });
|
||||||
|
builder.CloseComponent();
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TenantChanged(ChangeEventArgs e)
|
private void TenantChanged(ChangeEventArgs e)
|
||||||
|
@ -301,10 +329,14 @@ else
|
||||||
user = await UserService.LoginUserAsync(user, false, false);
|
user = await UserService.LoginUserAsync(user, false, false);
|
||||||
if (user.IsAuthenticated)
|
if (user.IsAuthenticated)
|
||||||
{
|
{
|
||||||
var connectionString = _selectedDatabase.BuildConnectionString();
|
var connectionString = String.Empty;
|
||||||
|
if (_databaseConfig is IDatabaseConfigControl databaseConfigControl)
|
||||||
|
{
|
||||||
|
connectionString = databaseConfigControl.GetConnectionString();
|
||||||
|
}
|
||||||
if (connectionString != "")
|
if (connectionString != "")
|
||||||
{
|
{
|
||||||
config.DatabaseType = _databaseType;
|
config.DatabaseType = _databaseName;
|
||||||
config.ConnectionString = connectionString;
|
config.ConnectionString = connectionString;
|
||||||
config.HostPassword = _hostpassword;
|
config.HostPassword = _hostpassword;
|
||||||
config.HostEmail = user.Email;
|
config.HostEmail = user.Email;
|
||||||
|
|
|
@ -131,7 +131,10 @@
|
||||||
{
|
{
|
||||||
if (password == confirm)
|
if (password == confirm)
|
||||||
{
|
{
|
||||||
var user = new User();
|
var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
user = new User();
|
||||||
user.SiteId = PageState.Site.SiteId;
|
user.SiteId = PageState.Site.SiteId;
|
||||||
user.Username = username;
|
user.Username = username;
|
||||||
user.Password = password;
|
user.Password = password;
|
||||||
|
@ -150,7 +153,12 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await logger.LogError("Error Adding User {Username} {Email}", username, email);
|
await logger.LogError("Error Adding User {Username} {Email}", username, email);
|
||||||
AddModuleMessage(Localizer["Error Adding User. Please Ensure Password Meets Complexity Requirements And Username Is Not Already In Use."], MessageType.Error);
|
AddModuleMessage(Localizer["Error Adding User. Please Ensure Password Meets Complexity Requirements And Username And Email Are Not Already In Use."], MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddModuleMessage(Localizer["Username Already Exists"], MessageType.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -13,10 +13,15 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col">
|
||||||
<ActionLink Action="Add" Text="Add User" ResourceKey="AddUser" />
|
<ActionLink Action="Add" Text="Add User" ResourceKey="AddUser" />
|
||||||
|
</div>
|
||||||
<div class="d-flex p-1">
|
<div class="col">
|
||||||
<input class="form-control mr-4" @bind="@_search" /><button class="btn btn-outline-primary ml-1" @onclick="OnSearch">@Localizer["Search"]</button>
|
<div class="input-group flex-nowrap">
|
||||||
|
<input class="form-control" @bind="@_search" /> <button class="btn btn-secondary" @onclick="OnSearch">@Localizer["Search"]</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Pager Items="@userroles">
|
<Pager Items="@userroles">
|
||||||
|
@ -31,7 +36,7 @@ else
|
||||||
<ActionLink Action="Edit" Parameters="@($"id=" + context.UserId.ToString())" ResourceKey="EditUser" />
|
<ActionLink Action="Edit" Parameters="@($"id=" + context.UserId.ToString())" ResourceKey="EditUser" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ActionDialog Header="Delete User" Message="@Localizer["Are You Sure You Wish To Delete {0}?", context.User.DisplayName]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUser(context))" ResourceKey="DeleteUser" />
|
<ActionDialog Header="Delete User" Message="@Localizer["Are You Sure You Wish To Delete {0}?", context.User.DisplayName]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUser(context))" Disabled="@(context.Role.Name == RoleNames.Host)" ResourceKey="DeleteUser" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ActionLink Action="Roles" Parameters="@($"id=" + context.UserId.ToString())" ResourceKey="Roles" />
|
<ActionLink Action="Roles" Parameters="@($"id=" + context.UserId.ToString())" ResourceKey="Roles" />
|
||||||
|
@ -57,19 +62,19 @@ else
|
||||||
|
|
||||||
private List<UserRole> Search(string search)
|
private List<UserRole> Search(string search)
|
||||||
{
|
{
|
||||||
|
var results = allroles.Where(item => item.Role.Name == RoleNames.Registered || (item.Role.Name == RoleNames.Host && UserSecurity.IsAuthorized(PageState.User, RoleNames.Host)));
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(_search))
|
if (string.IsNullOrEmpty(_search))
|
||||||
{
|
{
|
||||||
return allroles.Where(item => item.Role.Name == RoleNames.Registered).ToList();
|
results = results.Where(item =>
|
||||||
}
|
|
||||||
return allroles
|
|
||||||
.Where(item => item.Role.Name == RoleNames.Registered &&
|
|
||||||
(
|
(
|
||||||
item.User.Username.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
item.User.Username.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
||||||
item.User.Email.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
item.User.Email.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
||||||
item.User.DisplayName.Contains(search, StringComparison.OrdinalIgnoreCase)
|
item.User.DisplayName.Contains(search, StringComparison.OrdinalIgnoreCase)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
.ToList();
|
}
|
||||||
|
return results.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnSearch()
|
private async Task OnSearch()
|
||||||
|
|
|
@ -59,15 +59,16 @@ else
|
||||||
<Pager Items="@userroles">
|
<Pager Items="@userroles">
|
||||||
<Header>
|
<Header>
|
||||||
<th>@Localizer["Roles"]</th>
|
<th>@Localizer["Roles"]</th>
|
||||||
|
<th>@Localizer["Effective"]</th>
|
||||||
|
<th>@Localizer["Expiry"]</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td>@context.Role.Name</td>
|
<td>@context.Role.Name</td>
|
||||||
|
<td>@context.EffectiveDate</td>
|
||||||
|
<td>@context.ExpiryDate</td>
|
||||||
<td>
|
<td>
|
||||||
@if (context.Role.Name != RoleNames.Registered)
|
<ActionDialog Header="Remove Role" Message="@Localizer["Are You Sure You Wish To Remove This User From The {0} Role?", context.Role.Name]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUserRole(context.UserRoleId))" Disabled="@(context.Role.IsAutoAssigned || (context.Role.Name == RoleNames.Host && userid == PageState.User.UserId))" ResourceKey="DeleteUserRole" />
|
||||||
{
|
|
||||||
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>@Localizer["Delete"]</button>
|
|
||||||
}
|
|
||||||
</td>
|
</td>
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
|
@ -92,7 +93,15 @@ else
|
||||||
userid = Int32.Parse(PageState.QueryString["id"]);
|
userid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
User user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
|
User user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
|
||||||
name = user.DisplayName;
|
name = user.DisplayName;
|
||||||
|
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||||
|
{
|
||||||
|
roles = await RoleService.GetRolesAsync(PageState.Site.SiteId, true);
|
||||||
|
roles = roles.Where(item => item.Name != RoleNames.Everyone).ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
roles = await RoleService.GetRolesAsync(PageState.Site.SiteId);
|
roles = await RoleService.GetRolesAsync(PageState.Site.SiteId);
|
||||||
|
}
|
||||||
await GetUserRoles();
|
await GetUserRoles();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -171,9 +180,10 @@ else
|
||||||
await UserRoleService.AddUserRoleAsync(userrole);
|
await UserRoleService.AddUserRoleAsync(userrole);
|
||||||
}
|
}
|
||||||
|
|
||||||
await GetUserRoles();
|
|
||||||
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
|
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
|
||||||
AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
|
AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
|
||||||
|
await GetUserRoles();
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -192,9 +202,10 @@ else
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
|
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
|
||||||
await GetUserRoles();
|
|
||||||
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
|
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
|
||||||
AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
|
AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
|
||||||
|
await GetUserRoles();
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,17 +86,6 @@ namespace Oqtane.Client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dynamically register database providers
|
|
||||||
var databaseTypes = assembly.GetInterfaces<IOqtaneDatabase>();
|
|
||||||
foreach (var databaseType in databaseTypes)
|
|
||||||
{
|
|
||||||
if (databaseType.AssemblyQualifiedName != null)
|
|
||||||
{
|
|
||||||
var serviceType = Type.GetType("Oqtane.Interfaces.IDatabase, Oqtane.Shared");
|
|
||||||
builder.Services.AddScoped(serviceType ?? databaseType, databaseType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// register client startup services
|
// register client startup services
|
||||||
var startUps = assembly.GetInstances<IClientStartup>();
|
var startUps = assembly.GetInstances<IClientStartup>();
|
||||||
foreach (var startup in startUps)
|
foreach (var startup in startUps)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
Task<List<Role>> GetRolesAsync(int siteId);
|
Task<List<Role>> GetRolesAsync(int siteId);
|
||||||
|
|
||||||
|
Task<List<Role>> GetRolesAsync(int siteId, bool includeGlobalRoles);
|
||||||
|
|
||||||
Task<Role> GetRoleAsync(int roleId);
|
Task<Role> GetRoleAsync(int roleId);
|
||||||
|
|
||||||
Task<Role> AddRoleAsync(Role role);
|
Task<Role> AddRoleAsync(Role role);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -22,7 +22,12 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Role>> GetRolesAsync(int siteId)
|
public async Task<List<Role>> GetRolesAsync(int siteId)
|
||||||
{
|
{
|
||||||
List<Role> roles = await GetJsonAsync<List<Role>>($"{Apiurl}?siteid={siteId}");
|
return await GetRolesAsync(siteId, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<Role>> GetRolesAsync(int siteId, bool includeGlobalRoles)
|
||||||
|
{
|
||||||
|
List<Role> roles = await GetJsonAsync<List<Role>>($"{Apiurl}?siteid={siteId}&global={includeGlobalRoles}");
|
||||||
return roles.OrderBy(item => item.Name).ToList();
|
return roles.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,12 @@
|
||||||
module.PageId = PageState.Page.PageId;
|
module.PageId = PageState.Page.PageId;
|
||||||
module.ModuleDefinitionName = ModuleDefinitionName;
|
module.ModuleDefinitionName = ModuleDefinitionName;
|
||||||
module.AllPages = false;
|
module.AllPages = false;
|
||||||
module.Permissions = PageState.Page.Permissions;
|
|
||||||
|
// set module view permissions to page edit permissions
|
||||||
|
List<PermissionString> permissions = UserSecurity.GetPermissionStrings(PageState.Page.Permissions);
|
||||||
|
permissions.Find(p => p.PermissionName == PermissionNames.View).Permissions = permissions.Find(p => p.PermissionName == PermissionNames.Edit).Permissions;
|
||||||
|
module.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
||||||
|
|
||||||
module = await ModuleService.AddModuleAsync(module);
|
module = await ModuleService.AddModuleAsync(module);
|
||||||
ModuleId = module.ModuleId.ToString();
|
ModuleId = module.ModuleId.ToString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
var languages = await LanguageService.GetLanguagesAsync(PageState.Site.SiteId);
|
var languages = await LanguageService.GetLanguagesAsync(PageState.Site.SiteId);
|
||||||
|
var defaultCulture = CultureInfo.GetCultureInfo(Constants.DefaultCulture);
|
||||||
|
|
||||||
|
languages.Add(new Language { Code = defaultCulture.Name, Name = defaultCulture.DisplayName });
|
||||||
|
|
||||||
_supportedCultures = languages.Select(l => new Culture { Name = l.Code, DisplayName = l.Name });
|
_supportedCultures = languages.Select(l => new Culture { Name = l.Code, DisplayName = l.Name });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<ModuleActions />
|
<ModuleActions />
|
||||||
}
|
}
|
||||||
<div class="row px-4">
|
<div class="row px-4">
|
||||||
<div class="container">
|
<div class="container-fluid">
|
||||||
<ModuleInstance />
|
<ModuleInstance />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
public override string Name => "Customizable Container";
|
public override string Name => "Customizable Container";
|
||||||
|
|
||||||
private bool _title = true;
|
private bool _title = true;
|
||||||
private string _classes = "container";
|
private string _classes = "container-fluid";
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,10 +93,15 @@
|
||||||
<Pane Name="Bottom Full Width" />
|
<Pane Name="Bottom Full Width" />
|
||||||
@if (_footer)
|
@if (_footer)
|
||||||
{
|
{
|
||||||
<div class="bg-primary footer">
|
<div style="clear: both; height: 30px;"></div>
|
||||||
|
<div class="bg-primary fixed-bottom footer">
|
||||||
<Pane Name="Footer" />
|
<Pane Name="Footer" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<Pane Name="Footer" />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="title" ResourceKey="Title" HelpText="Specify If The Page Footer Should Be Displayed">Display Footer?</Label>
|
<Label For="footer" ResourceKey="Footer" HelpText="Specify If A Footer Should Always Be Displayed In A Fixed Location At The Bottom Of The Browser Window">Display Fixed Footer?</Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="title" class="form-control" @bind="@_footer">
|
<select id="footer" class="form-control" @bind="@_footer">
|
||||||
<option value="true">Yes</option>
|
<option value="true">Yes</option>
|
||||||
<option value="false">No</option>
|
<option value="false">No</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -21,3 +21,4 @@
|
||||||
@using Oqtane.Themes.Controls
|
@using Oqtane.Themes.Controls
|
||||||
@using Oqtane.UI
|
@using Oqtane.UI
|
||||||
@using Oqtane.Enums
|
@using Oqtane.Enums
|
||||||
|
@using Oqtane.Installer
|
||||||
|
|
|
@ -15,16 +15,7 @@ namespace Oqtane.Database.MySQL
|
||||||
|
|
||||||
private static string _name => "MySQL";
|
private static string _name => "MySQL";
|
||||||
|
|
||||||
private static readonly List<ConnectionStringField> _connectionStringFields = new()
|
public MySQLDatabase() :base(_name, _friendlyName) { }
|
||||||
{
|
|
||||||
new() {Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText="Enter the database server"},
|
|
||||||
new() {Name = "Port", FriendlyName = "Port", Value = "3306", HelpText="Enter the port used to connect to the server"},
|
|
||||||
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"},
|
|
||||||
new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"},
|
|
||||||
new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"}
|
|
||||||
};
|
|
||||||
|
|
||||||
public MySQLDatabase() :base(_name, _friendlyName, _connectionStringFields) { }
|
|
||||||
|
|
||||||
public override string Provider => "MySql.EntityFrameworkCore";
|
public override string Provider => "MySql.EntityFrameworkCore";
|
||||||
|
|
||||||
|
@ -33,28 +24,6 @@ namespace Oqtane.Database.MySQL
|
||||||
return table.Column<int>(name: name, nullable: false).Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn);
|
return table.Column<int>(name: name, nullable: false).Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string BuildConnectionString()
|
|
||||||
{
|
|
||||||
var connectionString = String.Empty;
|
|
||||||
|
|
||||||
var server = ConnectionStringFields[0].Value;
|
|
||||||
var port = ConnectionStringFields[1].Value;
|
|
||||||
var database = ConnectionStringFields[2].Value;
|
|
||||||
var userId = ConnectionStringFields[3].Value;
|
|
||||||
var password = ConnectionStringFields[4].Value;
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
connectionString = $"Server={server};Database={database};Uid={userId};Pwd={password};";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(port))
|
|
||||||
{
|
|
||||||
connectionString += $"Port={port};";
|
|
||||||
}
|
|
||||||
return connectionString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ConcatenateSql(params string[] values)
|
public override string ConcatenateSql(params string[] values)
|
||||||
{
|
{
|
||||||
var returnValue = "CONCAT(";
|
var returnValue = "CONCAT(";
|
||||||
|
|
|
@ -20,17 +20,7 @@ namespace Oqtane.Database.PostgreSQL
|
||||||
|
|
||||||
private readonly INameRewriter _rewriter;
|
private readonly INameRewriter _rewriter;
|
||||||
|
|
||||||
private static readonly List<ConnectionStringField> _connectionStringFields = new()
|
public PostgreSQLDatabase() : base(_name, _friendlyName)
|
||||||
{
|
|
||||||
new() {Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText="Enter the database server"},
|
|
||||||
new() {Name = "Port", FriendlyName = "Port", Value = "5432", HelpText="Enter the port used to connect to the server"},
|
|
||||||
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"},
|
|
||||||
new() {Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText="Select if you want integrated security or not"},
|
|
||||||
new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"},
|
|
||||||
new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"}
|
|
||||||
};
|
|
||||||
|
|
||||||
public PostgreSQLDatabase() : base(_name, _friendlyName, _connectionStringFields)
|
|
||||||
{
|
{
|
||||||
_rewriter = new SnakeCaseNameRewriter(CultureInfo.InvariantCulture);
|
_rewriter = new SnakeCaseNameRewriter(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
@ -42,41 +32,6 @@ namespace Oqtane.Database.PostgreSQL
|
||||||
return table.Column<int>(name: name, nullable: false).Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
return table.Column<int>(name: name, nullable: false).Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string BuildConnectionString()
|
|
||||||
{
|
|
||||||
var connectionString = String.Empty;
|
|
||||||
|
|
||||||
var server = ConnectionStringFields[0].Value;
|
|
||||||
var port = ConnectionStringFields[1].Value;
|
|
||||||
var database = ConnectionStringFields[2].Value;
|
|
||||||
var integratedSecurity = Boolean.Parse(ConnectionStringFields[3].Value);
|
|
||||||
var userId = ConnectionStringFields[4].Value;
|
|
||||||
var password = ConnectionStringFields[5].Value;
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(port))
|
|
||||||
{
|
|
||||||
connectionString = $"Server={server};Port={port};Database={database};";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (integratedSecurity)
|
|
||||||
{
|
|
||||||
connectionString += "Integrated Security=true;";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
connectionString += $"User ID={userId};Password={password};";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
connectionString = String.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return connectionString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ConcatenateSql(params string[] values)
|
public override string ConcatenateSql(params string[] values)
|
||||||
{
|
{
|
||||||
var returnValue = String.Empty;
|
var returnValue = String.Empty;
|
||||||
|
|
|
@ -9,27 +9,6 @@ namespace Oqtane.Repository.Databases
|
||||||
private static string _friendlyName => "Local Database";
|
private static string _friendlyName => "Local Database";
|
||||||
private static string _name => "LocalDB";
|
private static string _name => "LocalDB";
|
||||||
|
|
||||||
private static readonly List<ConnectionStringField> _connectionStringFields = new()
|
public LocalDbDatabase() :base(_name, _friendlyName) { }
|
||||||
{
|
|
||||||
new() {Name = "Server", FriendlyName = "Server", Value = "(LocalDb)\\MSSQLLocalDB", HelpText="Enter the database server"},
|
|
||||||
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"}
|
|
||||||
};
|
|
||||||
|
|
||||||
public LocalDbDatabase() :base(_name, _friendlyName, _connectionStringFields) { }
|
|
||||||
|
|
||||||
public override string BuildConnectionString()
|
|
||||||
{
|
|
||||||
var connectionString = String.Empty;
|
|
||||||
|
|
||||||
var server = ConnectionStringFields[0].Value;
|
|
||||||
var database = ConnectionStringFields[1].Value;
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database))
|
|
||||||
{
|
|
||||||
connectionString = $"Data Source={server};AttachDbFilename=|DataDirectory|\\{database}.mdf;Initial Catalog={database};Integrated Security=SSPI;";
|
|
||||||
}
|
|
||||||
|
|
||||||
return connectionString;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,50 +10,6 @@ namespace Oqtane.Repository.Databases
|
||||||
|
|
||||||
private static string _name => "SqlServer";
|
private static string _name => "SqlServer";
|
||||||
|
|
||||||
private static readonly List<ConnectionStringField> _connectionStringFields = new()
|
public SqlServerDatabase() :base(_name, _friendlyName) { }
|
||||||
{
|
|
||||||
new() {Name = "Server", FriendlyName = "Server", Value = ".", HelpText="Enter the database server"},
|
|
||||||
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"},
|
|
||||||
new() {Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText="Select if you want integrated security or not"},
|
|
||||||
new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"},
|
|
||||||
new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"}
|
|
||||||
};
|
|
||||||
|
|
||||||
public SqlServerDatabase() :base(_name, _friendlyName, _connectionStringFields) { }
|
|
||||||
|
|
||||||
public override string BuildConnectionString()
|
|
||||||
{
|
|
||||||
var connectionString = String.Empty;
|
|
||||||
|
|
||||||
var server = ConnectionStringFields[0].Value;
|
|
||||||
var database = ConnectionStringFields[1].Value;
|
|
||||||
var integratedSecurity = Boolean.Parse(ConnectionStringFields[2].Value);
|
|
||||||
var userId = ConnectionStringFields[3].Value;
|
|
||||||
var password = ConnectionStringFields[4].Value;
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database))
|
|
||||||
{
|
|
||||||
connectionString = $"Data Source={server};Initial Catalog={database};";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (integratedSecurity)
|
|
||||||
{
|
|
||||||
connectionString += "Integrated Security=SSPI;";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
connectionString += $"User ID={userId};Password={password};";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
connectionString = String.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return connectionString;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Oqtane.Repository.Databases
|
||||||
{
|
{
|
||||||
public abstract class SqlServerDatabaseBase : OqtaneDatabaseBase
|
public abstract class SqlServerDatabaseBase : OqtaneDatabaseBase
|
||||||
{
|
{
|
||||||
protected SqlServerDatabaseBase(string name, string friendlyName, List<ConnectionStringField> connectionStringFields) : base(name, friendlyName, connectionStringFields)
|
protected SqlServerDatabaseBase(string name, string friendlyName) : base(name, friendlyName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,7 @@ namespace Oqtane.Repository.Databases
|
||||||
|
|
||||||
private static string _name => "Sqlite";
|
private static string _name => "Sqlite";
|
||||||
|
|
||||||
private static readonly List<ConnectionStringField> _connectionStringFields = new()
|
public SqliteDatabase() :base(_name, _friendlyName) { }
|
||||||
{
|
|
||||||
new() {Name = "Server", FriendlyName = "File Name", Value = "Oqtane-{{Date}}.db", HelpText="Enter the file name to use for the database"}
|
|
||||||
};
|
|
||||||
|
|
||||||
public SqliteDatabase() :base(_name, _friendlyName, _connectionStringFields) { }
|
|
||||||
|
|
||||||
public override string Provider => "Microsoft.EntityFrameworkCore.Sqlite";
|
public override string Provider => "Microsoft.EntityFrameworkCore.Sqlite";
|
||||||
|
|
||||||
|
@ -28,20 +23,6 @@ namespace Oqtane.Repository.Databases
|
||||||
return table.Column<int>(name: name, nullable: false).Annotation("Sqlite:Autoincrement", true);
|
return table.Column<int>(name: name, nullable: false).Annotation("Sqlite:Autoincrement", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string BuildConnectionString()
|
|
||||||
{
|
|
||||||
var connectionstring = String.Empty;
|
|
||||||
|
|
||||||
var server = ConnectionStringFields[0].Value;
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(server))
|
|
||||||
{
|
|
||||||
connectionstring = $"Data Source={server};";
|
|
||||||
}
|
|
||||||
|
|
||||||
return connectionstring;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ConcatenateSql(params string[] values)
|
public override string ConcatenateSql(params string[] values)
|
||||||
{
|
{
|
||||||
var returnValue = String.Empty;
|
var returnValue = String.Empty;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
|
@ -21,12 +21,16 @@ namespace Oqtane.Controllers
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/<controller>?siteid=x
|
// GET: api/<controller>?siteid=x&global=true/false
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Roles = RoleNames.Registered)]
|
[Authorize(Roles = RoleNames.Registered)]
|
||||||
public IEnumerable<Role> Get(string siteid)
|
public IEnumerable<Role> Get(string siteid, string global)
|
||||||
{
|
{
|
||||||
return _roles.GetRoles(int.Parse(siteid));
|
if (string.IsNullOrEmpty(global))
|
||||||
|
{
|
||||||
|
global = "False";
|
||||||
|
}
|
||||||
|
return _roles.GetRoles(int.Parse(siteid), bool.Parse(global));
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
|
@ -67,9 +71,13 @@ namespace Oqtane.Controllers
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = RoleNames.Admin)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
|
{
|
||||||
|
var role = _roles.GetRole(id);
|
||||||
|
if (!role.IsSystem)
|
||||||
{
|
{
|
||||||
_roles.DeleteRole(id);
|
_roles.DeleteRole(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Role Deleted {RoleId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Role Deleted {RoleId}", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
|
@ -6,6 +6,7 @@ using Oqtane.Models;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
|
@ -13,13 +14,15 @@ namespace Oqtane.Controllers
|
||||||
public class UserRoleController : Controller
|
public class UserRoleController : Controller
|
||||||
{
|
{
|
||||||
private readonly IUserRoleRepository _userRoles;
|
private readonly IUserRoleRepository _userRoles;
|
||||||
|
private readonly IRoleRepository _roles;
|
||||||
private readonly ITenantResolver _tenants;
|
private readonly ITenantResolver _tenants;
|
||||||
private readonly ISyncManager _syncManager;
|
private readonly ISyncManager _syncManager;
|
||||||
private readonly ILogManager _logger;
|
private readonly ILogManager _logger;
|
||||||
|
|
||||||
public UserRoleController(IUserRoleRepository userRoles, ITenantResolver tenants, ISyncManager syncManager, ILogManager logger)
|
public UserRoleController(IUserRoleRepository userRoles, IRoleRepository roles, ITenantResolver tenants, ISyncManager syncManager, ILogManager logger)
|
||||||
{
|
{
|
||||||
_userRoles = userRoles;
|
_userRoles = userRoles;
|
||||||
|
_roles = roles;
|
||||||
_syncManager = syncManager;
|
_syncManager = syncManager;
|
||||||
_tenants = tenants;
|
_tenants = tenants;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
@ -46,11 +49,20 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = RoleNames.Admin)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public UserRole Post([FromBody] UserRole userRole)
|
public UserRole Post([FromBody] UserRole userRole)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
var role = _roles.GetRole(userRole.RoleId);
|
||||||
|
if (ModelState.IsValid && (User.IsInRole(RoleNames.Host) || role.Name != RoleNames.Host))
|
||||||
{
|
{
|
||||||
|
if (role.Name == RoleNames.Host)
|
||||||
|
{
|
||||||
|
// host roles can only exist at global level - remove all site specific user roles
|
||||||
|
_userRoles.DeleteUserRoles(userRole.UserId);
|
||||||
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Roles Deleted For UserId {UserId}", userRole.UserId);
|
||||||
|
}
|
||||||
|
|
||||||
userRole = _userRoles.AddUserRole(userRole);
|
userRole = _userRoles.AddUserRole(userRole);
|
||||||
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", userRole);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", userRole);
|
||||||
|
|
||||||
|
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
|
||||||
}
|
}
|
||||||
return userRole;
|
return userRole;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +72,8 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = RoleNames.Admin)]
|
[Authorize(Roles = RoleNames.Admin)]
|
||||||
public UserRole Put(int id, [FromBody] UserRole userRole)
|
public UserRole Put(int id, [FromBody] UserRole userRole)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
var role = _roles.GetRole(userRole.RoleId);
|
||||||
|
if (ModelState.IsValid && (User.IsInRole(RoleNames.Host) || role.Name != RoleNames.Host))
|
||||||
{
|
{
|
||||||
userRole = _userRoles.UpdateUserRole(userRole);
|
userRole = _userRoles.UpdateUserRole(userRole);
|
||||||
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
|
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
|
||||||
|
@ -75,9 +88,24 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
UserRole userRole = _userRoles.GetUserRole(id);
|
UserRole userRole = _userRoles.GetUserRole(id);
|
||||||
|
if (User.IsInRole(RoleNames.Host) || userRole.Role.Name != RoleNames.Host)
|
||||||
|
{
|
||||||
_userRoles.DeleteUserRole(id);
|
_userRoles.DeleteUserRole(id);
|
||||||
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Role Deleted {UserRole}", userRole);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Role Deleted {UserRole}", userRole);
|
||||||
|
|
||||||
|
if (userRole.Role.Name == RoleNames.Host)
|
||||||
|
{
|
||||||
|
// add site specific user roles to preserve user access
|
||||||
|
var role = _roles.GetRoles(_tenants.GetAlias().SiteId).FirstOrDefault(item => item.Name == RoleNames.Registered);
|
||||||
|
userRole = _userRoles.AddUserRole(new UserRole { UserId = userRole.UserId, RoleId = role.RoleId, EffectiveDate = null, ExpiryDate = null });
|
||||||
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", userRole);
|
||||||
|
role = _roles.GetRoles(_tenants.GetAlias().SiteId).FirstOrDefault(item => item.Name == RoleNames.Admin);
|
||||||
|
userRole = _userRoles.AddUserRole(new UserRole { UserId = userRole.UserId, RoleId = role.RoleId, EffectiveDate = null, ExpiryDate = null });
|
||||||
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", userRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Oqtane.Infrastructure
|
||||||
public static bool InstallPackages(string folders, string webRootPath, string contentRootPath)
|
public static bool InstallPackages(string folders, string webRootPath, string contentRootPath)
|
||||||
{
|
{
|
||||||
bool install = false;
|
bool install = false;
|
||||||
string binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
string binPath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||||
|
|
||||||
foreach (string folder in folders.Split(','))
|
foreach (string folder in folders.Split(','))
|
||||||
{
|
{
|
||||||
|
@ -82,40 +82,37 @@ namespace Oqtane.Infrastructure
|
||||||
List<string> assets = new List<string>();
|
List<string> assets = new List<string>();
|
||||||
bool manifest = false;
|
bool manifest = false;
|
||||||
|
|
||||||
// module and theme packages must be in form of name.1.0.0.nupkg
|
// packages are in form of name.1.0.0.nupkg or name.culture.1.0.0.nupkg
|
||||||
string name = Path.GetFileNameWithoutExtension(packagename);
|
string name = Path.GetFileNameWithoutExtension(packagename);
|
||||||
string[] segments = name?.Split('.');
|
string[] segments = name?.Split('.');
|
||||||
if (segments != null) name = string.Join('.', segments, 0, segments.Length - 3);
|
if (segments != null) name = string.Join('.', segments, 0, segments.Length - 3); // remove version information
|
||||||
|
|
||||||
// deploy to appropriate locations
|
// deploy to appropriate locations
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||||
{
|
{
|
||||||
string foldername = Path.GetDirectoryName(entry.FullName).Split(Path.DirectorySeparatorChar)[0];
|
string filename = "";
|
||||||
string filename = Path.GetFileName(entry.FullName);
|
|
||||||
|
|
||||||
if (!manifest && filename == "assets.json")
|
// evaluate entry root folder
|
||||||
|
switch (entry.FullName.Split('/')[0])
|
||||||
|
{
|
||||||
|
case "lib": // lib/net5.0/...
|
||||||
|
filename = ExtractFile(entry, binPath, 2);
|
||||||
|
break;
|
||||||
|
case "wwwroot": // wwwroot/...
|
||||||
|
filename = ExtractFile(entry, webRootPath, 1);
|
||||||
|
break;
|
||||||
|
case "runtimes": // runtimes/name/...
|
||||||
|
filename = ExtractFile(entry, binPath, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filename != "")
|
||||||
|
{
|
||||||
|
assets.Add(filename.Replace(contentRootPath, ""));
|
||||||
|
if (!manifest && Path.GetFileName(filename) == "assets.json")
|
||||||
{
|
{
|
||||||
manifest = true;
|
manifest = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (foldername)
|
|
||||||
{
|
|
||||||
case "lib":
|
|
||||||
filename = Path.Combine(binFolder, filename);
|
|
||||||
ExtractFile(entry, filename);
|
|
||||||
assets.Add(filename.Replace(contentRootPath, ""));
|
|
||||||
break;
|
|
||||||
case "wwwroot":
|
|
||||||
filename = Path.Combine(webRootPath, Utilities.PathCombine(entry.FullName.Replace("wwwroot/", "").Split('/')));
|
|
||||||
ExtractFile(entry, filename);
|
|
||||||
assets.Add(filename.Replace(contentRootPath, ""));
|
|
||||||
break;
|
|
||||||
case "runtimes":
|
|
||||||
var destSubFolder = Path.GetDirectoryName(entry.FullName);
|
|
||||||
filename = Path.Combine(binFolder, destSubFolder, filename);
|
|
||||||
ExtractFile(entry, filename);
|
|
||||||
assets.Add(filename.Replace(contentRootPath, ""));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,21 +142,25 @@ namespace Oqtane.Infrastructure
|
||||||
return install;
|
return install;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ExtractFile(ZipArchiveEntry entry, string filename)
|
private static string ExtractFile(ZipArchiveEntry entry, string folder, int ignoreLeadingSegments)
|
||||||
|
{
|
||||||
|
string[] segments = entry.FullName.Split('/'); // ZipArchiveEntries always use unix path separator
|
||||||
|
string filename = Path.Combine(folder, string.Join(Path.DirectorySeparatorChar, segments, ignoreLeadingSegments, segments.Length - ignoreLeadingSegments));
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
entry.ExtractToFile(filename, true);
|
entry.ExtractToFile(filename, true);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// an error occurred extracting the file
|
// an error occurred extracting the file
|
||||||
|
filename = "";
|
||||||
}
|
}
|
||||||
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpgradeFramework()
|
public void UpgradeFramework()
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
|
@ -9,7 +11,7 @@ namespace Oqtane.Infrastructure
|
||||||
public class LocalizationManager : ILocalizationManager
|
public class LocalizationManager : ILocalizationManager
|
||||||
{
|
{
|
||||||
private static readonly string DefaultCulture = Constants.DefaultCulture;
|
private static readonly string DefaultCulture = Constants.DefaultCulture;
|
||||||
private static readonly string[] SupportedCultures = new[] { DefaultCulture };
|
private static readonly string[] DefaultSupportedCultures = new[] { DefaultCulture };
|
||||||
|
|
||||||
private readonly LocalizationOptions _localizationOptions;
|
private readonly LocalizationOptions _localizationOptions;
|
||||||
|
|
||||||
|
@ -19,25 +21,19 @@ namespace Oqtane.Infrastructure
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetDefaultCulture()
|
public string GetDefaultCulture()
|
||||||
=> string.IsNullOrEmpty(_localizationOptions.DefaultCulture)
|
=> String.IsNullOrEmpty(_localizationOptions.DefaultCulture)
|
||||||
? DefaultCulture
|
? DefaultCulture
|
||||||
: _localizationOptions.DefaultCulture;
|
: _localizationOptions.DefaultCulture;
|
||||||
|
|
||||||
public string[] GetSupportedCultures()
|
public string[] GetSupportedCultures()
|
||||||
{
|
{
|
||||||
List<string> cultures = new List<string>();
|
var cultures = new List<string>(DefaultSupportedCultures);
|
||||||
foreach(var file in Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Oqtane.Client.resources.dll", SearchOption.AllDirectories))
|
foreach(var file in Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Oqtane.Client.resources.dll", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
cultures.Add(Path.GetFileName(Path.GetDirectoryName(file)));
|
cultures.Add(Path.GetFileName(Path.GetDirectoryName(file)));
|
||||||
}
|
}
|
||||||
if (cultures.Count == 0)
|
|
||||||
{
|
return cultures.OrderBy(c => c).ToArray();
|
||||||
return SupportedCultures;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return cultures.ToArray();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,15 +22,22 @@ namespace Oqtane.Migrations
|
||||||
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
|
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
siteEntityBuilder.Create();
|
siteEntityBuilder.Create();
|
||||||
|
|
||||||
|
//Add Column to Site table (for Sql Server only) we will drop it later for Sql Server only
|
||||||
|
if (ActiveDatabase.Name == "SqlServer" || ActiveDatabase.Name == "LocalDB")
|
||||||
|
{
|
||||||
|
siteEntityBuilder.AddStringColumn("DefaultLayoutType", 200, true);
|
||||||
|
}
|
||||||
|
|
||||||
//Create Page table
|
//Create Page table
|
||||||
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
|
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
pageEntityBuilder.Create();
|
pageEntityBuilder.Create();
|
||||||
pageEntityBuilder.AddIndex("IX_Page", new [] {"SiteId", "Path", "UserId"}, true);
|
pageEntityBuilder.AddIndex("IX_Page", new [] {"SiteId", "Path", "UserId"}, true);
|
||||||
|
|
||||||
//Add Column to Page table (for Sql Server only) we will drop it later for Sql Server only
|
//Add Columns to Page table (for Sql Server only) we will drop them later for Sql Server only
|
||||||
if (ActiveDatabase.Name == "SqlServer" || ActiveDatabase.Name == "LocalDB")
|
if (ActiveDatabase.Name == "SqlServer" || ActiveDatabase.Name == "LocalDB")
|
||||||
{
|
{
|
||||||
pageEntityBuilder.AddBooleanColumn("EditMode");
|
pageEntityBuilder.AddBooleanColumn("EditMode");
|
||||||
|
pageEntityBuilder.AddStringColumn("LayoutType", 200, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create Module table
|
//Create Module table
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Oqtane.Interfaces;
|
||||||
|
using Oqtane.Migrations.EntityBuilders;
|
||||||
|
using Oqtane.Repository;
|
||||||
|
|
||||||
|
namespace Oqtane.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(TenantDBContext))]
|
||||||
|
[Migration("Tenant.02.00.02.02")]
|
||||||
|
public class UpdateDefaultContainerTypeInSitePage : MultiDatabaseMigration
|
||||||
|
{
|
||||||
|
public UpdateDefaultContainerTypeInSitePage(IEnumerable<IOqtaneDatabase> databases) : base(databases)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
if (ActiveDatabase.Name == "SqlServer" || ActiveDatabase.Name == "LocalDB")
|
||||||
|
{
|
||||||
|
//Update DefaultContainerType In Site
|
||||||
|
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
siteEntityBuilder.UpdateColumn("DefaultContainerType", "'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client'", "DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'");
|
||||||
|
siteEntityBuilder.UpdateColumn("DefaultContainerType", "'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client'", "DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.NoTitle, Oqtane.Client'");
|
||||||
|
|
||||||
|
//Update DefaultContainerType in Page
|
||||||
|
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
pageEntityBuilder.UpdateColumn("DefaultContainerType", "'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client'", "DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'");
|
||||||
|
pageEntityBuilder.UpdateColumn("DefaultContainerType", "'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client'", "DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.NoTitle, Oqtane.Client'");
|
||||||
|
|
||||||
|
//Update ContainerType in PageModule
|
||||||
|
var pageModuleEntityBuilder = new PageModuleEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
pageModuleEntityBuilder.UpdateColumn("ContainerType", "'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client'", "ContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'");
|
||||||
|
pageModuleEntityBuilder.UpdateColumn("ContainerType", "'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client'", "ContainerType = 'Oqtane.Themes.OqtaneTheme.NoTitle, Oqtane.Client'");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
53
Oqtane.Server/Migrations/02000203_DropDefaultLayoutInSite.cs
Normal file
53
Oqtane.Server/Migrations/02000203_DropDefaultLayoutInSite.cs
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Oqtane.Interfaces;
|
||||||
|
using Oqtane.Migrations.EntityBuilders;
|
||||||
|
using Oqtane.Repository;
|
||||||
|
|
||||||
|
namespace Oqtane.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(TenantDBContext))]
|
||||||
|
[Migration("Tenant.02.00.02.03")]
|
||||||
|
public class DropDefaultLayoutInSite : MultiDatabaseMigration
|
||||||
|
{
|
||||||
|
public DropDefaultLayoutInSite(IEnumerable<IOqtaneDatabase> databases) : base(databases)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
if (ActiveDatabase.Name == "SqlServer" || ActiveDatabase.Name == "LocalDB")
|
||||||
|
{
|
||||||
|
//Alter Column in Setting table for Sql Server
|
||||||
|
var settingEntityBuilder = new SettingEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
settingEntityBuilder.DropIndex("IX_Setting");
|
||||||
|
settingEntityBuilder.AlterStringColumn("SettingName", 200);
|
||||||
|
settingEntityBuilder.AddIndex("IX_Setting", new [] {"EntityName", "EntityId", "SettingName"}, true);
|
||||||
|
|
||||||
|
//Drop Column from Site Table
|
||||||
|
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
siteEntityBuilder.DropColumn("DefaultLayoutType");
|
||||||
|
|
||||||
|
//Update DefaultContainerType In Site
|
||||||
|
siteEntityBuilder.UpdateColumn("DefaultContainerType", "'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'", "DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client'");
|
||||||
|
siteEntityBuilder.UpdateColumn("DefaultContainerType", "'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'", "DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client'");
|
||||||
|
|
||||||
|
//Drop Column from Page Table
|
||||||
|
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
pageEntityBuilder.DropColumn("LayoutType");
|
||||||
|
|
||||||
|
//Update DefaultContainerType in Page
|
||||||
|
pageEntityBuilder.UpdateColumn("DefaultContainerType", "'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'", "DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client'");
|
||||||
|
pageEntityBuilder.UpdateColumn("DefaultContainerType", "'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'", "DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client'");
|
||||||
|
|
||||||
|
|
||||||
|
//Update ContainerType in PageModule
|
||||||
|
var pageModuleEntityBuilder = new PageModuleEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
pageModuleEntityBuilder.UpdateColumn("ContainerType", "'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'", "ContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client'");
|
||||||
|
pageModuleEntityBuilder.UpdateColumn("ContainerType", "'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client'", "ContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client'");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,6 @@ namespace Oqtane.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(TenantDBContext))]
|
[DbContext(typeof(TenantDBContext))]
|
||||||
[Migration("Tenant.02.01.00.00")]
|
[Migration("Tenant.02.01.00.00")]
|
||||||
|
|
||||||
public class AddAppVersionsTable : MultiDatabaseMigration
|
public class AddAppVersionsTable : MultiDatabaseMigration
|
||||||
{
|
{
|
||||||
public AddAppVersionsTable(IEnumerable<IOqtaneDatabase> databases) : base(databases)
|
public AddAppVersionsTable(IEnumerable<IOqtaneDatabase> databases) : base(databases)
|
||||||
|
|
|
@ -41,7 +41,6 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
Order = AddIntegerColumn(table,"Order");
|
Order = AddIntegerColumn(table,"Order");
|
||||||
IsNavigation = AddBooleanColumn(table,"IsNavigation");
|
IsNavigation = AddBooleanColumn(table,"IsNavigation");
|
||||||
Url = AddStringColumn(table,"Url", 500, true);
|
Url = AddStringColumn(table,"Url", 500, true);
|
||||||
LayoutType = AddStringColumn(table,"LayoutType", 200);
|
|
||||||
UserId = AddIntegerColumn(table,"UserId", true);
|
UserId = AddIntegerColumn(table,"UserId", true);
|
||||||
IsPersonalizable = AddBooleanColumn(table,"IsPersonalizable");
|
IsPersonalizable = AddBooleanColumn(table,"IsPersonalizable");
|
||||||
DefaultContainerType = AddStringColumn(table,"DefaultContainerType", 200, true);
|
DefaultContainerType = AddStringColumn(table,"DefaultContainerType", 200, true);
|
||||||
|
@ -73,8 +72,6 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> Url { get; private set; }
|
public OperationBuilder<AddColumnOperation> Url { get; private set; }
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> LayoutType { get; private set; }
|
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> UserId { get; private set; }
|
public OperationBuilder<AddColumnOperation> UserId { get; private set; }
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> IsPersonalizable { get; private set; }
|
public OperationBuilder<AddColumnOperation> IsPersonalizable { get; private set; }
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
SettingId = AddAutoIncrementColumn(table,"SettingId");
|
SettingId = AddAutoIncrementColumn(table,"SettingId");
|
||||||
EntityName = AddStringColumn(table,"EntityName", 50);
|
EntityName = AddStringColumn(table,"EntityName", 50);
|
||||||
EntityId = AddIntegerColumn(table,"EntityId");
|
EntityId = AddIntegerColumn(table,"EntityId");
|
||||||
SettingName = AddStringColumn(table,"SettingName", 50);
|
SettingName = AddStringColumn(table,"SettingName", 200);
|
||||||
SettingValue = AddMaxStringColumn(table,"SettingValue");
|
SettingValue = AddMaxStringColumn(table,"SettingValue");
|
||||||
|
|
||||||
AddAuditableColumns(table);
|
AddAuditableColumns(table);
|
||||||
|
|
|
@ -27,7 +27,6 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
LogoFileId = AddIntegerColumn(table,"LogoFileId", true);
|
LogoFileId = AddIntegerColumn(table,"LogoFileId", true);
|
||||||
FaviconFileId = AddIntegerColumn(table,"FaviconFileId", true);
|
FaviconFileId = AddIntegerColumn(table,"FaviconFileId", true);
|
||||||
DefaultThemeType = AddStringColumn(table,"DefaultThemeType", 200);
|
DefaultThemeType = AddStringColumn(table,"DefaultThemeType", 200);
|
||||||
DefaultLayoutType = AddStringColumn(table,"DefaultLayoutType", 200);
|
|
||||||
DefaultContainerType = AddStringColumn(table,"DefaultContainerType", 200);
|
DefaultContainerType = AddStringColumn(table,"DefaultContainerType", 200);
|
||||||
PwaIsEnabled = AddBooleanColumn(table,"PwaIsEnabled");
|
PwaIsEnabled = AddBooleanColumn(table,"PwaIsEnabled");
|
||||||
PwaAppIconFileId = AddIntegerColumn(table,"PwaAppIconFileId", true);
|
PwaAppIconFileId = AddIntegerColumn(table,"PwaAppIconFileId", true);
|
||||||
|
@ -52,8 +51,6 @@ namespace Oqtane.Migrations.EntityBuilders
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> DefaultThemeType { get; private set; }
|
public OperationBuilder<AddColumnOperation> DefaultThemeType { get; private set; }
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> DefaultLayoutType { get; private set; }
|
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> DefaultContainerType { get; private set; }
|
public OperationBuilder<AddColumnOperation> DefaultContainerType { get; private set; }
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> PwaIsEnabled { get; private set; }
|
public OperationBuilder<AddColumnOperation> PwaIsEnabled { get; private set; }
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
CREATE TABLE [dbo].[HtmlText](
|
|
||||||
[HtmlTextId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[ModuleId] [int] NOT NULL,
|
|
||||||
[Content] [nvarchar](max) NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_HtmlText] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[HtmlTextId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[HtmlText] WITH CHECK ADD CONSTRAINT [FK_HtmlText_Module] FOREIGN KEY([ModuleId])
|
|
||||||
REFERENCES [dbo].[Module] ([ModuleId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
|
@ -1,2 +0,0 @@
|
||||||
DROP TABLE [dbo].[HtmlText]
|
|
||||||
GO
|
|
|
@ -25,25 +25,6 @@
|
||||||
<EmbeddedResource Remove="wwwroot\Themes\Templates\**" />
|
<EmbeddedResource Remove="wwwroot\Themes\Templates\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Scripts\Master.00.00.00.00.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Master.00.09.00.00.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Master.01.00.01.00.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.00.00.00.00.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.00.09.00.00.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.00.09.01.00.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.00.09.02.00.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.01.00.01.00.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.01.00.01.01.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.01.00.02.01.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.00.01.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.01.01.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.01.02.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.01.03.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.02.01.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.02.02.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.02.03.sql" />
|
|
||||||
<EmbeddedResource Include="Modules\HtmlText\Scripts\HtmlText.1.0.0.sql" />
|
|
||||||
<EmbeddedResource Include="Modules\HtmlText\Scripts\HtmlText.Uninstall.sql" />
|
|
||||||
<EmbeddedResource Include="Scripts\MigrateMaster.sql" />
|
<EmbeddedResource Include="Scripts\MigrateMaster.sql" />
|
||||||
<EmbeddedResource Include="Scripts\MigrateTenant.sql" />
|
<EmbeddedResource Include="Scripts\MigrateTenant.sql" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -65,8 +65,8 @@ namespace Oqtane.Repository
|
||||||
break; // found a matching alias
|
break; // found a matching alias
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// return fallback alias
|
||||||
return alias;
|
return alias ?? aliases.Find(item => item.Name.Equals("*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteAlias(int aliasId)
|
public void DeleteAlias(int aliasId)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
|
||||||
namespace Oqtane.Repository
|
namespace Oqtane.Repository
|
||||||
|
@ -11,5 +11,6 @@ namespace Oqtane.Repository
|
||||||
UserRole UpdateUserRole(UserRole userRole);
|
UserRole UpdateUserRole(UserRole userRole);
|
||||||
UserRole GetUserRole(int userRoleId);
|
UserRole GetUserRole(int userRoleId);
|
||||||
void DeleteUserRole(int userRoleId);
|
void DeleteUserRole(int userRoleId);
|
||||||
|
void DeleteUserRoles(int userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
@ -16,13 +16,20 @@ namespace Oqtane.Repository
|
||||||
|
|
||||||
public IEnumerable<Role> GetRoles(int siteId)
|
public IEnumerable<Role> GetRoles(int siteId)
|
||||||
{
|
{
|
||||||
return _db.Role.Where(item => item.SiteId == siteId);
|
return GetRoles(siteId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Role> GetRoles(int siteId, bool includeGlobalRoles)
|
public IEnumerable<Role> GetRoles(int siteId, bool includeGlobalRoles)
|
||||||
|
{
|
||||||
|
if (includeGlobalRoles)
|
||||||
{
|
{
|
||||||
return _db.Role.Where(item => item.SiteId == siteId || item.SiteId == null);
|
return _db.Role.Where(item => item.SiteId == siteId || item.SiteId == null);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _db.Role.Where(item => item.SiteId == siteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Role AddRole(Role role)
|
public Role AddRole(Role role)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
using Oqtane.Extensions;
|
using Oqtane.Extensions;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
@ -24,9 +25,7 @@ namespace Oqtane.Repository
|
||||||
private readonly IModuleRepository _moduleRepository;
|
private readonly IModuleRepository _moduleRepository;
|
||||||
private readonly IPageModuleRepository _pageModuleRepository;
|
private readonly IPageModuleRepository _pageModuleRepository;
|
||||||
private readonly IModuleDefinitionRepository _moduleDefinitionRepository;
|
private readonly IModuleDefinitionRepository _moduleDefinitionRepository;
|
||||||
|
|
||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
|
|
||||||
private readonly IConfigurationRoot _config;
|
private readonly IConfigurationRoot _config;
|
||||||
|
|
||||||
public SiteRepository(TenantDBContext context, IRoleRepository roleRepository, IProfileRepository profileRepository, IFolderRepository folderRepository, IPageRepository pageRepository,
|
public SiteRepository(TenantDBContext context, IRoleRepository roleRepository, IProfileRepository profileRepository, IFolderRepository folderRepository, IPageRepository pageRepository,
|
||||||
|
@ -68,7 +67,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Login.Index).ToModuleDefinitionName(), Title = "User Login", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Login.Index).ToModuleDefinitionName(), Title = SharedResources.UserLogin, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -97,7 +96,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Register.Index).ToModuleDefinitionName(), Title = "User Registration", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Register.Index).ToModuleDefinitionName(), Title = SharedResources.UserRegistration, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -127,7 +126,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Reset.Index).ToModuleDefinitionName(), Title = "Password Reset", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Reset.Index).ToModuleDefinitionName(), Title = SharedResources.PasswordReset, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -156,7 +155,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.UserProfile.Index).ToModuleDefinitionName(), Title = "User Profile", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.UserProfile.Index).ToModuleDefinitionName(), Title = SharedResources.UserProfile, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -181,7 +180,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Dashboard.Index).ToModuleDefinitionName(), Title = "Admin Dashboard", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Dashboard.Index).ToModuleDefinitionName(), Title = SharedResources.AdminDashboard, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -208,7 +207,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Site.Index).ToModuleDefinitionName(), Title = "Site Settings", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Site.Index).ToModuleDefinitionName(), Title = SharedResources.SiteSettings, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -235,7 +234,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Pages.Index).ToModuleDefinitionName(), Title = "Page Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Pages.Index).ToModuleDefinitionName(), Title = SharedResources.PageManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -262,7 +261,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Users.Index).ToModuleDefinitionName(), Title = "User Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Users.Index).ToModuleDefinitionName(), Title = SharedResources.UserManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -289,7 +288,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Profiles.Index).ToModuleDefinitionName(), Title = "Profile Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Profiles.Index).ToModuleDefinitionName(), Title = SharedResources.ProfileManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -316,7 +315,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Roles.Index).ToModuleDefinitionName(), Title = "Role Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Roles.Index).ToModuleDefinitionName(), Title = SharedResources.RoleManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -343,7 +342,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Files.Index).ToModuleDefinitionName(), Title = "File Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Files.Index).ToModuleDefinitionName(), Title = SharedResources.FileManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -370,7 +369,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.RecycleBin.Index).ToModuleDefinitionName(), Title = "Recycle Bin", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.RecycleBin.Index).ToModuleDefinitionName(), Title = SharedResources.RecycleBin, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
@ -399,7 +398,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Logs.Index).ToModuleDefinitionName(), Title = "Event Log", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Logs.Index).ToModuleDefinitionName(), Title = SharedResources.EventLog, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -421,7 +420,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Sites.Index).ToModuleDefinitionName(), Title = "Site Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Sites.Index).ToModuleDefinitionName(), Title = SharedResources.SiteManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -443,7 +442,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.ModuleDefinitions.Index).ToModuleDefinitionName(), Title = "Module Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.ModuleDefinitions.Index).ToModuleDefinitionName(), Title = SharedResources.ModuleManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -465,7 +464,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Themes.Index).ToModuleDefinitionName(), Title = "Theme Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Themes.Index).ToModuleDefinitionName(), Title = SharedResources.ThemeManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -494,7 +493,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Languages.Index).ToModuleDefinitionName(), Title = "Language Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Languages.Index).ToModuleDefinitionName(), Title = SharedResources.LanguageManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -518,7 +517,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Jobs.Index).ToModuleDefinitionName(), Title = "Scheduled Jobs", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Jobs.Index).ToModuleDefinitionName(), Title = SharedResources.ScheduledJobs, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -540,7 +539,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Sql.Index).ToModuleDefinitionName(), Title = "Sql Management", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Sql.Index).ToModuleDefinitionName(), Title = SharedResources.SqlManagement, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -562,7 +561,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.SystemInfo.Index).ToModuleDefinitionName(), Title = "System Info", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.SystemInfo.Index).ToModuleDefinitionName(), Title = SharedResources.SystemInfo, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -584,7 +583,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
new PageTemplateModule
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Upgrade.Index).ToModuleDefinitionName(), Title = "System Update", Pane = PaneNames.Admin,
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Upgrade.Index).ToModuleDefinitionName(), Title = SharedResources.SystemUpdate, Pane = PaneNames.Admin,
|
||||||
ModulePermissions = new List<Permission>
|
ModulePermissions = new List<Permission>
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
new Permission(PermissionNames.View, RoleNames.Host, true),
|
||||||
|
@ -649,9 +648,9 @@ namespace Oqtane.Repository
|
||||||
_roleRepository.AddRole(new Role {SiteId = site.SiteId, Name = RoleNames.Admin, Description = "Site Administrators", IsAutoAssigned = false, IsSystem = true});
|
_roleRepository.AddRole(new Role {SiteId = site.SiteId, Name = RoleNames.Admin, Description = "Site Administrators", IsAutoAssigned = false, IsSystem = true});
|
||||||
|
|
||||||
_profileRepository.AddProfile(new Profile
|
_profileRepository.AddProfile(new Profile
|
||||||
{SiteId = site.SiteId, Name = "FirstName", Title = "First Name", Description = "Your First Or Given Name", Category = "Name", ViewOrder = 1, MaxLength = 50, DefaultValue = "", IsRequired = true, IsPrivate = false});
|
{SiteId = site.SiteId, Name = "FirstName", Title = "First Name", Description = "Your First Or Given Name", Category = "Name", ViewOrder = 1, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false});
|
||||||
_profileRepository.AddProfile(new Profile
|
_profileRepository.AddProfile(new Profile
|
||||||
{SiteId = site.SiteId, Name = "LastName", Title = "Last Name", Description = "Your Last Or Family Name", Category = "Name", ViewOrder = 2, MaxLength = 50, DefaultValue = "", IsRequired = true, IsPrivate = false});
|
{SiteId = site.SiteId, Name = "LastName", Title = "Last Name", Description = "Your Last Or Family Name", Category = "Name", ViewOrder = 2, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false});
|
||||||
_profileRepository.AddProfile(new Profile
|
_profileRepository.AddProfile(new Profile
|
||||||
{SiteId = site.SiteId, Name = "Street", Title = "Street", Description = "Street Or Building Address", Category = "Address", ViewOrder = 3, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false});
|
{SiteId = site.SiteId, Name = "Street", Title = "Street", Description = "Street Or Building Address", Category = "Address", ViewOrder = 3, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false});
|
||||||
_profileRepository.AddProfile(
|
_profileRepository.AddProfile(
|
||||||
|
|
|
@ -58,5 +58,14 @@ namespace Oqtane.Repository
|
||||||
_db.UserRole.Remove(userRole);
|
_db.UserRole.Remove(userRole);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteUserRoles(int userId)
|
||||||
|
{
|
||||||
|
foreach (UserRole userRole in _db.UserRole.Where(item => item.Role.SiteId != null))
|
||||||
|
{
|
||||||
|
_db.UserRole.Remove(userRole);
|
||||||
|
}
|
||||||
|
_db.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
migrate to new naming convention for scripts
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
UPDATE [dbo].[SchemaVersions] SET ScriptName = 'Oqtane.Scripts.Master.00.09.00.00.sql' WHERE ScriptName = 'Oqtane.Scripts.Master.0.9.0.sql'
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[SchemaVersions] SET ScriptName = 'Oqtane.Scripts.Master.01.00.01.00.sql' WHERE ScriptName = 'Oqtane.Scripts.Master.1.0.1.sql'
|
|
||||||
GO
|
|
|
@ -1,110 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Create tables
|
|
||||||
|
|
||||||
*/
|
|
||||||
CREATE TABLE [dbo].[Tenant](
|
|
||||||
[TenantId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[Name] [nvarchar](100) NOT NULL,
|
|
||||||
[DBConnectionString] [nvarchar](1024) NOT NULL,
|
|
||||||
[Version] [nvarchar](50) NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Tenant] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[TenantId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Alias](
|
|
||||||
[AliasId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[Name] [nvarchar](200) NOT NULL,
|
|
||||||
[TenantId] [int] NOT NULL,
|
|
||||||
[SiteId] [int] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Alias] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[AliasId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[ModuleDefinition](
|
|
||||||
[ModuleDefinitionId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[ModuleDefinitionName] [nvarchar](200) NOT NULL,
|
|
||||||
[Name] [nvarchar](200) NULL,
|
|
||||||
[Description] [nvarchar](2000) NULL,
|
|
||||||
[Categories] [nvarchar](200) NULL,
|
|
||||||
[Version] [nvarchar](50) NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_ModuleDefinition] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[ModuleDefinitionId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Job] (
|
|
||||||
[JobId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[Name] [nvarchar](200) NOT NULL,
|
|
||||||
[JobType] [nvarchar](200) NOT NULL,
|
|
||||||
[Frequency] [char](1) NOT NULL,
|
|
||||||
[Interval] [int] NOT NULL,
|
|
||||||
[StartDate] [datetime] NULL,
|
|
||||||
[EndDate] [datetime] NULL,
|
|
||||||
[IsEnabled] [bit] NOT NULL,
|
|
||||||
[IsStarted] [bit] NOT NULL,
|
|
||||||
[IsExecuting] [bit] NOT NULL,
|
|
||||||
[NextExecution] [datetime] NULL,
|
|
||||||
[RetentionHistory] [int] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Job] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[JobId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[JobLog] (
|
|
||||||
[JobLogId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[JobId] [int] NOT NULL,
|
|
||||||
[StartDate] [datetime] NOT NULL,
|
|
||||||
[FinishDate] [datetime] NULL,
|
|
||||||
[Succeeded] [bit] NULL,
|
|
||||||
[Notes] [nvarchar](max) NULL,
|
|
||||||
CONSTRAINT [PK_JobLog] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[JobLogId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Create foreign key relationships
|
|
||||||
|
|
||||||
*/
|
|
||||||
ALTER TABLE [dbo].[Alias] WITH CHECK ADD CONSTRAINT [FK_Alias_Tenant] FOREIGN KEY([TenantId])
|
|
||||||
REFERENCES [dbo].[Tenant] ([TenantId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[JobLog] WITH NOCHECK ADD CONSTRAINT [FK_JobLog_Job] FOREIGN KEY([JobId])
|
|
||||||
REFERENCES [dbo].[Job] ([JobId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 1.0.1 Master migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Tenant ON [dbo].[Tenant]
|
|
||||||
(
|
|
||||||
[Name]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Alias ON [dbo].[Alias]
|
|
||||||
(
|
|
||||||
[Name]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_ModuleDefinition ON [dbo].[ModuleDefinition]
|
|
||||||
(
|
|
||||||
[ModuleDefinitionName]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Job ON [dbo].[Job]
|
|
||||||
(
|
|
||||||
[JobType]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
|
@ -1,14 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
migrate to new naming convention for scripts
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
UPDATE [dbo].[SchemaVersions] SET ScriptName = 'Oqtane.Scripts.Tenant.00.09.00.00.sql' WHERE ScriptName = 'Oqtane.Scripts.Tenant.0.9.0.sql'
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[SchemaVersions] SET ScriptName = 'Oqtane.Scripts.Tenant.00.09.01.00.sql' WHERE ScriptName = 'Oqtane.Scripts.Tenant.0.9.1.sql'
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[SchemaVersions] SET ScriptName = 'Oqtane.Scripts.Tenant.00.09.02.00.sql' WHERE ScriptName = 'Oqtane.Scripts.Tenant.0.9.2.sql'
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[SchemaVersions] SET ScriptName = 'Oqtane.Scripts.Tenant.01.00.01.00.sql' WHERE ScriptName = 'Oqtane.Scripts.Tenant.1.0.1.sql'
|
|
||||||
GO
|
|
|
@ -1,528 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Create tables
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Site](
|
|
||||||
[SiteId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[TenantId] [int] NOT NULL,
|
|
||||||
[Name] [nvarchar](200) NOT NULL,
|
|
||||||
[LogoFileId] [int] NULL,
|
|
||||||
[FaviconFileId] [int] NULL,
|
|
||||||
[DefaultThemeType] [nvarchar](200) NOT NULL,
|
|
||||||
[DefaultLayoutType] [nvarchar](200) NOT NULL,
|
|
||||||
[DefaultContainerType] [nvarchar](200) NOT NULL,
|
|
||||||
[PwaIsEnabled] [bit] NOT NULL,
|
|
||||||
[PwaAppIconFileId] [int] NULL,
|
|
||||||
[PwaSplashIconFileId] [int] NULL,
|
|
||||||
[AllowRegistration] [bit] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
[DeletedBy] [nvarchar](256) NULL,
|
|
||||||
[DeletedOn] [datetime] NULL,
|
|
||||||
[IsDeleted][bit] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Site] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[SiteId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Page](
|
|
||||||
[PageId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NOT NULL,
|
|
||||||
[Path] [nvarchar](50) NOT NULL,
|
|
||||||
[Name] [nvarchar](50) NOT NULL,
|
|
||||||
[Title] [nvarchar](200) NULL,
|
|
||||||
[ThemeType] [nvarchar](200) NULL,
|
|
||||||
[Icon] [nvarchar](50) NOT NULL,
|
|
||||||
[ParentId] [int] NULL,
|
|
||||||
[Order] [int] NOT NULL,
|
|
||||||
[IsNavigation] [bit] NOT NULL,
|
|
||||||
[Url] [nvarchar](500) NULL,
|
|
||||||
[LayoutType] [nvarchar](200) NOT NULL,
|
|
||||||
[EditMode] [bit] NOT NULL,
|
|
||||||
[UserId] [int] NULL,
|
|
||||||
[IsPersonalizable] [bit] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
[DeletedBy] [nvarchar](256) NULL,
|
|
||||||
[DeletedOn] [datetime] NULL,
|
|
||||||
[IsDeleted][bit] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Page] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[PageId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Module](
|
|
||||||
[ModuleId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NOT NULL,
|
|
||||||
[ModuleDefinitionName] [nvarchar](200) NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Module] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[ModuleId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[PageModule](
|
|
||||||
[PageModuleId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[PageId] [int] NOT NULL,
|
|
||||||
[ModuleId] [int] NOT NULL,
|
|
||||||
[Title] [nvarchar](200) NOT NULL,
|
|
||||||
[Pane] [nvarchar](50) NOT NULL,
|
|
||||||
[Order] [int] NOT NULL,
|
|
||||||
[ContainerType] [nvarchar](200) NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
[DeletedBy] [nvarchar](256) NULL,
|
|
||||||
[DeletedOn] [datetime] NULL,
|
|
||||||
[IsDeleted][bit] NOT NULL,
|
|
||||||
CONSTRAINT [PK_PageModule] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[PageModuleId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[User](
|
|
||||||
[UserId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[Username] [nvarchar](256) NOT NULL,
|
|
||||||
[DisplayName] [nvarchar](50) NOT NULL,
|
|
||||||
[Email] [nvarchar](256) NOT NULL,
|
|
||||||
[PhotoFileId] [int] NULL,
|
|
||||||
[LastLoginOn] [datetime] NULL,
|
|
||||||
[LastIPAddress] [nvarchar](50) NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
[DeletedBy] [nvarchar](256) NULL,
|
|
||||||
[DeletedOn] [datetime] NULL,
|
|
||||||
[IsDeleted][bit] NOT NULL,
|
|
||||||
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[UserId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Role](
|
|
||||||
[RoleId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NULL,
|
|
||||||
[Name] [nvarchar](256) NOT NULL,
|
|
||||||
[Description] [nvarchar](50) NOT NULL,
|
|
||||||
[IsAutoAssigned] [bit] NOT NULL,
|
|
||||||
[IsSystem] [bit] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Role] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[RoleId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[UserRole](
|
|
||||||
[UserRoleId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[UserId] [int] NOT NULL,
|
|
||||||
[RoleId] [int] NOT NULL,
|
|
||||||
[EffectiveDate] [datetime] NULL,
|
|
||||||
[ExpiryDate] [datetime] NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_UserRole] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[UserRoleId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Permission](
|
|
||||||
[PermissionId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NOT NULL,
|
|
||||||
[EntityName] [nvarchar](50) NOT NULL,
|
|
||||||
[EntityId] [int] NOT NULL,
|
|
||||||
[PermissionName] [nvarchar](50) NOT NULL,
|
|
||||||
[RoleId] [int] NULL,
|
|
||||||
[UserId] [int] NULL,
|
|
||||||
[IsAuthorized] [bit] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Permission] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[PermissionId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Setting](
|
|
||||||
[SettingId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[EntityName] [nvarchar](50) NOT NULL,
|
|
||||||
[EntityId] [int] NOT NULL,
|
|
||||||
[SettingName] [nvarchar](50) NOT NULL,
|
|
||||||
[SettingValue] [nvarchar](max) NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Setting] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[SettingId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Profile](
|
|
||||||
[ProfileId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NULL,
|
|
||||||
[Name] [nvarchar](50) NOT NULL,
|
|
||||||
[Title] [nvarchar](50) NOT NULL,
|
|
||||||
[Description] [nvarchar](256) NULL,
|
|
||||||
[Category] [nvarchar](50) NOT NULL,
|
|
||||||
[ViewOrder] [int] NOT NULL,
|
|
||||||
[MaxLength] [int] NOT NULL,
|
|
||||||
[DefaultValue] [nvarchar](2000) NULL,
|
|
||||||
[IsRequired] [bit] NOT NULL,
|
|
||||||
[IsPrivate] [bit] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Profile] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[ProfileId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Log] (
|
|
||||||
|
|
||||||
[LogId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NULL,
|
|
||||||
[LogDate] [datetime] NOT NULL,
|
|
||||||
[PageId] [int] NULL,
|
|
||||||
[ModuleId] [int] NULL,
|
|
||||||
[UserId] [int] NULL,
|
|
||||||
[Url] [nvarchar](2048) NOT NULL,
|
|
||||||
[Server] [nvarchar](200) NOT NULL,
|
|
||||||
[Category] [nvarchar](200) NOT NULL,
|
|
||||||
[Feature] [nvarchar](200) NOT NULL,
|
|
||||||
[Function] [nvarchar](20) NOT NULL,
|
|
||||||
[Level] [nvarchar](20) NOT NULL,
|
|
||||||
[Message] [nvarchar](max) NOT NULL,
|
|
||||||
[MessageTemplate] [nvarchar](max) NOT NULL,
|
|
||||||
[Exception] [nvarchar](max) NULL,
|
|
||||||
[Properties] [nvarchar](max) NULL
|
|
||||||
|
|
||||||
CONSTRAINT [PK_Log] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[LogId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Notification](
|
|
||||||
[NotificationId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NOT NULL,
|
|
||||||
[FromUserId] [int] NULL,
|
|
||||||
[ToUserId] [int] NULL,
|
|
||||||
[ToEmail] [nvarchar](256) NOT NULL,
|
|
||||||
[Subject] [nvarchar](256) NOT NULL,
|
|
||||||
[Body] [nvarchar](max) NOT NULL,
|
|
||||||
[ParentId] [int] NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[IsDelivered] [bit] NOT NULL,
|
|
||||||
[DeliveredOn] [datetime] NULL,
|
|
||||||
[DeletedBy] [nvarchar](256) NULL,
|
|
||||||
[DeletedOn] [datetime] NULL,
|
|
||||||
[IsDeleted][bit] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Notification] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[NotificationId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Folder](
|
|
||||||
[FolderId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NOT NULL,
|
|
||||||
[Path] [nvarchar](50) NOT NULL,
|
|
||||||
[Name] [nvarchar](50) NOT NULL,
|
|
||||||
[ParentId] [int] NULL,
|
|
||||||
[Order] [int] NOT NULL,
|
|
||||||
[IsSystem] [bit] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
[DeletedBy] [nvarchar](256) NULL,
|
|
||||||
[DeletedOn] [datetime] NULL,
|
|
||||||
[IsDeleted][bit] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Folder] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[FolderId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[File](
|
|
||||||
[FileId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[FolderId] [int] NOT NULL,
|
|
||||||
[Name] [nvarchar](250) NOT NULL,
|
|
||||||
[Extension] [nvarchar](50) NOT NULL,
|
|
||||||
[Size] [int] NOT NULL,
|
|
||||||
[ImageHeight] [int] NOT NULL,
|
|
||||||
[ImageWidth] [int] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
[DeletedBy] [nvarchar](256) NULL,
|
|
||||||
[DeletedOn] [datetime] NULL,
|
|
||||||
[IsDeleted][bit] NOT NULL,
|
|
||||||
CONSTRAINT [PK_File] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[FileId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[HtmlText](
|
|
||||||
[HtmlTextId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[ModuleId] [int] NOT NULL,
|
|
||||||
[Content] [nvarchar](max) NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_HtmlText] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[HtmlTextId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Create foreign key relationships
|
|
||||||
|
|
||||||
*/
|
|
||||||
ALTER TABLE [dbo].[Module] WITH CHECK ADD CONSTRAINT [FK_Module_Site] FOREIGN KEY([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Page] WITH CHECK ADD CONSTRAINT [FK_Page_Site] FOREIGN KEY([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[PageModule] WITH CHECK ADD CONSTRAINT [FK_PageModule_Module] FOREIGN KEY([ModuleId])
|
|
||||||
REFERENCES [dbo].[Module] ([ModuleId])
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[PageModule] WITH CHECK ADD CONSTRAINT [FK_PageModule_Page] FOREIGN KEY([PageId])
|
|
||||||
REFERENCES [dbo].[Page] ([PageId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Role] WITH CHECK ADD CONSTRAINT [FK_Role_Site] FOREIGN KEY ([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[UserRole] WITH CHECK ADD CONSTRAINT [FK_UserRole_User] FOREIGN KEY ([UserId])
|
|
||||||
REFERENCES [dbo].[User] ([UserId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[UserRole] WITH CHECK ADD CONSTRAINT [FK_UserRole_Role] FOREIGN KEY ([RoleId])
|
|
||||||
REFERENCES [dbo].[Role] ([RoleId])
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Permission] WITH CHECK ADD CONSTRAINT [FK_Permission_Site] FOREIGN KEY ([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Permission] WITH CHECK ADD CONSTRAINT [FK_Permission_User] FOREIGN KEY ([UserId])
|
|
||||||
REFERENCES [dbo].[User] ([UserId])
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Permission] WITH CHECK ADD CONSTRAINT [FK_Permission_Role] FOREIGN KEY ([RoleId])
|
|
||||||
REFERENCES [dbo].[Role] ([RoleId])
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Profile] WITH NOCHECK ADD CONSTRAINT [FK_Profile_Sites] FOREIGN KEY([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Log] WITH CHECK ADD CONSTRAINT [FK_Log_Site] FOREIGN KEY([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Notification] WITH CHECK ADD CONSTRAINT [FK_Notification_Site] FOREIGN KEY([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Folder] WITH CHECK ADD CONSTRAINT [FK_Folder_Site] FOREIGN KEY([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[File] WITH CHECK ADD CONSTRAINT [FK_File_Folder] FOREIGN KEY([FolderId])
|
|
||||||
REFERENCES [dbo].[Folder] ([FolderId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[HtmlText] WITH CHECK ADD CONSTRAINT [FK_HtmlText_Module] FOREIGN KEY([ModuleId])
|
|
||||||
REFERENCES [dbo].[Module] ([ModuleId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Create indexes
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Setting ON [dbo].Setting
|
|
||||||
(
|
|
||||||
EntityName,
|
|
||||||
EntityId,
|
|
||||||
SettingName
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_User ON [dbo].[User]
|
|
||||||
(
|
|
||||||
Username
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Permission ON [dbo].Permission
|
|
||||||
(
|
|
||||||
SiteId,
|
|
||||||
EntityName,
|
|
||||||
EntityId,
|
|
||||||
PermissionName,
|
|
||||||
RoleId,
|
|
||||||
UserId
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Page ON [dbo].Page
|
|
||||||
(
|
|
||||||
SiteId,
|
|
||||||
[Path],
|
|
||||||
UserId
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_UserRole ON [dbo].UserRole
|
|
||||||
(
|
|
||||||
RoleId,
|
|
||||||
UserId
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Folder ON [dbo].Folder
|
|
||||||
(
|
|
||||||
SiteId,
|
|
||||||
[Path]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
ASP.NET Identity Minimal Schema
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[AspNetUsers](
|
|
||||||
[Id] [nvarchar](450) NOT NULL,
|
|
||||||
[UserName] [nvarchar](256) NULL,
|
|
||||||
[NormalizedUserName] [nvarchar](256) NULL,
|
|
||||||
[Email] [nvarchar](256) NULL,
|
|
||||||
[NormalizedEmail] [nvarchar](256) NULL,
|
|
||||||
[EmailConfirmed] [bit] NOT NULL,
|
|
||||||
[PasswordHash] [nvarchar](max) NULL,
|
|
||||||
[SecurityStamp] [nvarchar](max) NULL,
|
|
||||||
[ConcurrencyStamp] [nvarchar](max) NULL,
|
|
||||||
[PhoneNumber] [nvarchar](max) NULL,
|
|
||||||
[PhoneNumberConfirmed] [bit] NOT NULL,
|
|
||||||
[TwoFactorEnabled] [bit] NOT NULL,
|
|
||||||
[LockoutEnd] [datetimeoffset](7) NULL,
|
|
||||||
[LockoutEnabled] [bit] NOT NULL,
|
|
||||||
[AccessFailedCount] [int] NOT NULL,
|
|
||||||
CONSTRAINT [PK_AspNetUsers] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[Id] ASC
|
|
||||||
) ON [PRIMARY]
|
|
||||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[AspNetUserClaims](
|
|
||||||
[Id] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[UserId] [nvarchar](450) NOT NULL,
|
|
||||||
[ClaimType] [nvarchar](max) NULL,
|
|
||||||
[ClaimValue] [nvarchar](max) NULL,
|
|
||||||
CONSTRAINT [PK_AspNetUserClaims] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[Id] ASC
|
|
||||||
) ON [PRIMARY]
|
|
||||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [IX_AspNetUserClaims_UserId] ON [dbo].[AspNetUserClaims]
|
|
||||||
(
|
|
||||||
[UserId] ASC
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [EmailIndex] ON [dbo].[AspNetUsers]
|
|
||||||
(
|
|
||||||
[NormalizedEmail] ASC
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX [UserNameIndex] ON [dbo].[AspNetUsers]
|
|
||||||
(
|
|
||||||
[NormalizedUserName] ASC
|
|
||||||
)
|
|
||||||
WHERE ([NormalizedUserName] IS NOT NULL)
|
|
||||||
ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[AspNetUserClaims] WITH CHECK ADD CONSTRAINT [FK_AspNetUserClaims_AspNetUsers_UserId] FOREIGN KEY([UserId])
|
|
||||||
REFERENCES [dbo].[AspNetUsers] ([Id])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[AspNetUserClaims] CHECK CONSTRAINT [FK_AspNetUserClaims_AspNetUsers_UserId]
|
|
||||||
GO
|
|
|
@ -1,14 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 0.9.1 migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Module] ADD
|
|
||||||
[AllPages] [bit] NULL
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[Module]
|
|
||||||
SET [AllPages] = 0
|
|
||||||
GO
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 0.9.2 migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Role]
|
|
||||||
ALTER COLUMN [Description] VARCHAR (256) NOT NULL
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Page] ADD
|
|
||||||
[DefaultContainerType] [nvarchar](200) NULL
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[Page]
|
|
||||||
SET [DefaultContainerType] = ''
|
|
||||||
GO
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 1.0.1 Tenant migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Site ON [dbo].[Site]
|
|
||||||
(
|
|
||||||
[TenantId],
|
|
||||||
[Name]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Role ON [dbo].[Role]
|
|
||||||
(
|
|
||||||
[SiteId],
|
|
||||||
[Name]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Profile ON [dbo].[Profile]
|
|
||||||
(
|
|
||||||
[SiteId],
|
|
||||||
[Name]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_File ON [dbo].[File]
|
|
||||||
(
|
|
||||||
[FolderId],
|
|
||||||
[Name]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Notification] ADD
|
|
||||||
[FromDisplayName] [nvarchar](50) NULL,
|
|
||||||
[FromEmail] [nvarchar](256) NULL,
|
|
||||||
[ToDisplayName] [nvarchar](50) NULL
|
|
||||||
GO
|
|
|
@ -1,12 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 1.0.1 Notification migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Notification] ADD
|
|
||||||
[SendOn] [datetime] NULL
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[Notification] SET SendOn = CreatedOn WHERE SendOn IS NULL
|
|
||||||
GO
|
|
|
@ -1,9 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 1.0.2.1 migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Page]
|
|
||||||
DROP COLUMN EditMode
|
|
||||||
GO
|
|
|
@ -1,16 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 2.0.0 Tenant migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Page]
|
|
||||||
ALTER COLUMN [Path] [nvarchar](256) NOT NULL
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Profile] ADD
|
|
||||||
[Options] [nvarchar](2000) NULL
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[Profile] SET Options = ''
|
|
||||||
GO
|
|
|
@ -1,9 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 2.0.1 Tenant migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
UPDATE [dbo].[Page] SET Icon = IIF(Icon <> '', 'oi oi-' + Icon, '');
|
|
||||||
GO
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 2.0.1 Tenant migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Language](
|
|
||||||
[LanguageId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[Name] [nvarchar](100) NOT NULL,
|
|
||||||
[Code] [nvarchar](10) NOT NULL,
|
|
||||||
[IsDefault] [bit] NOT NULL,
|
|
||||||
[SiteId] [int] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_Language] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[LanguageId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Language] WITH CHECK ADD CONSTRAINT [FK_Language_Site] FOREIGN KEY([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 2.0.1 Tenant migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
DELETE FROM [dbo].[Page]
|
|
||||||
WHERE Path = 'admin/tenants';
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Site] ADD
|
|
||||||
[AdminContainerType] [nvarchar](200) NULL
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[Site] SET AdminContainerType = ''
|
|
||||||
GO
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 2.0.2 Tenant migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Site] ADD
|
|
||||||
[SiteGuid] [char](36) NULL
|
|
||||||
GO
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 2.0.2 Tenant migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
UPDATE [dbo].[Site] SET DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client' WHERE DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[Site] SET DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client' WHERE DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.NoTitle, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[Page] SET DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client' WHERE DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[Page] SET DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client' WHERE DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.NoTitle, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[PageModule] SET ContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client' WHERE ContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[PageModule] SET ContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client' WHERE ContainerType = 'Oqtane.Themes.OqtaneTheme.NoTitle, Oqtane.Client';
|
|
||||||
GO
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Version 2.0.2 Tenant migration script
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Setting] ALTER COLUMN [SettingName] [nvarchar](200) NOT NULL
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Site]
|
|
||||||
DROP COLUMN DefaultLayoutType
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Page]
|
|
||||||
DROP COLUMN LayoutType
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[Site] SET DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client' WHERE DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[Site] SET DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client' WHERE DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[Page] SET DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client' WHERE DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[Page] SET DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client' WHERE DefaultContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
|
|
||||||
UPDATE [dbo].[PageModule] SET ContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client' WHERE ContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultTitle, Oqtane.Client';
|
|
||||||
GO
|
|
||||||
UPDATE [dbo].[PageModule] SET ContainerType = 'Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client' WHERE ContainerType = 'Oqtane.Themes.OqtaneTheme.DefaultNoTitle, Oqtane.Client';
|
|
||||||
GO
|
|
|
@ -16,7 +16,6 @@
|
||||||
"DefaultContainer": ""
|
"DefaultContainer": ""
|
||||||
},
|
},
|
||||||
"Localization": {
|
"Localization": {
|
||||||
"DefaultCulture": "",
|
"DefaultCulture": "en"
|
||||||
"SupportedCultures": []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,13 @@
|
||||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="icon.png">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath></PackagePath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Client\[Owner].[Module].Client.csproj" />
|
<ProjectReference Include="..\Client\[Owner].[Module].Client.csproj" />
|
||||||
<ProjectReference Include="..\Server\[Owner].[Module].Server.csproj" />
|
<ProjectReference Include="..\Server\[Owner].[Module].Server.csproj" />
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
<icon>icon.png</icon>
|
||||||
<tags>oqtane module</tags>
|
<tags>oqtane module</tags>
|
||||||
<releaseNotes></releaseNotes>
|
<releaseNotes></releaseNotes>
|
||||||
<summary></summary>
|
<summary></summary>
|
||||||
|
@ -27,5 +27,6 @@
|
||||||
<file src="..\Shared\bin\Release\net5.0\[Owner].[Module].Shared.Oqtane.dll" target="lib\net5.0" />
|
<file src="..\Shared\bin\Release\net5.0\[Owner].[Module].Shared.Oqtane.dll" target="lib\net5.0" />
|
||||||
<file src="..\Shared\bin\Release\net5.0\[Owner].[Module].Shared.Oqtane.pdb" target="lib\net5.0" />
|
<file src="..\Shared\bin\Release\net5.0\[Owner].[Module].Shared.Oqtane.pdb" target="lib\net5.0" />
|
||||||
<file src="..\Server\wwwroot\**\*.*" target="wwwroot" />
|
<file src="..\Server\wwwroot\**\*.*" target="wwwroot" />
|
||||||
|
<file src="icon.png" target="" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
BIN
Oqtane.Server/wwwroot/Modules/Templates/External/Package/icon.png
vendored
Normal file
BIN
Oqtane.Server/wwwroot/Modules/Templates/External/Package/icon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
|
@ -55,6 +55,7 @@ div.app-moduleactions a.dropdown-toggle, div.app-moduleactions div.dropdown-menu
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
|
|
|
@ -5,6 +5,13 @@
|
||||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="icon.png">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath></PackagePath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Client\[Owner].[Theme].Client.csproj" />
|
<ProjectReference Include="..\Client\[Owner].[Theme].Client.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
<icon>icon.png</icon>
|
||||||
<tags>oqtane module</tags>
|
<tags>oqtane module</tags>
|
||||||
<releaseNotes></releaseNotes>
|
<releaseNotes></releaseNotes>
|
||||||
<summary></summary>
|
<summary></summary>
|
||||||
|
@ -23,5 +23,6 @@
|
||||||
<file src="..\Client\bin\Release\net5.0\[Owner].[Theme].Client.Oqtane.dll" target="lib\net5.0" />
|
<file src="..\Client\bin\Release\net5.0\[Owner].[Theme].Client.Oqtane.dll" target="lib\net5.0" />
|
||||||
<file src="..\Client\bin\Release\net5.0\[Owner].[Theme].Client.Oqtane.pdb" target="lib\net5.0" />
|
<file src="..\Client\bin\Release\net5.0\[Owner].[Theme].Client.Oqtane.pdb" target="lib\net5.0" />
|
||||||
<file src="..\Client\wwwroot\**\*.*" target="wwwroot" />
|
<file src="..\Client\wwwroot\**\*.*" target="wwwroot" />
|
||||||
|
<file src="icon.png" target="" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
BIN
Oqtane.Server/wwwroot/Themes/Templates/External/Package/icon.png
vendored
Normal file
BIN
Oqtane.Server/wwwroot/Themes/Templates/External/Package/icon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
9
Oqtane.Shared/Interfaces/IDatabaseConfigControl.cs
Normal file
9
Oqtane.Shared/Interfaces/IDatabaseConfigControl.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Oqtane.Interfaces
|
||||||
|
{
|
||||||
|
public interface IDatabaseConfigControl
|
||||||
|
{
|
||||||
|
string GetConnectionString();
|
||||||
|
|
||||||
|
bool IsInstaller { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,12 +14,8 @@ namespace Oqtane.Interfaces
|
||||||
|
|
||||||
public string Provider { get; }
|
public string Provider { get; }
|
||||||
|
|
||||||
public List<ConnectionStringField> ConnectionStringFields { get; }
|
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name);
|
public OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name);
|
||||||
|
|
||||||
public string BuildConnectionString();
|
|
||||||
|
|
||||||
public string ConcatenateSql(params string[] values);
|
public string ConcatenateSql(params string[] values);
|
||||||
|
|
||||||
public string RewriteName(string name);
|
public string RewriteName(string name);
|
||||||
|
|
|
@ -2,6 +2,8 @@ namespace Oqtane.Models
|
||||||
{
|
{
|
||||||
public class Database
|
public class Database
|
||||||
{
|
{
|
||||||
|
public string FriendlyName { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
|
@ -5,8 +5,8 @@ namespace Oqtane.Shared {
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public const string PackageId = "Oqtane.Framework";
|
public const string PackageId = "Oqtane.Framework";
|
||||||
public const string Version = "2.0.2";
|
public static readonly string Version = "2.1.0";
|
||||||
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2";
|
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2,2.1.0";
|
||||||
|
|
||||||
public const string PageComponent = "Oqtane.UI.ThemeBuilder, Oqtane.Client";
|
public const string PageComponent = "Oqtane.UI.ThemeBuilder, Oqtane.Client";
|
||||||
public const string ContainerComponent = "Oqtane.UI.ContainerBuilder, Oqtane.Client";
|
public const string ContainerComponent = "Oqtane.UI.ContainerBuilder, Oqtane.Client";
|
||||||
|
@ -71,6 +71,6 @@ namespace Oqtane.Shared {
|
||||||
|
|
||||||
public static readonly string SatelliteAssemblyExtension = ".resources.dll";
|
public static readonly string SatelliteAssemblyExtension = ".resources.dll";
|
||||||
|
|
||||||
public static readonly string DefaultCulture = CultureInfo.InstalledUICulture.Name;
|
public static readonly string DefaultCulture = "en";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,10 @@ namespace Oqtane.Shared
|
||||||
{
|
{
|
||||||
public abstract class OqtaneDatabaseBase : IOqtaneDatabase
|
public abstract class OqtaneDatabaseBase : IOqtaneDatabase
|
||||||
{
|
{
|
||||||
protected OqtaneDatabaseBase(string name, string friendlyName, List<ConnectionStringField> connectionStringFields)
|
protected OqtaneDatabaseBase(string name, string friendlyName)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
FriendlyName = friendlyName;
|
FriendlyName = friendlyName;
|
||||||
ConnectionStringFields = connectionStringFields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FriendlyName { get; }
|
public string FriendlyName { get; }
|
||||||
|
@ -23,12 +22,8 @@ namespace Oqtane.Shared
|
||||||
|
|
||||||
public abstract string Provider { get; }
|
public abstract string Provider { get; }
|
||||||
|
|
||||||
public List<ConnectionStringField> ConnectionStringFields { get; }
|
|
||||||
|
|
||||||
public abstract OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name);
|
public abstract OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name);
|
||||||
|
|
||||||
public abstract string BuildConnectionString();
|
|
||||||
|
|
||||||
public virtual string ConcatenateSql(params string[] values)
|
public virtual string ConcatenateSql(params string[] values)
|
||||||
{
|
{
|
||||||
var returnValue = String.Empty;
|
var returnValue = String.Empty;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user