Merge remote-tracking branch 'upstream/dev' into sql-server

This commit is contained in:
hishamco 2021-05-01 21:36:08 +03:00
commit d83eac5af3
79 changed files with 1079 additions and 1410 deletions

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View File

@ -1,13 +1,13 @@
@namespace Oqtane.Installer
@using Oqtane.Interfaces
@using System.Reflection
@namespace Oqtane.UI
@using Oqtane.Installer.Controls
@inject NavigationManager NavigationManager
@inject IInstallationService InstallationService
@inject ISiteService SiteService
@inject IUserService UserService
@inject IJSRuntime JSRuntime
@inject IStringLocalizer<Installer> Localizer
@inject IEnumerable<IOqtaneDatabase> Databases
<div class="container">
<div class="row">
@ -22,63 +22,23 @@
<h2>@Localizer["Database Configuration"]</h2><br />
<table class="form-group" cellpadding="4" cellspacing="4" style="margin: auto;">
<tbody>
<tr>
<td>
<label class="control-label" style="font-weight: bold">@Localizer["Database Type:"] </label>
</td>
<td>
<select class="custom-select" @bind="@_databaseType">
@{
foreach (var database in Databases)
{
<option value="@database.Name">@Localizer[@database.FriendlyName]</option>
}
}
</select>
</td>
</tr>
@{
_selectedDatabase = Databases.Single(d => d.Name == _databaseType);
foreach (var field in _selectedDatabase.ConnectionStringFields)
{
if (field.Name != "IntegratedSecurity")
{
var isVisible = "";
var fieldType = (field.Name == "Pwd") ? "password" : "text";
if ((field.Name == "Uid" || field.Name == "Pwd") && _selectedDatabase.Name != "MySQL" )
<tr>
<td>
<label class="control-label" style="font-weight: bold">@Localizer["Database Type:"]</label>
</td>
<td>
<select class="custom-select" value="@_databaseName" @onchange="(e => DatabaseChanged(e))">
@foreach (var database in _databases)
{
var intSecurityField = _selectedDatabase.ConnectionStringFields.Single(f => f.Name == "IntegratedSecurity");
if (intSecurityField != null)
{
isVisible = (Convert.ToBoolean(intSecurityField.Value)) ? "display: none;" : "";
}
<option value="@database.Name">@Localizer[@database.FriendlyName]</option>
}
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>
}
</select>
</td>
</tr>
@{
if (_databaseConfigType != null)
{
@DatabaseConfigComponent;
}
}
</tbody>
@ -135,8 +95,12 @@
</div>
@code {
private IOqtaneDatabase _selectedDatabase;
private string _databaseType = "LocalDB";
private IList<Database> _databases;
private string _databaseName = "LocalDB";
private Type _databaseConfigType;
private object _databaseConfig;
private RenderFragment DatabaseConfigComponent { get; set; }
private string _hostUsername = UserNames.Host;
private string _hostPassword = string.Empty;
private string _confirmPassword = string.Empty;
@ -144,6 +108,77 @@
private string _message = string.Empty;
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)
{
if (firstRender)
@ -155,7 +190,11 @@
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 != "")
{
@ -166,7 +205,7 @@
var config = new InstallConfig
{
DatabaseType = _databaseType,
DatabaseType = _databaseName,
ConnectionString = connectionString,
Aliases = uri.Authority,
HostEmail = _hostEmail,

View 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";
}
}

View File

@ -2,6 +2,7 @@
@inherits ModuleBase
@inject IPageService PageService
@inject IUserService UserService
@inject IStringLocalizer<SharedResources> Localizer
<div class="row">
@foreach (var p in _pages)
@ -11,7 +12,7 @@
string url = NavigateUrl(p.Path);
<div class="col-md-2 mx-auto text-center">
<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>
</div>
}

View File

@ -61,6 +61,10 @@ else
{
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()

View File

@ -288,7 +288,7 @@
Page page = null;
try
{
if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && _containertype != "-")
if (!string.IsNullOrEmpty(_name) && !string.IsNullOrEmpty(_themetype) && _containertype != "-")
{
page = new Page();
page.SiteId = PageState.Page.SiteId;

View File

@ -58,12 +58,16 @@ else
<Pager Items="@userroles">
<Header>
<th>@Localizer["Users"]</th>
<th>@Localizer["Effective"]</th>
<th>@Localizer["Expiry"]</th>
<th>&nbsp;</th>
</Header>
<Row>
<td>@context.User.DisplayName</td>
<td>@context.EffectiveDate</td>
<td>@context.ExpiryDate</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>
</Row>
</Pager>
@ -140,9 +144,10 @@ else
await UserRoleService.AddUserRoleAsync(userrole);
}
await GetUserRoles();
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
await GetUserRoles();
StateHasChanged();
}
else
{
@ -161,9 +166,10 @@ else
try
{
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
await GetUserRoles();
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
await GetUserRoles();
StateHasChanged();
}
catch (Exception ex)
{

View File

@ -127,60 +127,17 @@ else
<Label For="databaseType" HelpText="Select the database type for the tenant" ResourceKey="DatabaseType">Database Type: </Label>
</td>
<td>
<select id="databaseType" class="custom-select" @bind="@_databaseType">
@{
foreach (var database in Databases)
{
<option value="@database.Name">@Localizer[@database.FriendlyName]</option>
}
<select id="databaseType" class="custom-select" value="@_databaseName" @onchange="(e => DatabaseChanged(e))">
@foreach (var database in _databases)
{
<option value="@database.Name">@Localizer[@database.FriendlyName]</option>
}
</select>
</td>
</tr>
if (_databaseConfigType != null)
{
_selectedDatabase = Databases.Single(d => d.Name == _databaseType);
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>
}
}
@DatabaseConfigComponent;
}
<tr>
<td>
@ -205,6 +162,13 @@ else
}
@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<ThemeControl> _themes = new List<ThemeControl>();
private List<ThemeControl> _containers = new List<ThemeControl>();
@ -213,8 +177,6 @@ else
private string _tenantid = "-";
private string _tenantName = string.Empty;
private IOqtaneDatabase _selectedDatabase;
private string _databaseType = "LocalDB";
private string _hostUserName = UserNames.Host;
private string _hostpassword = string.Empty;
@ -235,6 +197,72 @@ else
_themeList = await ThemeService.GetThemesAsync();
_themes = ThemeService.GetThemeControls(_themeList);
_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)
@ -301,10 +329,14 @@ else
user = await UserService.LoginUserAsync(user, false, false);
if (user.IsAuthenticated)
{
var connectionString = _selectedDatabase.BuildConnectionString();
var connectionString = String.Empty;
if (_databaseConfig is IDatabaseConfigControl databaseConfigControl)
{
connectionString = databaseConfigControl.GetConnectionString();
}
if (connectionString != "")
{
config.DatabaseType = _databaseType;
config.DatabaseType = _databaseName;
config.ConnectionString = connectionString;
config.HostPassword = _hostpassword;
config.HostEmail = user.Email;

View File

@ -131,26 +131,34 @@
{
if (password == confirm)
{
var user = new User();
user.SiteId = PageState.Site.SiteId;
user.Username = username;
user.Password = password;
user.Email = email;
user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
user.PhotoFileId = null;
user = await UserService.AddUserAsync(user);
if (user != null)
var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
if (user == null)
{
await SettingService.UpdateUserSettingsAsync(settings, user.UserId);
await logger.LogInformation("User Created {User}", user);
NavigationManager.NavigateTo(NavigateUrl());
user = new User();
user.SiteId = PageState.Site.SiteId;
user.Username = username;
user.Password = password;
user.Email = email;
user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
user.PhotoFileId = null;
user = await UserService.AddUserAsync(user);
if (user != null)
{
await SettingService.UpdateUserSettingsAsync(settings, user.UserId);
await logger.LogInformation("User Created {User}", user);
NavigationManager.NavigateTo(NavigateUrl());
}
else
{
await logger.LogError("Error Adding User {Username} {Email}", username, email);
AddModuleMessage(Localizer["Error Adding User. Please Ensure Password Meets Complexity Requirements And Username And Email Are Not Already In Use."], MessageType.Error);
}
}
else
{
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["Username Already Exists"], MessageType.Warning);
}
}
else

View File

@ -13,10 +13,15 @@
}
else
{
<ActionLink Action="Add" Text="Add User" ResourceKey="AddUser" />
<div class="d-flex p-1">
<input class="form-control mr-4" @bind="@_search" /><button class="btn btn-outline-primary ml-1" @onclick="OnSearch">@Localizer["Search"]</button>
<div class="form-row">
<div class="col">
<ActionLink Action="Add" Text="Add User" ResourceKey="AddUser" />
</div>
<div class="col">
<div class="input-group flex-nowrap">
<input class="form-control" @bind="@_search" />&nbsp;<button class="btn btn-secondary" @onclick="OnSearch">@Localizer["Search"]</button>
</div>
</div>
</div>
<Pager Items="@userroles">
@ -31,7 +36,7 @@ else
<ActionLink Action="Edit" Parameters="@($"id=" + context.UserId.ToString())" ResourceKey="EditUser" />
</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>
<ActionLink Action="Roles" Parameters="@($"id=" + context.UserId.ToString())" ResourceKey="Roles" />
@ -57,19 +62,19 @@ else
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))
{
return allroles.Where(item => item.Role.Name == RoleNames.Registered).ToList();
results = results.Where(item =>
(
item.User.Username.Contains(search, StringComparison.OrdinalIgnoreCase) ||
item.User.Email.Contains(search, StringComparison.OrdinalIgnoreCase) ||
item.User.DisplayName.Contains(search, StringComparison.OrdinalIgnoreCase)
)
);
}
return allroles
.Where(item => item.Role.Name == RoleNames.Registered &&
(
item.User.Username.Contains(search, StringComparison.OrdinalIgnoreCase) ||
item.User.Email.Contains(search, StringComparison.OrdinalIgnoreCase) ||
item.User.DisplayName.Contains(search, StringComparison.OrdinalIgnoreCase)
)
)
.ToList();
return results.ToList();
}
private async Task OnSearch()

View File

@ -59,15 +59,16 @@ else
<Pager Items="@userroles">
<Header>
<th>@Localizer["Roles"]</th>
<th>@Localizer["Effective"]</th>
<th>@Localizer["Expiry"]</th>
<th>&nbsp;</th>
</Header>
<Row>
<td>@context.Role.Name</td>
<td>@context.EffectiveDate</td>
<td>@context.ExpiryDate</td>
<td>
@if (context.Role.Name != RoleNames.Registered)
{
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>@Localizer["Delete"]</button>
}
<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" />
</td>
</Row>
</Pager>
@ -92,7 +93,15 @@ else
userid = Int32.Parse(PageState.QueryString["id"]);
User user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
name = user.DisplayName;
roles = await RoleService.GetRolesAsync(PageState.Site.SiteId);
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);
}
await GetUserRoles();
}
catch (Exception ex)
@ -171,9 +180,10 @@ else
await UserRoleService.AddUserRoleAsync(userrole);
}
await GetUserRoles();
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
await GetUserRoles();
StateHasChanged();
}
else
{
@ -192,9 +202,10 @@ else
try
{
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
await GetUserRoles();
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
await GetUserRoles();
StateHasChanged();
}
catch (Exception ex)
{

View File

@ -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
var startUps = assembly.GetInstances<IClientStartup>();
foreach (var startup in startUps)

View File

@ -1,4 +1,4 @@
using Oqtane.Models;
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
@ -8,6 +8,8 @@ namespace Oqtane.Services
{
Task<List<Role>> GetRolesAsync(int siteId);
Task<List<Role>> GetRolesAsync(int siteId, bool includeGlobalRoles);
Task<Role> GetRoleAsync(int roleId);
Task<Role> AddRoleAsync(Role role);

View File

@ -1,4 +1,4 @@
using Oqtane.Models;
using Oqtane.Models;
using System.Threading.Tasks;
using System.Net.Http;
using System.Linq;
@ -22,7 +22,12 @@ namespace Oqtane.Services
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();
}

View File

@ -369,7 +369,12 @@
module.PageId = PageState.Page.PageId;
module.ModuleDefinitionName = ModuleDefinitionName;
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);
ModuleId = module.ModuleId.ToString();
}

View File

@ -27,6 +27,10 @@
protected override async Task OnParametersSetAsync()
{
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 });
}

View File

@ -17,7 +17,7 @@
<ModuleActions />
}
<div class="row px-4">
<div class="container">
<div class="container-fluid">
<ModuleInstance />
</div>
</div>
@ -27,7 +27,7 @@
public override string Name => "Customizable Container";
private bool _title = true;
private string _classes = "container";
private string _classes = "container-fluid";
protected override void OnParametersSet()
{

View File

@ -93,10 +93,15 @@
<Pane Name="Bottom Full Width" />
@if (_footer)
{
<div class="bg-primary footer">
<div style="clear: both; height: 30px;"></div>
<div class="bg-primary fixed-bottom footer">
<Pane Name="Footer" />
</div>
}
else
{
<Pane Name="Footer" />
}
</div>
</main>

View File

@ -7,10 +7,10 @@
<table class="table table-borderless">
<tr>
<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>
<select id="title" class="form-control" @bind="@_footer">
<select id="footer" class="form-control" @bind="@_footer">
<option value="true">Yes</option>
<option value="false">No</option>
</select>

View File

@ -21,3 +21,4 @@
@using Oqtane.Themes.Controls
@using Oqtane.UI
@using Oqtane.Enums
@using Oqtane.Installer

View File

@ -15,16 +15,7 @@ namespace Oqtane.Database.MySQL
private static string _name => "MySQL";
private static 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 MySQLDatabase() :base(_name, _friendlyName, _connectionStringFields) { }
public MySQLDatabase() :base(_name, _friendlyName) { }
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);
}
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)
{
var returnValue = "CONCAT(";

View File

@ -20,17 +20,7 @@ namespace Oqtane.Database.PostgreSQL
private readonly INameRewriter _rewriter;
private static 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 PostgreSQLDatabase() : base(_name, _friendlyName, _connectionStringFields)
public PostgreSQLDatabase() : base(_name, _friendlyName)
{
_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);
}
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)
{
var returnValue = String.Empty;

View File

@ -9,27 +9,6 @@ namespace Oqtane.Repository.Databases
private static string _friendlyName => "Local Database";
private static string _name => "LocalDB";
private static 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 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;
}
public LocalDbDatabase() :base(_name, _friendlyName) { }
}
}

View File

@ -10,50 +10,6 @@ namespace Oqtane.Repository.Databases
private static string _name => "SqlServer";
private static 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 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;
}
public SqlServerDatabase() :base(_name, _friendlyName) { }
}
}

View File

@ -9,7 +9,7 @@ namespace Oqtane.Repository.Databases
{
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)
{
}

View File

@ -14,12 +14,7 @@ namespace Oqtane.Repository.Databases
private static string _name => "Sqlite";
private static 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 SqliteDatabase() :base(_name, _friendlyName, _connectionStringFields) { }
public SqliteDatabase() :base(_name, _friendlyName) { }
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);
}
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)
{
var returnValue = String.Empty;

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Oqtane.Enums;
@ -21,12 +21,16 @@ namespace Oqtane.Controllers
_logger = logger;
}
// GET: api/<controller>?siteid=x
// GET: api/<controller>?siteid=x&global=true/false
[HttpGet]
[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
@ -68,8 +72,12 @@ namespace Oqtane.Controllers
[Authorize(Roles = RoleNames.Admin)]
public void Delete(int id)
{
_roles.DeleteRole(id);
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Role Deleted {RoleId}", id);
var role = _roles.GetRole(id);
if (!role.IsSystem)
{
_roles.DeleteRole(id);
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Role Deleted {RoleId}", id);
}
}
}
}

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Oqtane.Enums;
@ -6,6 +6,7 @@ using Oqtane.Models;
using Oqtane.Shared;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using System.Linq;
namespace Oqtane.Controllers
{
@ -13,13 +14,15 @@ namespace Oqtane.Controllers
public class UserRoleController : Controller
{
private readonly IUserRoleRepository _userRoles;
private readonly IRoleRepository _roles;
private readonly ITenantResolver _tenants;
private readonly ISyncManager _syncManager;
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;
_roles = roles;
_syncManager = syncManager;
_tenants = tenants;
_logger = logger;
@ -46,11 +49,20 @@ namespace Oqtane.Controllers
[Authorize(Roles = RoleNames.Admin)]
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);
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", userRole);
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
}
return userRole;
}
@ -60,7 +72,8 @@ namespace Oqtane.Controllers
[Authorize(Roles = RoleNames.Admin)]
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);
_syncManager.AddSyncEvent(_tenants.GetTenant().TenantId, EntityNames.User, userRole.UserId);
@ -75,9 +88,24 @@ namespace Oqtane.Controllers
public void Delete(int id)
{
UserRole userRole = _userRoles.GetUserRole(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);
if (User.IsInRole(RoleNames.Host) || userRole.Role.Name != RoleNames.Host)
{
_userRoles.DeleteUserRole(id);
_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);
}
}
}
}

View File

@ -38,7 +38,7 @@ namespace Oqtane.Infrastructure
public static bool InstallPackages(string folders, string webRootPath, string contentRootPath)
{
bool install = false;
string binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
string binPath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
foreach (string folder in folders.Split(','))
{
@ -82,40 +82,37 @@ namespace Oqtane.Infrastructure
List<string> assets = new List<string>();
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[] 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
foreach (ZipArchiveEntry entry in archive.Entries)
{
string foldername = Path.GetDirectoryName(entry.FullName).Split(Path.DirectorySeparatorChar)[0];
string filename = Path.GetFileName(entry.FullName);
string filename = "";
if (!manifest && filename == "assets.json")
// evaluate entry root folder
switch (entry.FullName.Split('/')[0])
{
manifest = true;
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;
}
switch (foldername)
if (filename != "")
{
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;
assets.Add(filename.Replace(contentRootPath, ""));
if (!manifest && Path.GetFileName(filename) == "assets.json")
{
manifest = true;
}
}
}
@ -145,21 +142,25 @@ namespace Oqtane.Infrastructure
return install;
}
private static void ExtractFile(ZipArchiveEntry entry, string filename)
private static string ExtractFile(ZipArchiveEntry entry, string folder, int ignoreLeadingSegments)
{
if (!Directory.Exists(Path.GetDirectoryName(filename)))
{
Directory.CreateDirectory(Path.GetDirectoryName(filename));
}
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)))
{
Directory.CreateDirectory(Path.GetDirectoryName(filename));
}
entry.ExtractToFile(filename, true);
}
catch
{
// an error occurred extracting the file
filename = "";
}
return filename;
}
public void UpgradeFramework()

View File

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.Options;
using Oqtane.Shared;
@ -9,7 +11,7 @@ namespace Oqtane.Infrastructure
public class LocalizationManager : ILocalizationManager
{
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;
@ -19,25 +21,19 @@ namespace Oqtane.Infrastructure
}
public string GetDefaultCulture()
=> string.IsNullOrEmpty(_localizationOptions.DefaultCulture)
=> String.IsNullOrEmpty(_localizationOptions.DefaultCulture)
? DefaultCulture
: _localizationOptions.DefaultCulture;
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))
{
cultures.Add(Path.GetFileName(Path.GetDirectoryName(file)));
}
if (cultures.Count == 0)
{
return SupportedCultures;
}
else
{
return cultures.ToArray();
}
return cultures.OrderBy(c => c).ToArray();
}
}
}

View File

@ -22,15 +22,22 @@ namespace Oqtane.Migrations
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
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
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
pageEntityBuilder.Create();
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")
{
pageEntityBuilder.AddBooleanColumn("EditMode");
pageEntityBuilder.AddStringColumn("LayoutType", 200, true);
}
//Create Module table

View File

@ -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'");
}
}
}
}

View 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'");
}
}
}
}

View File

@ -10,7 +10,6 @@ namespace Oqtane.Migrations
{
[DbContext(typeof(TenantDBContext))]
[Migration("Tenant.02.01.00.00")]
public class AddAppVersionsTable : MultiDatabaseMigration
{
public AddAppVersionsTable(IEnumerable<IOqtaneDatabase> databases) : base(databases)

View File

@ -41,7 +41,6 @@ namespace Oqtane.Migrations.EntityBuilders
Order = AddIntegerColumn(table,"Order");
IsNavigation = AddBooleanColumn(table,"IsNavigation");
Url = AddStringColumn(table,"Url", 500, true);
LayoutType = AddStringColumn(table,"LayoutType", 200);
UserId = AddIntegerColumn(table,"UserId", true);
IsPersonalizable = AddBooleanColumn(table,"IsPersonalizable");
DefaultContainerType = AddStringColumn(table,"DefaultContainerType", 200, true);
@ -73,8 +72,6 @@ namespace Oqtane.Migrations.EntityBuilders
public OperationBuilder<AddColumnOperation> Url { get; private set; }
public OperationBuilder<AddColumnOperation> LayoutType { get; private set; }
public OperationBuilder<AddColumnOperation> UserId { get; private set; }
public OperationBuilder<AddColumnOperation> IsPersonalizable { get; private set; }

View File

@ -24,7 +24,7 @@ namespace Oqtane.Migrations.EntityBuilders
SettingId = AddAutoIncrementColumn(table,"SettingId");
EntityName = AddStringColumn(table,"EntityName", 50);
EntityId = AddIntegerColumn(table,"EntityId");
SettingName = AddStringColumn(table,"SettingName", 50);
SettingName = AddStringColumn(table,"SettingName", 200);
SettingValue = AddMaxStringColumn(table,"SettingValue");
AddAuditableColumns(table);

View File

@ -27,7 +27,6 @@ namespace Oqtane.Migrations.EntityBuilders
LogoFileId = AddIntegerColumn(table,"LogoFileId", true);
FaviconFileId = AddIntegerColumn(table,"FaviconFileId", true);
DefaultThemeType = AddStringColumn(table,"DefaultThemeType", 200);
DefaultLayoutType = AddStringColumn(table,"DefaultLayoutType", 200);
DefaultContainerType = AddStringColumn(table,"DefaultContainerType", 200);
PwaIsEnabled = AddBooleanColumn(table,"PwaIsEnabled");
PwaAppIconFileId = AddIntegerColumn(table,"PwaAppIconFileId", true);
@ -52,8 +51,6 @@ namespace Oqtane.Migrations.EntityBuilders
public OperationBuilder<AddColumnOperation> DefaultThemeType { get; private set; }
public OperationBuilder<AddColumnOperation> DefaultLayoutType { get; private set; }
public OperationBuilder<AddColumnOperation> DefaultContainerType { get; private set; }
public OperationBuilder<AddColumnOperation> PwaIsEnabled { get; private set; }

View File

@ -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

View File

@ -1,2 +0,0 @@
DROP TABLE [dbo].[HtmlText]
GO

View File

@ -25,25 +25,6 @@
<EmbeddedResource Remove="wwwroot\Themes\Templates\**" />
</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\MigrateTenant.sql" />
</ItemGroup>

View File

@ -65,8 +65,8 @@ namespace Oqtane.Repository
break; // found a matching alias
}
}
return alias;
// return fallback alias
return alias ?? aliases.Find(item => item.Name.Equals("*"));
}
public void DeleteAlias(int aliasId)

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Oqtane.Models;
namespace Oqtane.Repository
@ -11,5 +11,6 @@ namespace Oqtane.Repository
UserRole UpdateUserRole(UserRole userRole);
UserRole GetUserRole(int userRoleId);
void DeleteUserRole(int userRoleId);
void DeleteUserRoles(int userId);
}
}

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Oqtane.Models;
@ -16,12 +16,19 @@ namespace Oqtane.Repository
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)
{
return _db.Role.Where(item => item.SiteId == siteId || item.SiteId == null);
if (includeGlobalRoles)
{
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)

View File

@ -5,6 +5,7 @@ using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Oqtane.Extensions;
using Oqtane.Infrastructure;
using Oqtane.Models;
@ -24,9 +25,7 @@ namespace Oqtane.Repository
private readonly IModuleRepository _moduleRepository;
private readonly IPageModuleRepository _pageModuleRepository;
private readonly IModuleDefinitionRepository _moduleDefinitionRepository;
private readonly IServiceProvider _serviceProvider;
private readonly IConfigurationRoot _config;
public SiteRepository(TenantDBContext context, IRoleRepository roleRepository, IProfileRepository profileRepository, IFolderRepository folderRepository, IPageRepository pageRepository,
@ -68,7 +67,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -97,7 +96,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -127,7 +126,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -156,7 +155,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -181,7 +180,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -208,7 +207,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -235,7 +234,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -262,7 +261,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -289,7 +288,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -316,7 +315,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -343,7 +342,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -370,7 +369,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Admin, true),
@ -399,7 +398,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Host, true),
@ -421,7 +420,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Host, true),
@ -443,7 +442,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Host, true),
@ -465,7 +464,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Host, true),
@ -494,7 +493,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Host, true),
@ -518,7 +517,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Host, true),
@ -540,7 +539,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Host, true),
@ -562,7 +561,7 @@ namespace Oqtane.Repository
{
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>
{
new Permission(PermissionNames.View, RoleNames.Host, true),
@ -584,7 +583,7 @@ namespace Oqtane.Repository
{
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>
{
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});
_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
{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
{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(

View File

@ -58,5 +58,14 @@ namespace Oqtane.Repository
_db.UserRole.Remove(userRole);
_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();
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,9 +0,0 @@
/*
Version 1.0.2.1 migration script
*/
ALTER TABLE [dbo].[Page]
DROP COLUMN EditMode
GO

View File

@ -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

View File

@ -1,9 +0,0 @@
/*
Version 2.0.1 Tenant migration script
*/
UPDATE [dbo].[Page] SET Icon = IIF(Icon <> '', 'oi oi-' + Icon, '');
GO

View File

@ -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

View File

@ -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

View File

@ -1,10 +0,0 @@
/*
Version 2.0.2 Tenant migration script
*/
ALTER TABLE [dbo].[Site] ADD
[SiteGuid] [char](36) NULL
GO

View File

@ -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

View File

@ -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

View File

@ -16,7 +16,6 @@
"DefaultContainer": ""
},
"Localization": {
"DefaultCulture": "",
"SupportedCultures": []
"DefaultCulture": "en"
}
}

View File

@ -5,6 +5,13 @@
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Client\[Owner].[Module].Client.csproj" />
<ProjectReference Include="..\Server\[Owner].[Module].Server.csproj" />

View File

@ -11,7 +11,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<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>
<releaseNotes></releaseNotes>
<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.pdb" target="lib\net5.0" />
<file src="..\Server\wwwroot\**\*.*" target="wwwroot" />
<file src="icon.png" target="" />
</files>
</package>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -55,6 +55,7 @@ div.app-moduleactions a.dropdown-toggle, div.app-moduleactions div.dropdown-menu
min-height: 40px;
text-align: center;
color: #ffffff;
z-index: 1000;
}
@media (max-width: 767px) {

View File

@ -5,6 +5,13 @@
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Client\[Owner].[Theme].Client.csproj" />
</ItemGroup>

View File

@ -11,7 +11,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<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>
<releaseNotes></releaseNotes>
<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.pdb" target="lib\net5.0" />
<file src="..\Client\wwwroot\**\*.*" target="wwwroot" />
<file src="icon.png" target="" />
</files>
</package>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,9 @@
namespace Oqtane.Interfaces
{
public interface IDatabaseConfigControl
{
string GetConnectionString();
bool IsInstaller { get; set; }
}
}

View File

@ -14,12 +14,8 @@ namespace Oqtane.Interfaces
public string Provider { get; }
public List<ConnectionStringField> ConnectionStringFields { get; }
public OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name);
public string BuildConnectionString();
public string ConcatenateSql(params string[] values);
public string RewriteName(string name);

View File

@ -2,6 +2,8 @@ namespace Oqtane.Models
{
public class Database
{
public string FriendlyName { get; set; }
public string Name { get; set; }
public string Type { get; set; }

View File

@ -5,8 +5,8 @@ namespace Oqtane.Shared {
public class Constants {
public const string PackageId = "Oqtane.Framework";
public const string Version = "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";
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,2.1.0";
public const string PageComponent = "Oqtane.UI.ThemeBuilder, 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 DefaultCulture = CultureInfo.InstalledUICulture.Name;
public static readonly string DefaultCulture = "en";
}
}

View File

@ -10,11 +10,10 @@ namespace Oqtane.Shared
{
public abstract class OqtaneDatabaseBase : IOqtaneDatabase
{
protected OqtaneDatabaseBase(string name, string friendlyName, List<ConnectionStringField> connectionStringFields)
protected OqtaneDatabaseBase(string name, string friendlyName)
{
Name = name;
FriendlyName = friendlyName;
ConnectionStringFields = connectionStringFields;
}
public string FriendlyName { get; }
@ -23,12 +22,8 @@ namespace Oqtane.Shared
public abstract string Provider { get; }
public List<ConnectionStringField> ConnectionStringFields { get; }
public abstract OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name);
public abstract string BuildConnectionString();
public virtual string ConcatenateSql(params string[] values)
{
var returnValue = String.Empty;