Refactor host user security model, support static assets in modules and themes, module definition permissions and categories, paging control, remove SiteUsers, move seed data from script to site template for installation
This commit is contained in:
parent
35b9b9e89b
commit
83a212e7e3
|
@ -9,20 +9,20 @@
|
||||||
@inject IPageService PageService
|
@inject IPageService PageService
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
|
||||||
<ul class="list-group">
|
<div class="row">
|
||||||
@foreach (var p in pages)
|
@foreach (var p in pages)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions))
|
||||||
{
|
{
|
||||||
string url = NavigateUrl(p.Path);
|
string url = NavigateUrl(p.Path);
|
||||||
<li class="list-group-item">
|
<div class="col-md-2 mx-auto text-center">
|
||||||
<NavLink class="nav-link" href="@url" Match="NavLinkMatch.All">
|
<NavLink class="nav-link" href="@url" Match="NavLinkMatch.All">
|
||||||
<span class="oi @p.Icon" aria-hidden="true"></span> @p.Name
|
<h2><span class="oi oi-@p.Icon" aria-hidden="true"></span></h2>@p.Name
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</li>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</ul>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
91
Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
Normal file
91
Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@using Oqtane.Modules.Controls
|
||||||
|
@using Oqtane.Models
|
||||||
|
@using Oqtane.Services
|
||||||
|
@using Oqtane.Modules
|
||||||
|
@using Oqtane.Shared
|
||||||
|
@using Oqtane.Security
|
||||||
|
@namespace Oqtane.Modules.Admin.ModuleDefinitions
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject IModuleDefinitionService ModuleDefinitionService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
<ModuleMessage Message="@message" />
|
||||||
|
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@name" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Permissions: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<PermissionGrid EntityName="ModuleDefinition" PermissionNames="Utilize" Permissions="@permissions" @ref="permissiongrid" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success" @onclick="SaveModuleDefinition">Save</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
|
string message = "";
|
||||||
|
|
||||||
|
int ModuleDefinitionId;
|
||||||
|
string name;
|
||||||
|
string permissions;
|
||||||
|
string createdby;
|
||||||
|
DateTime createdon;
|
||||||
|
string modifiedby;
|
||||||
|
DateTime modifiedon;
|
||||||
|
|
||||||
|
PermissionGrid permissiongrid;
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ModuleDefinitionId = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
ModuleDefinition moduledefinition = PageState.ModuleDefinitions.Where(item => item.ModuleDefinitionId == ModuleDefinitionId).FirstOrDefault();
|
||||||
|
if (moduledefinition != null)
|
||||||
|
{
|
||||||
|
name = moduledefinition.Name;
|
||||||
|
permissions = moduledefinition.Permissions;
|
||||||
|
createdby = moduledefinition.CreatedBy;
|
||||||
|
createdon = moduledefinition.CreatedOn;
|
||||||
|
modifiedby = moduledefinition.ModifiedBy;
|
||||||
|
modifiedon = moduledefinition.ModifiedOn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = ex.Message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveModuleDefinition()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ModuleDefinition moduledefinition = PageState.ModuleDefinitions.Where(item => item.ModuleDefinitionId == ModuleDefinitionId).FirstOrDefault();
|
||||||
|
moduledefinition.Permissions = permissiongrid.GetPermissions();
|
||||||
|
await ModuleDefinitionService.UpdateModuleDefinitionAsync(moduledefinition);
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl(Reload.Site));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = ex.Message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,14 +17,18 @@ else
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
<th>Version</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var moduledefinition in moduledefinitions)
|
@foreach (var moduledefinition in moduledefinitions)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + moduledefinition.ModuleDefinitionId.ToString())" /></td>
|
||||||
<td>@moduledefinition.Name</td>
|
<td>@moduledefinition.Name</td>
|
||||||
|
<td>@moduledefinition.Version</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -38,6 +42,6 @@ else
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync();
|
moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,7 +44,7 @@
|
||||||
<label for="Name" class="control-label">Permissions: </label>
|
<label for="Name" class="control-label">Permissions: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<PermissionGrid EntityName="Module" Permissions="@permissions" @ref="permissiongrid" />
|
<PermissionGrid EntityName="Module" PermissionNames="@permissionnames" Permissions="@permissions" @ref="permissiongrid" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -76,6 +76,7 @@
|
||||||
Dictionary<string, string> containers = new Dictionary<string, string>();
|
Dictionary<string, string> containers = new Dictionary<string, string>();
|
||||||
string title;
|
string title;
|
||||||
string containertype;
|
string containertype;
|
||||||
|
string permissionnames = "";
|
||||||
string permissions;
|
string permissions;
|
||||||
string pageid;
|
string pageid;
|
||||||
|
|
||||||
|
@ -90,6 +91,7 @@
|
||||||
containers = ThemeService.GetContainerTypes(await ThemeService.GetThemesAsync());
|
containers = ThemeService.GetContainerTypes(await ThemeService.GetThemesAsync());
|
||||||
containertype = ModuleState.ContainerType;
|
containertype = ModuleState.ContainerType;
|
||||||
permissions = ModuleState.Permissions;
|
permissions = ModuleState.Permissions;
|
||||||
|
permissionnames = PageState.ModuleDefinitions.Find(item => item.ModuleDefinitionName == ModuleState.ModuleDefinitionName).PermissionNames;
|
||||||
pageid = ModuleState.PageId.ToString();
|
pageid = ModuleState.PageId.ToString();
|
||||||
|
|
||||||
DynamicComponent = builder =>
|
DynamicComponent = builder =>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @onchange="(e => ParentChanged(e))">
|
<select class="form-control" @onchange="(e => ParentChanged(e))">
|
||||||
<option value=""><Site Root></option>
|
<option value="-1"><Site Root></option>
|
||||||
@foreach (Page page in pages)
|
@foreach (Page page in pages)
|
||||||
{
|
{
|
||||||
<option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
|
<option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parentid = (string)e.Value;
|
parentid = (string)e.Value;
|
||||||
if (string.IsNullOrEmpty(parentid))
|
if (parentid == "-1")
|
||||||
{
|
{
|
||||||
children = PageState.Pages.Where(item => item.ParentId == null).ToList();
|
children = PageState.Pages.Where(item => item.ParentId == null).ToList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @onchange="(e => ParentChanged(e))">
|
<select class="form-control" @onchange="(e => ParentChanged(e))">
|
||||||
<option value=""><Site Root></option>
|
<option value="-1"><Site Root></option>
|
||||||
@foreach (Page page in pages)
|
@foreach (Page page in pages)
|
||||||
{
|
{
|
||||||
if (page.PageId.ToString() == parentid)
|
if (page.PageId.ToString() == parentid)
|
||||||
|
@ -237,7 +237,7 @@
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parentid = (string)e.Value;
|
parentid = (string)e.Value;
|
||||||
if (string.IsNullOrEmpty(parentid))
|
if (parentid == "-1")
|
||||||
{
|
{
|
||||||
children = PageState.Pages.Where(item => item.ParentId == null).ToList();
|
children = PageState.Pages.Where(item => item.ParentId == null).ToList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,27 +9,20 @@
|
||||||
|
|
||||||
@if (PageState.Pages != null)
|
@if (PageState.Pages != null)
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Add Page" />
|
<ActionLink Action="Add" Text="Add Page" Style="float: right; margin: 10px;" />
|
||||||
<table class="table table-borderless">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th> </th>
|
|
||||||
<th> </th>
|
|
||||||
<th>Name</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (Page page in PageState.Pages)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + page.PageId.ToString())" /></td>
|
|
||||||
<td><ActionLink Action="Delete" Parameters="@($"id=" + page.PageId.ToString())" Class="btn btn-danger" /></td>
|
|
||||||
<td>@(new string('-', page.Level * 2))@(page.Name)</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
<Pager Items="@PageState.Pages" DisplayPages="3" PageSize="3">
|
||||||
|
<Header>
|
||||||
|
<th>Name</th>
|
||||||
|
<th> </th>
|
||||||
|
<th> </th>
|
||||||
|
</Header>
|
||||||
|
<Row>
|
||||||
|
<td>@(new string('-', context.Level * 2))@(context.Name)</td>
|
||||||
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.PageId.ToString())" /></td>
|
||||||
|
<td><ActionLink Action="Delete" Parameters="@($"id=" +context.PageId.ToString())" Class="btn btn-danger" /></td>
|
||||||
|
</Row>
|
||||||
|
</Pager>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
user.Username = Email;
|
user.Username = Email;
|
||||||
user.DisplayName = Email;
|
user.DisplayName = Email;
|
||||||
user.Email = Email;
|
user.Email = Email;
|
||||||
user.IsHost = false;
|
|
||||||
user.Password = Password;
|
user.Password = Password;
|
||||||
await UserService.AddUserAsync(user);
|
await UserService.AddUserAsync(user);
|
||||||
NavigationManager.NavigateTo("");
|
NavigationManager.NavigateTo("");
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
@inject ITenantService TenantService
|
@inject ITenantService TenantService
|
||||||
@inject IAliasService AliasService
|
@inject IAliasService AliasService
|
||||||
@inject ISiteService SiteService
|
@inject ISiteService SiteService
|
||||||
@inject IPageService PageService
|
@inject IThemeService ThemeService
|
||||||
|
|
||||||
@if (tenants == null)
|
@if (tenants == null)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,34 @@ else
|
||||||
<input class="form-control" @bind="@logo" />
|
<input class="form-control" @bind="@logo" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Default Theme: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@themetype">
|
||||||
|
<option value=""><Select Theme></option>
|
||||||
|
@foreach (KeyValuePair<string, string> item in themes)
|
||||||
|
{
|
||||||
|
<option value="@item.Key">@item.Value</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Default Layout: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@layouttype">
|
||||||
|
<option value=""><Select Layout></option>
|
||||||
|
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
||||||
|
{
|
||||||
|
<option value="@panelayout.Key">@panelayout.Value</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
|
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
@ -66,15 +94,23 @@ else
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
|
Dictionary<string, string> themes = new Dictionary<string, string>();
|
||||||
|
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
||||||
|
|
||||||
List<Tenant> tenants;
|
List<Tenant> tenants;
|
||||||
string tenantid = "";
|
string tenantid = "";
|
||||||
string name = "";
|
string name = "";
|
||||||
string url = "";
|
string url = "";
|
||||||
string logo = "";
|
string logo = "";
|
||||||
|
string themetype;
|
||||||
|
string layouttype;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
tenants = await TenantService.GetTenantsAsync();
|
tenants = await TenantService.GetTenantsAsync();
|
||||||
|
url = PageState.Alias.Name;
|
||||||
|
themes = ThemeService.GetThemeTypes(PageState.Themes);
|
||||||
|
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveSite()
|
private async Task SaveSite()
|
||||||
|
@ -82,9 +118,9 @@ else
|
||||||
Site site = new Site();
|
Site site = new Site();
|
||||||
site.Name = name;
|
site.Name = name;
|
||||||
site.Logo = (logo == null ? "" : logo);
|
site.Logo = (logo == null ? "" : logo);
|
||||||
await SiteService.AddSiteAsync(site);
|
site.DefaultThemeType = themetype;
|
||||||
List<Site> sites = await SiteService.GetSitesAsync();
|
site.DefaultLayoutType = (layouttype == null ? "" : layouttype);
|
||||||
site = sites.Where(item => item.Name == name).FirstOrDefault();
|
site = await SiteService.AddSiteAsync(site);
|
||||||
|
|
||||||
Alias alias = new Alias();
|
Alias alias = new Alias();
|
||||||
alias.Name = url;
|
alias.Name = url;
|
||||||
|
@ -92,28 +128,6 @@ else
|
||||||
alias.SiteId = site.SiteId;
|
alias.SiteId = site.SiteId;
|
||||||
await AliasService.AddAliasAsync(alias);
|
await AliasService.AddAliasAsync(alias);
|
||||||
|
|
||||||
// need to add a home page and admin pages
|
|
||||||
Page p = new Page();
|
|
||||||
p.SiteId = site.SiteId;
|
|
||||||
p.ParentId = null;
|
|
||||||
p.Name = "Home";
|
|
||||||
p.Path = "";
|
|
||||||
p.Order = 1;
|
|
||||||
p.IsNavigation = true;
|
|
||||||
p.ThemeType = PageState.Site.DefaultThemeType;
|
|
||||||
p.LayoutType = "";
|
|
||||||
p.Icon = "";
|
|
||||||
Type type = Type.GetType(p.ThemeType);
|
|
||||||
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
|
|
||||||
p.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
|
|
||||||
|
|
||||||
List<PermissionString> permissionstrings = new List<PermissionString>();
|
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = "View", Permissions = Constants.AllUsersRole });
|
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = "Edit", Permissions = Constants.AdminRole });
|
|
||||||
p.Permissions = UserSecurity.SetPermissionStrings(permissionstrings);
|
|
||||||
|
|
||||||
await PageService.AddPageAsync(p);
|
|
||||||
|
|
||||||
NavigationManager.NavigateTo(url, true);
|
NavigationManager.NavigateTo(url, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
62
Oqtane.Client/Modules/Admin/Tenants/Add.razor
Normal file
62
Oqtane.Client/Modules/Admin/Tenants/Add.razor
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@using Oqtane.Models
|
||||||
|
@using Oqtane.Services
|
||||||
|
@using Oqtane.Modules
|
||||||
|
@using Oqtane.Shared
|
||||||
|
@using Oqtane.Security
|
||||||
|
@namespace Oqtane.Modules.Admin.Tenants
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject ITenantService TenantService
|
||||||
|
@inject IAliasService AliasService
|
||||||
|
@inject ISiteService SiteService
|
||||||
|
@inject IPageService PageService
|
||||||
|
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@name" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Connection String: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@connectionstring" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Schema: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@schema" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success" @onclick="SaveTenant">Save</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
|
string name = "";
|
||||||
|
string connectionstring = "";
|
||||||
|
string schema = "";
|
||||||
|
|
||||||
|
private async Task SaveTenant()
|
||||||
|
{
|
||||||
|
Tenant tenant = new Tenant();
|
||||||
|
tenant.Name = name;
|
||||||
|
tenant.DBConnectionString = connectionstring;
|
||||||
|
tenant.DBSchema = schema;
|
||||||
|
await TenantService.AddTenantAsync(tenant);
|
||||||
|
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
}
|
43
Oqtane.Client/Modules/Admin/Tenants/Index.razor
Normal file
43
Oqtane.Client/Modules/Admin/Tenants/Index.razor
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@using Oqtane.Services
|
||||||
|
@using Oqtane.Models
|
||||||
|
@using Oqtane.Modules
|
||||||
|
@using Oqtane.Modules.Controls
|
||||||
|
@namespace Oqtane.Modules.Admin.Tenants
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject ITenantService TenantService
|
||||||
|
|
||||||
|
@if (Tenants == null)
|
||||||
|
{
|
||||||
|
<p><em>Loading...</em></p>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<ActionLink Action="Add" Text="Add Tenant" />
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var Tenant in Tenants)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@Tenant.Name</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
|
List<Tenant> Tenants;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
Tenants = await TenantService.GetTenantsAsync();
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,12 +3,12 @@
|
||||||
@using Oqtane.Models
|
@using Oqtane.Models
|
||||||
@using Oqtane.Modules
|
@using Oqtane.Modules
|
||||||
@using Oqtane.Modules.Controls
|
@using Oqtane.Modules.Controls
|
||||||
|
@using Oqtane.Shared
|
||||||
@namespace Oqtane.Modules.Admin.Users
|
@namespace Oqtane.Modules.Admin.Users
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
|
@inject IUserRoleService UserRoleService
|
||||||
|
|
||||||
@inject IUserService UserService
|
@if (userroles == null)
|
||||||
|
|
||||||
@if (Users == null)
|
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading...</em></p>
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,10 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var User in Users)
|
@foreach (UserRole userrole in userroles)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>@User.Username</td>
|
<td>@userrole.User.Username</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -34,10 +34,11 @@ else
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
List<User> Users;
|
List<UserRole> userroles;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Users = await UserService.GetUsersAsync(PageState.Site.SiteId);
|
userroles = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
|
||||||
|
userroles = userroles.Where(item => item.Role.Name == Constants.RegisteredRole).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
150
Oqtane.Client/Modules/Controls/Pager.razor
Normal file
150
Oqtane.Client/Modules/Controls/Pager.razor
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
@using Oqtane.Modules
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@namespace Oqtane.Modules.Controls
|
||||||
|
@inherits ModuleBase
|
||||||
|
@typeparam TableItem
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<thead>
|
||||||
|
<tr>@Header</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in ItemList)
|
||||||
|
{
|
||||||
|
<tr>@Row(item)</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="pagination">
|
||||||
|
@if (Page > MaxPages)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
|
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||||
|
|
||||||
|
@for (int i = StartPage; i <= EndPage; i++)
|
||||||
|
{
|
||||||
|
var pager = i;
|
||||||
|
<button class="btn @((pager == Page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
||||||
|
@pager
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
||||||
|
@if (EndPage < Pages)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="btn btn-link disabled">Page @Page of @Pages</span>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
int Pages;
|
||||||
|
int Page;
|
||||||
|
int MaxItems;
|
||||||
|
int MaxPages;
|
||||||
|
int StartPage;
|
||||||
|
int EndPage;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public RenderFragment Header { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public RenderFragment<TableItem> Row { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public IEnumerable<TableItem> Items { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string PageSize { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string DisplayPages { get; set; }
|
||||||
|
|
||||||
|
IEnumerable<TableItem> ItemList { get; set; }
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(PageSize))
|
||||||
|
{
|
||||||
|
MaxItems = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MaxItems = int.Parse(PageSize);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(DisplayPages))
|
||||||
|
{
|
||||||
|
MaxPages = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MaxPages = int.Parse(DisplayPages);
|
||||||
|
}
|
||||||
|
Page = 1;
|
||||||
|
|
||||||
|
ItemList = Items.Skip((Page - 1) * MaxItems).Take(MaxItems);
|
||||||
|
Pages = (int)Math.Ceiling(Items.Count() / (decimal)MaxItems);
|
||||||
|
|
||||||
|
SetPagerSize("forward");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateList(int CurrentPage)
|
||||||
|
{
|
||||||
|
ItemList = Items.Skip((Page - 1) * MaxItems).Take(MaxItems);
|
||||||
|
Page = CurrentPage;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPagerSize(string direction)
|
||||||
|
{
|
||||||
|
if (direction == "forward")
|
||||||
|
{
|
||||||
|
StartPage = EndPage + 1;
|
||||||
|
if (EndPage + MaxPages < Pages)
|
||||||
|
{
|
||||||
|
EndPage = StartPage + MaxPages - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EndPage = Pages;
|
||||||
|
}
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
else if (direction == "back")
|
||||||
|
{
|
||||||
|
EndPage = StartPage - 1;
|
||||||
|
StartPage = StartPage - MaxPages;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NavigateToPage(string direction)
|
||||||
|
{
|
||||||
|
if (direction == "next")
|
||||||
|
{
|
||||||
|
if (Page < Pages)
|
||||||
|
{
|
||||||
|
if (Page == EndPage)
|
||||||
|
{
|
||||||
|
SetPagerSize("forward");
|
||||||
|
}
|
||||||
|
Page += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (direction == "previous")
|
||||||
|
{
|
||||||
|
if (Page > 1)
|
||||||
|
{
|
||||||
|
if (Page == StartPage)
|
||||||
|
{
|
||||||
|
SetPagerSize("back");
|
||||||
|
}
|
||||||
|
Page -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UpdateList(Page);
|
||||||
|
}
|
||||||
|
}
|
|
@ -83,6 +83,9 @@
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string EntityName { get; set; }
|
public string EntityName { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string PermissionNames { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string Permissions { get; set; }
|
public string Permissions { get; set; }
|
||||||
|
|
||||||
|
@ -95,8 +98,7 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
permissionnames = PageState.ModuleDefinitions.Find(item => item.ModuleDefinitionName == ModuleState.ModuleDefinitionName).Permissions;
|
if (string.IsNullOrEmpty(PermissionNames))
|
||||||
if (string.IsNullOrEmpty(permissionnames))
|
|
||||||
{
|
{
|
||||||
permissionnames = "View,Edit";
|
permissionnames = "View,Edit";
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,11 @@ namespace Oqtane.Modules
|
||||||
|
|
||||||
public virtual bool UseAdminContainer { get { return true; } }
|
public virtual bool UseAdminContainer { get { return true; } }
|
||||||
|
|
||||||
|
public string ModulePath()
|
||||||
|
{
|
||||||
|
return "Modules/" + this.GetType().Namespace + "/";
|
||||||
|
}
|
||||||
|
|
||||||
public string NavigateUrl()
|
public string NavigateUrl()
|
||||||
{
|
{
|
||||||
return NavigateUrl(PageState.Page.Path);
|
return NavigateUrl(PageState.Page.Path);
|
||||||
|
|
|
@ -6,7 +6,8 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public interface IModuleDefinitionService
|
public interface IModuleDefinitionService
|
||||||
{
|
{
|
||||||
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync();
|
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int SiteId);
|
||||||
|
Task UpdateModuleDefinitionAsync(ModuleDefinition ModuleDefinition);
|
||||||
Task InstallModulesAsync();
|
Task InstallModulesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,7 @@ namespace Oqtane.Services
|
||||||
Task<List<Tenant>> GetTenantsAsync();
|
Task<List<Tenant>> GetTenantsAsync();
|
||||||
|
|
||||||
Task<Tenant> GetTenantAsync();
|
Task<Tenant> GetTenantAsync();
|
||||||
|
|
||||||
|
Task<Tenant> AddTenantAsync(Tenant Tenant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace Oqtane.Services
|
||||||
public interface IUserRoleService
|
public interface IUserRoleService
|
||||||
{
|
{
|
||||||
Task<List<UserRole>> GetUserRolesAsync();
|
Task<List<UserRole>> GetUserRolesAsync();
|
||||||
Task<List<UserRole>> GetUserRolesAsync(int UserId);
|
Task<List<UserRole>> GetUserRolesAsync(int SiteId);
|
||||||
Task<UserRole> GetUserRoleAsync(int UserRoleId);
|
Task<UserRole> GetUserRoleAsync(int UserRoleId);
|
||||||
Task<UserRole> AddUserRoleAsync(UserRole UserRole);
|
Task<UserRole> AddUserRoleAsync(UserRole UserRole);
|
||||||
Task<UserRole> UpdateUserRoleAsync(UserRole UserRole);
|
Task<UserRole> UpdateUserRoleAsync(UserRole UserRole);
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public interface IUserService
|
public interface IUserService
|
||||||
{
|
{
|
||||||
Task<List<User>> GetUsersAsync(int SiteId);
|
Task<List<User>> GetUsersAsync();
|
||||||
|
|
||||||
Task<User> GetUserAsync(int UserId, int SiteId);
|
Task<User> GetUserAsync(int UserId, int SiteId);
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,10 @@ namespace Oqtane.Services
|
||||||
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "ModuleDefinition"); }
|
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "ModuleDefinition"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync()
|
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int SiteId)
|
||||||
{
|
{
|
||||||
// get list of modules from the server
|
// get list of modules from the server
|
||||||
List<ModuleDefinition> moduledefinitions = await http.GetJsonAsync<List<ModuleDefinition>>(apiurl);
|
List<ModuleDefinition> moduledefinitions = await http.GetJsonAsync<List<ModuleDefinition>>(apiurl + "?siteid=" + SiteId.ToString());
|
||||||
|
|
||||||
// get list of loaded assemblies on the client ( in the client-side hosting module the browser client has its own app domain )
|
// get list of loaded assemblies on the client ( in the client-side hosting module the browser client has its own app domain )
|
||||||
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
|
@ -64,6 +64,11 @@ namespace Oqtane.Services
|
||||||
return moduledefinitions.OrderBy(item => item.Name).ToList();
|
return moduledefinitions.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task UpdateModuleDefinitionAsync(ModuleDefinition ModuleDefinition)
|
||||||
|
{
|
||||||
|
await http.PutJsonAsync<Page>(apiurl + "/" + ModuleDefinition.ModuleDefinitionId.ToString(), ModuleDefinition);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task InstallModulesAsync()
|
public async Task InstallModulesAsync()
|
||||||
{
|
{
|
||||||
await http.GetJsonAsync<List<string>>(apiurl + "/install");
|
await http.GetJsonAsync<List<string>>(apiurl + "/install");
|
||||||
|
|
|
@ -36,5 +36,10 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
return await http.GetJsonAsync<Tenant>(apiurl);
|
return await http.GetJsonAsync<Tenant>(apiurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Tenant> AddTenantAsync(Tenant Tenant)
|
||||||
|
{
|
||||||
|
return await http.PostJsonAsync<Tenant>(apiurl, Tenant);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ namespace Oqtane.Services
|
||||||
return await http.GetJsonAsync<List<UserRole>>(apiurl);
|
return await http.GetJsonAsync<List<UserRole>>(apiurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<UserRole>> GetUserRolesAsync(int UserId)
|
public async Task<List<UserRole>> GetUserRolesAsync(int SiteId)
|
||||||
{
|
{
|
||||||
return await http.GetJsonAsync<List<UserRole>>(apiurl + "?userid=" + UserId.ToString());
|
return await http.GetJsonAsync<List<UserRole>>(apiurl + "?siteid=" + SiteId.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserRole> GetUserRoleAsync(int UserRoleId)
|
public async Task<UserRole> GetUserRoleAsync(int UserRoleId)
|
||||||
|
|
|
@ -27,9 +27,9 @@ namespace Oqtane.Services
|
||||||
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "User"); }
|
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "User"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<User>> GetUsersAsync(int SiteId)
|
public async Task<List<User>> GetUsersAsync()
|
||||||
{
|
{
|
||||||
List<User> users = await http.GetJsonAsync<List<User>>(apiurl + "?siteid=" + SiteId.ToString());
|
List<User> users = await http.GetJsonAsync<List<User>>(apiurl);
|
||||||
return users.OrderBy(item => item.DisplayName).ToList();
|
return users.OrderBy(item => item.DisplayName).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
@namespace Oqtane.Shared
|
@namespace Oqtane.Shared
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IInstallationService InstallationService
|
@inject IInstallationService InstallationService
|
||||||
|
@inject ISiteService SiteService
|
||||||
|
@inject IAliasService AliasService
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -165,12 +167,18 @@
|
||||||
GenericResponse response = await InstallationService.Install(connectionstring);
|
GenericResponse response = await InstallationService.Install(connectionstring);
|
||||||
if (response.Success)
|
if (response.Success)
|
||||||
{
|
{
|
||||||
|
Site site = new Site();
|
||||||
|
site.Name = "Site1";
|
||||||
|
site.Logo = "oqtane.png";
|
||||||
|
site.DefaultThemeType = "Oqtane.Themes.Theme2.Theme2, Oqtane.Client";
|
||||||
|
site.DefaultLayoutType = "";
|
||||||
|
site = await SiteService.AddSiteAsync(site);
|
||||||
|
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.SiteId = 1;
|
user.SiteId = site.SiteId;
|
||||||
user.Username = Email;
|
user.Username = Email;
|
||||||
user.DisplayName = Email;
|
user.DisplayName = Email;
|
||||||
user.Email = Email;
|
user.Email = Email;
|
||||||
user.IsHost = true;
|
|
||||||
user.Password = HostPassword;
|
user.Password = HostPassword;
|
||||||
user = await UserService.AddUserAsync(user);
|
user = await UserService.AddUserAsync(user);
|
||||||
|
|
||||||
|
|
|
@ -119,14 +119,12 @@
|
||||||
|
|
||||||
if (PageState == null || reload == Reload.Application)
|
if (PageState == null || reload == Reload.Application)
|
||||||
{
|
{
|
||||||
moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync();
|
|
||||||
themes = await ThemeService.GetThemesAsync();
|
themes = await ThemeService.GetThemesAsync();
|
||||||
aliases = await AliasService.GetAliasesAsync();
|
aliases = await AliasService.GetAliasesAsync();
|
||||||
alias = null;
|
alias = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moduledefinitions = PageState.ModuleDefinitions;
|
|
||||||
themes = PageState.Themes;
|
themes = PageState.Themes;
|
||||||
aliases = PageState.Aliases;
|
aliases = PageState.Aliases;
|
||||||
alias = PageState.Alias;
|
alias = PageState.Alias;
|
||||||
|
@ -151,10 +149,12 @@
|
||||||
{
|
{
|
||||||
if (PageState == null || reload >= Reload.Site)
|
if (PageState == null || reload >= Reload.Site)
|
||||||
{
|
{
|
||||||
|
moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(site.SiteId);
|
||||||
pages = await PageService.GetPagesAsync(site.SiteId);
|
pages = await PageService.GetPagesAsync(site.SiteId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
moduledefinitions = PageState.ModuleDefinitions;
|
||||||
pages = PageState.Pages;
|
pages = PageState.Pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@using Oqtane.Shared
|
@using Oqtane.Shared
|
||||||
@using Oqtane.Security
|
@using Oqtane.Security
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeObjectBase
|
@inherits ThemeControlBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@inject IModuleDefinitionService ModuleDefinitionService
|
@inject IModuleDefinitionService ModuleDefinitionService
|
||||||
|
@ -40,12 +40,22 @@
|
||||||
<td>
|
<td>
|
||||||
@if (moduledefinitions != null)
|
@if (moduledefinitions != null)
|
||||||
{
|
{
|
||||||
|
<select class="form-control" @onchange="(e => CategoryChanged(e))">
|
||||||
|
<option value="-"><Common Modules></option>
|
||||||
|
@foreach (var category in categories)
|
||||||
|
{
|
||||||
|
<option value="@category">@category</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
<select class="form-control" @bind="@moduledefinitionname">
|
<select class="form-control" @bind="@moduledefinitionname">
|
||||||
<option value=""><Select Module></option>
|
<option value=""><Select Module></option>
|
||||||
@foreach (var moduledefinition in moduledefinitions)
|
@foreach (var moduledefinition in moduledefinitions)
|
||||||
|
{
|
||||||
|
if (moduledefinition.Permissions == "[]" || UserSecurity.IsAuthorized(PageState.User, "Utilize", moduledefinition.Permissions))
|
||||||
{
|
{
|
||||||
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
|
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</select>
|
</select>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
|
@ -115,9 +125,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
List<string> categories = new List<string>();
|
||||||
List<ModuleDefinition> moduledefinitions;
|
List<ModuleDefinition> moduledefinitions;
|
||||||
Dictionary<string, string> containers = new Dictionary<string, string>();
|
Dictionary<string, string> containers = new Dictionary<string, string>();
|
||||||
int pagemanagementmoduleid = -1;
|
int pagemanagementmoduleid = -1;
|
||||||
|
string category = "";
|
||||||
string moduledefinitionname = "";
|
string moduledefinitionname = "";
|
||||||
string pane = "";
|
string pane = "";
|
||||||
string title = "";
|
string title = "";
|
||||||
|
@ -127,7 +139,20 @@
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
moduledefinitions = PageState.ModuleDefinitions;
|
foreach(ModuleDefinition moduledefinition in PageState.ModuleDefinitions)
|
||||||
|
{
|
||||||
|
if (moduledefinition.Categories != "")
|
||||||
|
{
|
||||||
|
foreach(string category in moduledefinition.Categories.Split(','))
|
||||||
|
{
|
||||||
|
if (!categories.Contains(category))
|
||||||
|
{
|
||||||
|
categories.Add(category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
moduledefinitions = PageState.ModuleDefinitions.Where(item => item.Categories == "").ToList();
|
||||||
containers = ThemeService.GetContainerTypes(PageState.Themes);
|
containers = ThemeService.GetContainerTypes(PageState.Themes);
|
||||||
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule);
|
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule);
|
||||||
if (modules.Count > 0)
|
if (modules.Count > 0)
|
||||||
|
@ -137,6 +162,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CategoryChanged(ChangeEventArgs e)
|
||||||
|
{
|
||||||
|
string category = (string)e.Value;
|
||||||
|
if (category == "-")
|
||||||
|
{
|
||||||
|
moduledefinitions = PageState.ModuleDefinitions.Where(item => item.Categories == "").ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
moduledefinitions = PageState.ModuleDefinitions.Where(item => item.Categories.Contains(e.Value.ToString())).ToList();
|
||||||
|
}
|
||||||
|
moduledefinitionname = "";
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
private async Task AddModule()
|
private async Task AddModule()
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
||||||
|
@ -145,14 +185,11 @@
|
||||||
module.SiteId = PageState.Site.SiteId;
|
module.SiteId = PageState.Site.SiteId;
|
||||||
module.ModuleDefinitionName = moduledefinitionname;
|
module.ModuleDefinitionName = moduledefinitionname;
|
||||||
module.Permissions = PageState.Page.Permissions;
|
module.Permissions = PageState.Page.Permissions;
|
||||||
await ModuleService.AddModuleAsync(module);
|
module = await ModuleService.AddModuleAsync(module);
|
||||||
|
|
||||||
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, moduledefinitionname);
|
|
||||||
int ModuleId = modules.LastOrDefault().ModuleId;
|
|
||||||
|
|
||||||
PageModule pagemodule = new PageModule();
|
PageModule pagemodule = new PageModule();
|
||||||
pagemodule.PageId = PageState.Page.PageId;
|
pagemodule.PageId = PageState.Page.PageId;
|
||||||
pagemodule.ModuleId = ModuleId;
|
pagemodule.ModuleId = module.ModuleId;
|
||||||
if (title == "")
|
if (title == "")
|
||||||
{
|
{
|
||||||
title = moduledefinitions.Where(item => item.ModuleDefinitionName == moduledefinitionname).FirstOrDefault().Name;
|
title = moduledefinitions.Where(item => item.ModuleDefinitionName == moduledefinitionname).FirstOrDefault().Name;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@using Oqtane.Shared
|
@using Oqtane.Shared
|
||||||
@using Microsoft.JSInterop
|
@using Microsoft.JSInterop
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeObjectBase
|
@inherits ThemeControlBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@inject IJSRuntime jsRuntime
|
@inject IJSRuntime jsRuntime
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
{
|
{
|
||||||
returnurl += "/" + PageState.Page.Path;
|
returnurl += "/" + PageState.Page.Path;
|
||||||
}
|
}
|
||||||
NavigationManager.NavigateTo("login?returnurl=" + returnurl);
|
NavigationManager.NavigateTo(NavigateUrl("login", "returnurl=" + returnurl));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LogoutUser()
|
private async Task LogoutUser()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
@using Oqtane.Themes
|
@using Oqtane.Themes
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeObjectBase
|
@inherits ThemeControlBase
|
||||||
|
|
||||||
@((MarkupString)logo)
|
@((MarkupString)logo)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@using Oqtane.Models;
|
@using Oqtane.Models;
|
||||||
@using Oqtane.Security
|
@using Oqtane.Security
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeObjectBase
|
@inherits ThemeControlBase
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
|
||||||
@if (menu != "")
|
@if (menu != "")
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
}
|
}
|
||||||
if (p.Icon != "")
|
if (p.Icon != "")
|
||||||
{
|
{
|
||||||
menu += "<span class=\"oi " + p.Icon + "\" aria-hidden=\"true\"></span>";
|
menu += "<span class=\"oi oi-" + p.Icon + "\" aria-hidden=\"true\"></span>";
|
||||||
}
|
}
|
||||||
menu += p.Name;
|
menu += p.Name;
|
||||||
menu += "</a>\n";
|
menu += "</a>\n";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
@using Oqtane.Themes
|
@using Oqtane.Themes
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeObjectBase
|
@inherits ThemeControlBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
<AuthorizeView>
|
<AuthorizeView>
|
||||||
|
|
|
@ -10,6 +10,11 @@ namespace Oqtane.Themes
|
||||||
public virtual string Name { get; set; }
|
public virtual string Name { get; set; }
|
||||||
public virtual string Panes { get; set; }
|
public virtual string Panes { get; set; }
|
||||||
|
|
||||||
|
public string ThemePath()
|
||||||
|
{
|
||||||
|
return "Themes/" + this.GetType().Namespace + "/";
|
||||||
|
}
|
||||||
|
|
||||||
public string NavigateUrl()
|
public string NavigateUrl()
|
||||||
{
|
{
|
||||||
return NavigateUrl(PageState.Page.Path);
|
return NavigateUrl(PageState.Page.Path);
|
||||||
|
@ -40,5 +45,19 @@ namespace Oqtane.Themes
|
||||||
return Utilities.NavigateUrl(PageState.Alias.Path, path, parameters, reload);
|
return Utilities.NavigateUrl(PageState.Alias.Path, path, parameters, reload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string EditUrl(int moduleid, string action)
|
||||||
|
{
|
||||||
|
return EditUrl(moduleid, action, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string EditUrl(int moduleid, string action, string parameters)
|
||||||
|
{
|
||||||
|
return EditUrl(PageState.Page.Path, moduleid, action, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string EditUrl(string path, int moduleid, string action, string parameters)
|
||||||
|
{
|
||||||
|
return Utilities.EditUrl(PageState.Alias.Path, path, moduleid, action, parameters);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ using Oqtane.Shared;
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
namespace Oqtane.Themes
|
||||||
{
|
{
|
||||||
public class ThemeObjectBase : ComponentBase
|
public class ThemeControlBase : ComponentBase
|
||||||
{
|
{
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected PageState PageState { get; set; }
|
protected PageState PageState { get; set; }
|
|
@ -4,11 +4,7 @@ using Oqtane.Repository;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Oqtane.Infrastructure;
|
||||||
using System.IO.Compression;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
|
@ -16,58 +12,37 @@ namespace Oqtane.Controllers
|
||||||
public class ModuleDefinitionController : Controller
|
public class ModuleDefinitionController : Controller
|
||||||
{
|
{
|
||||||
private readonly IModuleDefinitionRepository ModuleDefinitions;
|
private readonly IModuleDefinitionRepository ModuleDefinitions;
|
||||||
private readonly IHostApplicationLifetime HostApplicationLifetime;
|
private readonly IInstallation Installation;
|
||||||
private readonly IWebHostEnvironment environment;
|
|
||||||
|
|
||||||
public ModuleDefinitionController(IModuleDefinitionRepository ModuleDefinitions, IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
|
public ModuleDefinitionController(IModuleDefinitionRepository ModuleDefinitions, IInstallation Installation)
|
||||||
{
|
{
|
||||||
this.ModuleDefinitions = ModuleDefinitions;
|
this.ModuleDefinitions = ModuleDefinitions;
|
||||||
this.HostApplicationLifetime = HostApplicationLifetime;
|
this.Installation = Installation;
|
||||||
this.environment = environment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<ModuleDefinition> Get()
|
public IEnumerable<ModuleDefinition> Get(string siteid)
|
||||||
{
|
{
|
||||||
return ModuleDefinitions.GetModuleDefinitions();
|
return ModuleDefinitions.GetModuleDefinitions(int.Parse(siteid));
|
||||||
|
}
|
||||||
|
|
||||||
|
// PUT api/<controller>/5
|
||||||
|
[HttpPut("{id}")]
|
||||||
|
[Authorize(Roles = Constants.AdminRole)]
|
||||||
|
public void Put(int id, [FromBody] ModuleDefinition ModuleDefinition)
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
ModuleDefinitions.UpdateModuleDefinition(ModuleDefinition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("install")]
|
[HttpGet("install")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = Constants.HostRole)]
|
||||||
public void InstallModules()
|
public void InstallModules()
|
||||||
{
|
{
|
||||||
bool install = false;
|
Installation.Install("Modules");
|
||||||
string modulefolder = Path.Combine(environment.WebRootPath, "Modules");
|
|
||||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
|
||||||
|
|
||||||
// iterate through module packages
|
|
||||||
foreach (string packagename in Directory.GetFiles(modulefolder, "*.nupkg"))
|
|
||||||
{
|
|
||||||
// iterate through files and deploy to appropriate locations
|
|
||||||
using (ZipArchive archive = ZipFile.OpenRead(packagename))
|
|
||||||
{
|
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
|
||||||
{
|
|
||||||
string filename = Path.GetFileName(entry.FullName);
|
|
||||||
switch (Path.GetExtension(filename))
|
|
||||||
{
|
|
||||||
case ".dll":
|
|
||||||
entry.ExtractToFile(Path.Combine(binfolder, filename));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// remove module package
|
|
||||||
System.IO.File.Delete(packagename);
|
|
||||||
install = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (install)
|
|
||||||
{
|
|
||||||
// restart application
|
|
||||||
HostApplicationLifetime.StopApplication();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
|
@ -33,13 +34,24 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
|
||||||
public Site Post([FromBody] Site Site)
|
public Site Post([FromBody] Site Site)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
bool authorized;
|
||||||
|
if (!Sites.GetSites().Any())
|
||||||
|
{
|
||||||
|
authorized = true; // provision initial site during installation
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
authorized = User.IsInRole(Constants.HostRole);
|
||||||
|
}
|
||||||
|
if (authorized)
|
||||||
{
|
{
|
||||||
Site = Sites.AddSite(Site);
|
Site = Sites.AddSite(Site);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return Site;
|
return Site;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using System.IO;
|
using Oqtane.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.IO.Compression;
|
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
|
@ -16,14 +12,12 @@ namespace Oqtane.Controllers
|
||||||
public class ThemeController : Controller
|
public class ThemeController : Controller
|
||||||
{
|
{
|
||||||
private readonly IThemeRepository Themes;
|
private readonly IThemeRepository Themes;
|
||||||
private readonly IHostApplicationLifetime HostApplicationLifetime;
|
private readonly IInstallation Installation;
|
||||||
private readonly IWebHostEnvironment environment;
|
|
||||||
|
|
||||||
public ThemeController(IThemeRepository Themes, IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
|
public ThemeController(IThemeRepository Themes, IInstallation Installation)
|
||||||
{
|
{
|
||||||
this.Themes = Themes;
|
this.Themes = Themes;
|
||||||
this.HostApplicationLifetime = HostApplicationLifetime;
|
this.Installation = Installation;
|
||||||
this.environment = environment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/<controller>
|
// GET: api/<controller>
|
||||||
|
@ -37,37 +31,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = Constants.HostRole)]
|
||||||
public void InstallThemes()
|
public void InstallThemes()
|
||||||
{
|
{
|
||||||
bool install = false;
|
Installation.Install("Themes");
|
||||||
string themefolder = Path.Combine(environment.WebRootPath, "Themes");
|
|
||||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
|
||||||
|
|
||||||
// iterate through theme packages
|
|
||||||
foreach (string packagename in Directory.GetFiles(themefolder, "*.nupkg"))
|
|
||||||
{
|
|
||||||
// iterate through files and deploy to appropriate locations
|
|
||||||
using (ZipArchive archive = ZipFile.OpenRead(packagename))
|
|
||||||
{
|
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
|
||||||
{
|
|
||||||
string filename = Path.GetFileName(entry.FullName);
|
|
||||||
switch (Path.GetExtension(filename))
|
|
||||||
{
|
|
||||||
case ".dll":
|
|
||||||
entry.ExtractToFile(Path.Combine(binfolder, filename));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// remove theme package
|
|
||||||
System.IO.File.Delete(packagename);
|
|
||||||
install = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (install)
|
|
||||||
{
|
|
||||||
// restart application
|
|
||||||
HostApplicationLifetime.StopApplication();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,16 +16,14 @@ namespace Oqtane.Controllers
|
||||||
public class UserController : Controller
|
public class UserController : Controller
|
||||||
{
|
{
|
||||||
private readonly IUserRepository Users;
|
private readonly IUserRepository Users;
|
||||||
private readonly ISiteUserRepository SiteUsers;
|
|
||||||
private readonly IRoleRepository Roles;
|
private readonly IRoleRepository Roles;
|
||||||
private readonly IUserRoleRepository UserRoles;
|
private readonly IUserRoleRepository UserRoles;
|
||||||
private readonly UserManager<IdentityUser> IdentityUserManager;
|
private readonly UserManager<IdentityUser> IdentityUserManager;
|
||||||
private readonly SignInManager<IdentityUser> IdentitySignInManager;
|
private readonly SignInManager<IdentityUser> IdentitySignInManager;
|
||||||
|
|
||||||
public UserController(IUserRepository Users, ISiteUserRepository SiteUsers, IRoleRepository Roles, IUserRoleRepository UserRoles, UserManager<IdentityUser> IdentityUserManager, SignInManager<IdentityUser> IdentitySignInManager)
|
public UserController(IUserRepository Users, IRoleRepository Roles, IUserRoleRepository UserRoles, UserManager<IdentityUser> IdentityUserManager, SignInManager<IdentityUser> IdentitySignInManager)
|
||||||
{
|
{
|
||||||
this.Users = Users;
|
this.Users = Users;
|
||||||
this.SiteUsers = SiteUsers;
|
|
||||||
this.Roles = Roles;
|
this.Roles = Roles;
|
||||||
this.UserRoles = UserRoles;
|
this.UserRoles = UserRoles;
|
||||||
this.IdentityUserManager = IdentityUserManager;
|
this.IdentityUserManager = IdentityUserManager;
|
||||||
|
@ -34,17 +32,9 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>?siteid=x
|
// GET: api/<controller>?siteid=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<User> Get(string siteid)
|
public IEnumerable<User> Get()
|
||||||
{
|
{
|
||||||
List<User> users = new List<User>();
|
return Users.GetUsers();
|
||||||
IEnumerable<SiteUser> siteusers = SiteUsers.GetSiteUsers(int.Parse(siteid));
|
|
||||||
foreach (SiteUser siteuser in siteusers)
|
|
||||||
{
|
|
||||||
User user = siteuser.User;
|
|
||||||
user.SiteId = siteuser.SiteId;
|
|
||||||
users.Add(user);
|
|
||||||
}
|
|
||||||
return users;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET api/<controller>/5?siteid=x
|
// GET api/<controller>/5?siteid=x
|
||||||
|
@ -55,19 +45,8 @@ namespace Oqtane.Controllers
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
user.SiteId = int.Parse(siteid);
|
user.SiteId = int.Parse(siteid);
|
||||||
if (!user.IsHost) // host users are part of every site by default
|
|
||||||
{
|
|
||||||
SiteUser siteuser = SiteUsers.GetSiteUser(user.SiteId, id);
|
|
||||||
if (siteuser != null)
|
|
||||||
{
|
|
||||||
user.Roles = GetUserRoles(user.UserId, user.SiteId);
|
user.Roles = GetUserRoles(user.UserId, user.SiteId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
user.Roles = ";" + Constants.HostRole + ";" + Constants.AdminRole + ";";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,23 +58,8 @@ namespace Oqtane.Controllers
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
user.SiteId = int.Parse(siteid);
|
user.SiteId = int.Parse(siteid);
|
||||||
if (!user.IsHost) // host users are part of every site by default
|
|
||||||
{
|
|
||||||
SiteUser siteuser = SiteUsers.GetSiteUser(user.SiteId, user.UserId);
|
|
||||||
if (siteuser != null)
|
|
||||||
{
|
|
||||||
user.Roles = GetUserRoles(user.UserId, user.SiteId);
|
user.Roles = GetUserRoles(user.UserId, user.SiteId);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
user = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
user.Roles = ";" + Constants.HostRole + ";" + Constants.AdminRole + ";";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,11 +71,12 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
//bool installed = true;
|
int hostroleid = -1;
|
||||||
//if (!Users.GetUsers().Any())
|
if (!Users.GetUsers().Any())
|
||||||
//{
|
{
|
||||||
// installed = false; // during initial installation we need to be able to create the host user
|
hostroleid = Roles.GetRoles(User.SiteId, true).Where(item => item.Name == Constants.HostRole).FirstOrDefault().RoleId;
|
||||||
//}
|
}
|
||||||
|
|
||||||
IdentityUser identityuser = await IdentityUserManager.FindByNameAsync(User.Username);
|
IdentityUser identityuser = await IdentityUserManager.FindByNameAsync(User.Username);
|
||||||
if (identityuser == null)
|
if (identityuser == null)
|
||||||
{
|
{
|
||||||
|
@ -122,13 +87,19 @@ namespace Oqtane.Controllers
|
||||||
if (result.Succeeded)
|
if (result.Succeeded)
|
||||||
{
|
{
|
||||||
user = Users.AddUser(User);
|
user = Users.AddUser(User);
|
||||||
if (!user.IsHost) // host users are part of every site by default
|
|
||||||
{
|
|
||||||
SiteUser siteuser = new SiteUser();
|
|
||||||
siteuser.SiteId = User.SiteId;
|
|
||||||
siteuser.UserId = user.UserId;
|
|
||||||
SiteUsers.AddSiteUser(siteuser);
|
|
||||||
|
|
||||||
|
// assign to host role if this is the initial installation
|
||||||
|
if (hostroleid != -1)
|
||||||
|
{
|
||||||
|
UserRole userrole = new UserRole();
|
||||||
|
userrole.UserId = user.UserId;
|
||||||
|
userrole.RoleId = hostroleid;
|
||||||
|
userrole.EffectiveDate = null;
|
||||||
|
userrole.ExpiryDate = null;
|
||||||
|
UserRoles.AddUserRole(userrole);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add auto assigned roles to user for site
|
||||||
List<Role> roles = Roles.GetRoles(user.SiteId).Where(item => item.IsAutoAssigned == true).ToList();
|
List<Role> roles = Roles.GetRoles(user.SiteId).Where(item => item.IsAutoAssigned == true).ToList();
|
||||||
foreach (Role role in roles)
|
foreach (Role role in roles)
|
||||||
{
|
{
|
||||||
|
@ -141,20 +112,11 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user = Users.GetUser(User.Username);
|
user = Users.GetUser(User.Username);
|
||||||
SiteUser siteuser = SiteUsers.GetSiteUser(User.SiteId, user.UserId);
|
|
||||||
if (siteuser == null)
|
|
||||||
{
|
|
||||||
if (!user.IsHost) // host users are part of every site by default
|
|
||||||
{
|
|
||||||
siteuser = new SiteUser();
|
|
||||||
siteuser.SiteId = User.SiteId;
|
|
||||||
siteuser.UserId = user.UserId;
|
|
||||||
SiteUsers.AddSiteUser(siteuser);
|
|
||||||
|
|
||||||
|
// add auto assigned roles to user for site
|
||||||
List<Role> roles = Roles.GetRoles(User.SiteId).Where(item => item.IsAutoAssigned == true).ToList();
|
List<Role> roles = Roles.GetRoles(User.SiteId).Where(item => item.IsAutoAssigned == true).ToList();
|
||||||
foreach (Role role in roles)
|
foreach (Role role in roles)
|
||||||
{
|
{
|
||||||
|
@ -167,8 +129,6 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
@ -188,13 +148,9 @@ namespace Oqtane.Controllers
|
||||||
// DELETE api/<controller>/5?siteid=x
|
// DELETE api/<controller>/5?siteid=x
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = Constants.AdminRole)]
|
||||||
public void Delete(int id, string siteid)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
SiteUser siteuser = SiteUsers.GetSiteUser(id, int.Parse(siteid));
|
Users.DeleteUser(id);
|
||||||
if (siteuser != null)
|
|
||||||
{
|
|
||||||
SiteUsers.DeleteSiteUser(siteuser.SiteUserId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST api/<controller>/login
|
// POST api/<controller>/login
|
||||||
|
@ -213,20 +169,9 @@ namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
user = Users.GetUser(identityuser.UserName);
|
user = Users.GetUser(identityuser.UserName);
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
|
||||||
if (!user.IsHost) // host users are part of every site by default
|
|
||||||
{
|
|
||||||
SiteUser siteuser = SiteUsers.GetSiteUser(User.SiteId, user.UserId);
|
|
||||||
if (siteuser != null)
|
|
||||||
{
|
{
|
||||||
user.IsAuthenticated = true;
|
user.IsAuthenticated = true;
|
||||||
}
|
if (SetCookie)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
user.IsAuthenticated = true;
|
|
||||||
}
|
|
||||||
if (user.IsAuthenticated && SetCookie)
|
|
||||||
{
|
{
|
||||||
await IdentitySignInManager.SignInAsync(identityuser, IsPersistent);
|
await IdentitySignInManager.SignInAsync(identityuser, IsPersistent);
|
||||||
}
|
}
|
||||||
|
@ -266,10 +211,14 @@ namespace Oqtane.Controllers
|
||||||
private string GetUserRoles(int UserId, int SiteId)
|
private string GetUserRoles(int UserId, int SiteId)
|
||||||
{
|
{
|
||||||
string roles = "";
|
string roles = "";
|
||||||
IEnumerable<UserRole> userroles = UserRoles.GetUserRoles(UserId, SiteId);
|
List<UserRole> userroles = UserRoles.GetUserRoles(UserId, SiteId).ToList();
|
||||||
foreach (UserRole userrole in userroles)
|
foreach (UserRole userrole in userroles)
|
||||||
{
|
{
|
||||||
roles += userrole.Role.Name + ";";
|
roles += userrole.Role.Name + ";";
|
||||||
|
if (userrole.Role.Name == Constants.HostRole && userroles.Where(item => item.Role.Name == Constants.AdminRole).FirstOrDefault() == null)
|
||||||
|
{
|
||||||
|
roles += Constants.AdminRole + ";";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (roles != "") roles = ";" + roles;
|
if (roles != "") roles = ";" + roles;
|
||||||
return roles;
|
return roles;
|
||||||
|
|
|
@ -19,15 +19,15 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
// GET: api/<controller>?userid=x
|
// GET: api/<controller>?userid=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<UserRole> Get(string userid)
|
public IEnumerable<UserRole> Get(string siteid)
|
||||||
{
|
{
|
||||||
if (userid == "")
|
if (siteid == "")
|
||||||
{
|
{
|
||||||
return UserRoles.GetUserRoles();
|
return UserRoles.GetUserRoles();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return UserRoles.GetUserRoles(int.Parse(userid));
|
return UserRoles.GetUserRoles(int.Parse(siteid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
Oqtane.Server/Infrastructure/IInstallation.cs
Normal file
7
Oqtane.Server/Infrastructure/IInstallation.cs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Oqtane.Infrastructure
|
||||||
|
{
|
||||||
|
public interface IInstallation
|
||||||
|
{
|
||||||
|
void Install(string Folders);
|
||||||
|
}
|
||||||
|
}
|
72
Oqtane.Server/Infrastructure/Installation.cs
Normal file
72
Oqtane.Server/Infrastructure/Installation.cs
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
|
namespace Oqtane.Infrastructure
|
||||||
|
{
|
||||||
|
public class Installation : IInstallation
|
||||||
|
{
|
||||||
|
private readonly IHostApplicationLifetime HostApplicationLifetime;
|
||||||
|
private readonly IWebHostEnvironment environment;
|
||||||
|
|
||||||
|
public Installation(IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
|
||||||
|
{
|
||||||
|
this.HostApplicationLifetime = HostApplicationLifetime;
|
||||||
|
this.environment = environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Install(string Folders)
|
||||||
|
{
|
||||||
|
bool install = false;
|
||||||
|
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
|
||||||
|
foreach (string Folder in Folders.Split(','))
|
||||||
|
{
|
||||||
|
string folder = Path.Combine(environment.WebRootPath, Folder);
|
||||||
|
|
||||||
|
// iterate through theme packages
|
||||||
|
foreach (string packagename in Directory.GetFiles(folder, "*.nupkg"))
|
||||||
|
{
|
||||||
|
string name = Path.GetFileNameWithoutExtension(packagename);
|
||||||
|
string[] segments = name.Split('.');
|
||||||
|
name = string.Join('.', segments, 0, segments.Length - 3);
|
||||||
|
|
||||||
|
// iterate through files and deploy to appropriate locations
|
||||||
|
using (ZipArchive archive = ZipFile.OpenRead(packagename))
|
||||||
|
{
|
||||||
|
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||||
|
{
|
||||||
|
string filename = Path.GetFileName(entry.FullName);
|
||||||
|
switch (Path.GetExtension(filename))
|
||||||
|
{
|
||||||
|
case ".dll":
|
||||||
|
entry.ExtractToFile(Path.Combine(binfolder, filename), true);
|
||||||
|
break;
|
||||||
|
case ".png":
|
||||||
|
case ".jpg":
|
||||||
|
case ".jpeg":
|
||||||
|
case ".gif":
|
||||||
|
case ".svg":
|
||||||
|
case ".js":
|
||||||
|
case ".css":
|
||||||
|
entry.ExtractToFile(folder + "\\" + entry.FullName.Replace("wwwroot", name).Replace("/","\\"), true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// remove package
|
||||||
|
File.Delete(packagename);
|
||||||
|
install = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (install)
|
||||||
|
{
|
||||||
|
// restart application
|
||||||
|
HostApplicationLifetime.StopApplication();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ namespace Oqtane.Repository
|
||||||
|
|
||||||
public virtual DbSet<Alias> Alias { get; set; }
|
public virtual DbSet<Alias> Alias { get; set; }
|
||||||
public virtual DbSet<Tenant> Tenant { get; set; }
|
public virtual DbSet<Tenant> Tenant { get; set; }
|
||||||
|
public virtual DbSet<ModuleDefinition> ModuleDefinition { get; set; }
|
||||||
|
|
||||||
public override int SaveChanges()
|
public override int SaveChanges()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace Oqtane.Repository
|
||||||
public virtual DbSet<Module> Module { get; set; }
|
public virtual DbSet<Module> Module { get; set; }
|
||||||
public virtual DbSet<User> User { get; set; }
|
public virtual DbSet<User> User { get; set; }
|
||||||
public virtual DbSet<Profile> Profile { get; set; }
|
public virtual DbSet<Profile> Profile { get; set; }
|
||||||
public virtual DbSet<SiteUser> SiteUser { get; set; }
|
|
||||||
public virtual DbSet<Role> Role { get; set; }
|
public virtual DbSet<Role> Role { get; set; }
|
||||||
public virtual DbSet<UserRole> UserRole { get; set; }
|
public virtual DbSet<UserRole> UserRole { get; set; }
|
||||||
public virtual DbSet<Permission> Permission { get; set; }
|
public virtual DbSet<Permission> Permission { get; set; }
|
||||||
|
|
|
@ -5,6 +5,8 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public interface IModuleDefinitionRepository
|
public interface IModuleDefinitionRepository
|
||||||
{
|
{
|
||||||
IEnumerable<ModuleDefinition> GetModuleDefinitions();
|
IEnumerable<ModuleDefinition> GetModuleDefinitions(int SideId);
|
||||||
|
void UpdateModuleDefinition(ModuleDefinition ModuleDefinition);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using Oqtane.Models;
|
|
||||||
|
|
||||||
namespace Oqtane.Repository
|
|
||||||
{
|
|
||||||
public interface ISiteUserRepository
|
|
||||||
{
|
|
||||||
IEnumerable<SiteUser> GetSiteUsers();
|
|
||||||
IEnumerable<SiteUser> GetSiteUsers(int SiteId);
|
|
||||||
SiteUser AddSiteUser(SiteUser SiteUser);
|
|
||||||
SiteUser UpdateSiteUser(SiteUser SiteUser);
|
|
||||||
SiteUser GetSiteUser(int SiteUserId);
|
|
||||||
SiteUser GetSiteUser(int SiteId, int UserId);
|
|
||||||
void DeleteSiteUser(int SiteUserId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,7 +6,7 @@ namespace Oqtane.Repository
|
||||||
public interface IUserRoleRepository
|
public interface IUserRoleRepository
|
||||||
{
|
{
|
||||||
IEnumerable<UserRole> GetUserRoles();
|
IEnumerable<UserRole> GetUserRoles();
|
||||||
IEnumerable<UserRole> GetUserRoles(int UserId);
|
IEnumerable<UserRole> GetUserRoles(int SiteId);
|
||||||
IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId);
|
IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId);
|
||||||
UserRole AddUserRole(UserRole UserRole);
|
UserRole AddUserRole(UserRole UserRole);
|
||||||
UserRole UpdateUserRole(UserRole UserRole);
|
UserRole UpdateUserRole(UserRole UserRole);
|
||||||
|
|
|
@ -10,14 +10,16 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public class ModuleDefinitionRepository : IModuleDefinitionRepository
|
public class ModuleDefinitionRepository : IModuleDefinitionRepository
|
||||||
{
|
{
|
||||||
private readonly List<ModuleDefinition> ModuleDefinitions;
|
private MasterDBContext db;
|
||||||
|
private readonly IPermissionRepository Permissions;
|
||||||
|
|
||||||
public ModuleDefinitionRepository()
|
public ModuleDefinitionRepository(MasterDBContext context, IPermissionRepository Permissions)
|
||||||
{
|
{
|
||||||
ModuleDefinitions = LoadModuleDefinitions();
|
db = context;
|
||||||
|
this.Permissions = Permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ModuleDefinition> LoadModuleDefinitions()
|
private List<ModuleDefinition> LoadModuleDefinitions(int SiteId)
|
||||||
{
|
{
|
||||||
List<ModuleDefinition> ModuleDefinitions = new List<ModuleDefinition>();
|
List<ModuleDefinition> ModuleDefinitions = new List<ModuleDefinition>();
|
||||||
|
|
||||||
|
@ -29,6 +31,27 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitions = LoadModuleDefinitionsFromAssembly(ModuleDefinitions, assembly);
|
ModuleDefinitions = LoadModuleDefinitionsFromAssembly(ModuleDefinitions, assembly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sync module definitions with database
|
||||||
|
List<ModuleDefinition> moduledefs = db.ModuleDefinition.ToList();
|
||||||
|
foreach (ModuleDefinition moduledefinition in ModuleDefinitions)
|
||||||
|
{
|
||||||
|
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "ModuleDefinition").ToList();
|
||||||
|
ModuleDefinition moduledef = moduledefs.Where(item => item.ModuleDefinitionName == moduledefinition.ModuleDefinitionName).FirstOrDefault();
|
||||||
|
if (moduledef == null)
|
||||||
|
{
|
||||||
|
moduledef = new ModuleDefinition { ModuleDefinitionName = moduledefinition.ModuleDefinitionName };
|
||||||
|
db.ModuleDefinition.Add(moduledef);
|
||||||
|
db.SaveChanges();
|
||||||
|
}
|
||||||
|
moduledefinition.ModuleDefinitionId = moduledef.ModuleDefinitionId;
|
||||||
|
moduledefinition.SiteId = SiteId;
|
||||||
|
moduledefinition.Permissions = Permissions.EncodePermissions(moduledefinition.ModuleDefinitionId, permissions);
|
||||||
|
moduledefinition.CreatedBy = moduledef.CreatedBy;
|
||||||
|
moduledefinition.CreatedOn = moduledef.CreatedOn;
|
||||||
|
moduledefinition.ModifiedBy = moduledef.ModifiedBy;
|
||||||
|
moduledefinition.ModifiedOn = moduledef.ModifiedOn;
|
||||||
|
}
|
||||||
|
|
||||||
return ModuleDefinitions;
|
return ModuleDefinitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,13 +87,14 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = QualifiedModuleType,
|
ModuleDefinitionName = QualifiedModuleType,
|
||||||
Name = GetProperty(properties, "Name"),
|
Name = GetProperty(properties, "Name"),
|
||||||
Description = GetProperty(properties, "Description"),
|
Description = GetProperty(properties, "Description"),
|
||||||
|
Categories = GetProperty(properties, "Categories"),
|
||||||
Version = GetProperty(properties, "Version"),
|
Version = GetProperty(properties, "Version"),
|
||||||
Owner = GetProperty(properties, "Owner"),
|
Owner = GetProperty(properties, "Owner"),
|
||||||
Url = GetProperty(properties, "Url"),
|
Url = GetProperty(properties, "Url"),
|
||||||
Contact = GetProperty(properties, "Contact"),
|
Contact = GetProperty(properties, "Contact"),
|
||||||
License = GetProperty(properties, "License"),
|
License = GetProperty(properties, "License"),
|
||||||
Dependencies = GetProperty(properties, "Dependencies"),
|
Dependencies = GetProperty(properties, "Dependencies"),
|
||||||
Permissions = GetProperty(properties, "Permissions"),
|
PermissionNames = GetProperty(properties, "PermissionNames"),
|
||||||
ControlTypeTemplate = ModuleType + ".{Control}" + ", " + typename[1],
|
ControlTypeTemplate = ModuleType + ".{Control}" + ", " + typename[1],
|
||||||
ControlTypeRoutes = "",
|
ControlTypeRoutes = "",
|
||||||
AssemblyName = assembly.FullName.Split(",")[0]
|
AssemblyName = assembly.FullName.Split(",")[0]
|
||||||
|
@ -83,13 +107,14 @@ namespace Oqtane.Repository
|
||||||
ModuleDefinitionName = QualifiedModuleType,
|
ModuleDefinitionName = QualifiedModuleType,
|
||||||
Name = ModuleType.Substring(ModuleType.LastIndexOf(".") + 1),
|
Name = ModuleType.Substring(ModuleType.LastIndexOf(".") + 1),
|
||||||
Description = ModuleType.Substring(ModuleType.LastIndexOf(".") + 1),
|
Description = ModuleType.Substring(ModuleType.LastIndexOf(".") + 1),
|
||||||
|
Categories = ((QualifiedModuleType.StartsWith("Oqtane.Modules.Admin.")) ? "Admin" : ""),
|
||||||
Version = new Version(1, 0, 0).ToString(),
|
Version = new Version(1, 0, 0).ToString(),
|
||||||
Owner = "",
|
Owner = "",
|
||||||
Url = "",
|
Url = "",
|
||||||
Contact = "",
|
Contact = "",
|
||||||
License = "",
|
License = "",
|
||||||
Dependencies = "",
|
Dependencies = "",
|
||||||
Permissions = "",
|
PermissionNames = "",
|
||||||
ControlTypeTemplate = ModuleType + ".{Control}" + ", " + typename[1],
|
ControlTypeTemplate = ModuleType + ".{Control}" + ", " + typename[1],
|
||||||
ControlTypeRoutes = "",
|
ControlTypeRoutes = "",
|
||||||
AssemblyName = assembly.FullName.Split(",")[0]
|
AssemblyName = assembly.FullName.Split(",")[0]
|
||||||
|
@ -116,11 +141,6 @@ namespace Oqtane.Repository
|
||||||
return moduledefinitions;
|
return moduledefinitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ModuleDefinition> GetModuleDefinitions()
|
|
||||||
{
|
|
||||||
return ModuleDefinitions;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetProperty(Dictionary<string, string> Properties, string Key)
|
private string GetProperty(Dictionary<string, string> Properties, string Key)
|
||||||
{
|
{
|
||||||
string Value = "";
|
string Value = "";
|
||||||
|
@ -130,5 +150,15 @@ namespace Oqtane.Repository
|
||||||
}
|
}
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<ModuleDefinition> GetModuleDefinitions(int SiteId)
|
||||||
|
{
|
||||||
|
return LoadModuleDefinitions(SiteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateModuleDefinition(ModuleDefinition ModuleDefinition)
|
||||||
|
{
|
||||||
|
Permissions.UpdatePermissions(ModuleDefinition.SiteId, "ModuleDefinition", ModuleDefinition.ModuleDefinitionId, ModuleDefinition.Permissions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,54 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
using Oqtane.Shared;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Oqtane.Repository
|
namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public class SiteRepository : ISiteRepository
|
public class SiteRepository : ISiteRepository
|
||||||
{
|
{
|
||||||
private TenantDBContext db;
|
private readonly TenantDBContext db;
|
||||||
|
private readonly IRoleRepository RoleRepository;
|
||||||
|
private readonly IProfileRepository ProfileRepository;
|
||||||
|
private readonly IPageRepository PageRepository;
|
||||||
|
private readonly IModuleRepository ModuleRepository;
|
||||||
|
private readonly IPageModuleRepository PageModuleRepository;
|
||||||
|
private readonly List<PageTemplate> SiteTemplate;
|
||||||
|
|
||||||
public SiteRepository(TenantDBContext context)
|
public SiteRepository(TenantDBContext context, IRoleRepository RoleRepository, IProfileRepository ProfileRepository, IPageRepository PageRepository, IModuleRepository ModuleRepository, IPageModuleRepository PageModuleRepository)
|
||||||
{
|
{
|
||||||
db = context;
|
db = context;
|
||||||
|
this.RoleRepository = RoleRepository;
|
||||||
|
this.ProfileRepository = ProfileRepository;
|
||||||
|
this.PageRepository = PageRepository;
|
||||||
|
this.ModuleRepository = ModuleRepository;
|
||||||
|
this.PageModuleRepository = PageModuleRepository;
|
||||||
|
|
||||||
|
// defines the default site template
|
||||||
|
SiteTemplate = new List<PageTemplate>();
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Home", Parent = "", Path = "", Order = 1, Icon = "home", IsNavigation = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "", ModulePermissions = "", Title = "", Pane = "", ContainerType = "" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Admin", Parent = "", Path = "admin", Order = 1, Icon = "", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Dashboard, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Administration", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Site Management", Parent = "Admin", Path = "admin/sites", Order = 1, Icon = "globe", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Sites, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Site Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Page Management", Parent = "Admin", Path = "admin/pages", Order = 1, Icon = "layers", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Pages, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Page Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Module Management", Parent = "Admin", Path = "admin/modules", Order = 1, Icon = "browser", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.ModuleDefinitions, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Module Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Theme Management", Parent = "Admin", Path = "admin/themes", Order = 1, Icon = "brush", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Themes, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Theme Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "User Management", Parent = "Admin", Path = "admin/users", Order = 1, Icon = "person", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Users, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "User Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Role Management", Parent = "Admin", Path = "admin/roles", Order = 1, Icon = "lock-locked", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Roles, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Role Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Login", Parent = "", Path = "login", Order = 1, Icon = "lock-locked", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Login, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Login", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Register", Parent = "", Path = "register", Order = 1, Icon = "person", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Register, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Register", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
|
SiteTemplate.Add(new PageTemplate { Name = "Profile", Parent = "", Path = "profile", Order = 1, Icon = "person", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||||
|
ModuleDefinitionName = "Oqtane.Modules.Admin.Profile, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "User Profile", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Site> GetSites()
|
public IEnumerable<Site> GetSites()
|
||||||
|
@ -23,6 +61,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
db.Site.Add(Site);
|
db.Site.Add(Site);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
CreateSite(Site);
|
||||||
return Site;
|
return Site;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,5 +83,74 @@ namespace Oqtane.Repository
|
||||||
db.Site.Remove(site);
|
db.Site.Remove(site);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreateSite(Site site)
|
||||||
|
{
|
||||||
|
RoleRepository.AddRole(new Role { SiteId = null, Name = Constants.AllUsersRole, Description = "All Users", IsAutoAssigned = false, IsSystem = true });
|
||||||
|
RoleRepository.AddRole(new Role { SiteId = null, Name = Constants.HostRole, Description = "Application Administrators", IsAutoAssigned = false, IsSystem = true });
|
||||||
|
|
||||||
|
RoleRepository.AddRole(new Role { SiteId = site.SiteId, Name = Constants.RegisteredRole, Description = "Registered Users", IsAutoAssigned = true, IsSystem = true });
|
||||||
|
RoleRepository.AddRole(new Role { SiteId = site.SiteId, Name = Constants.AdminRole, 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 });
|
||||||
|
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 });
|
||||||
|
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(new Profile { SiteId = site.SiteId, Name = "City", Title = "City", Description = "City", Category = "Address", ViewOrder = 4, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||||
|
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "Region", Title = "Region", Description = "State Or Province", Category = "Address", ViewOrder = 5, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||||
|
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "Country", Title = "Country", Description = "Country", Category = "Address", ViewOrder = 6, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||||
|
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "PostalCode", Title = "Postal Code", Description = "Postal Code Or Zip Code", Category = "Address", ViewOrder = 7, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||||
|
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "Phone", Title = "Phone Number", Description = "Phone Number", Category = "Contact", ViewOrder = 8, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||||
|
|
||||||
|
foreach (PageTemplate pagetemplate in SiteTemplate)
|
||||||
|
{
|
||||||
|
int? parentid = null;
|
||||||
|
if (pagetemplate.Parent != "")
|
||||||
|
{
|
||||||
|
List<Page> pages = PageRepository.GetPages(site.SiteId).ToList();
|
||||||
|
Page parent = pages.Where(item => item.Name == pagetemplate.Parent).FirstOrDefault();
|
||||||
|
parentid = parent.PageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
Page page = new Page
|
||||||
|
{
|
||||||
|
SiteId = site.SiteId,
|
||||||
|
ParentId = parentid,
|
||||||
|
Name = pagetemplate.Name,
|
||||||
|
Path = pagetemplate.Path,
|
||||||
|
Order = pagetemplate.Order,
|
||||||
|
IsNavigation = pagetemplate.IsNavigation,
|
||||||
|
ThemeType = site.DefaultThemeType,
|
||||||
|
LayoutType = site.DefaultLayoutType,
|
||||||
|
Icon = pagetemplate.Icon,
|
||||||
|
Permissions = pagetemplate.PagePermissions
|
||||||
|
};
|
||||||
|
Type type = Type.GetType(page.ThemeType);
|
||||||
|
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
|
||||||
|
page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
|
||||||
|
page = PageRepository.AddPage(page);
|
||||||
|
|
||||||
|
if (pagetemplate.ModuleDefinitionName != "")
|
||||||
|
{
|
||||||
|
Module module = new Module
|
||||||
|
{
|
||||||
|
SiteId = site.SiteId,
|
||||||
|
ModuleDefinitionName = pagetemplate.ModuleDefinitionName,
|
||||||
|
Permissions = pagetemplate.ModulePermissions,
|
||||||
|
};
|
||||||
|
module = ModuleRepository.AddModule(module);
|
||||||
|
|
||||||
|
PageModule pagemodule = new PageModule
|
||||||
|
{
|
||||||
|
PageId = page.PageId,
|
||||||
|
ModuleId = module.ModuleId,
|
||||||
|
Title = pagetemplate.Title,
|
||||||
|
Pane = pagetemplate.Pane,
|
||||||
|
Order = 1,
|
||||||
|
ContainerType = pagetemplate.ContainerType
|
||||||
|
};
|
||||||
|
PageModuleRepository.AddPageModule(pagemodule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Oqtane.Models;
|
|
||||||
|
|
||||||
namespace Oqtane.Repository
|
|
||||||
{
|
|
||||||
public class SiteUserRepository : ISiteUserRepository
|
|
||||||
{
|
|
||||||
private TenantDBContext db;
|
|
||||||
|
|
||||||
public SiteUserRepository(TenantDBContext context)
|
|
||||||
{
|
|
||||||
db = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<SiteUser> GetSiteUsers()
|
|
||||||
{
|
|
||||||
return db.SiteUser;
|
|
||||||
}
|
|
||||||
public IEnumerable<SiteUser> GetSiteUsers(int SiteId)
|
|
||||||
{
|
|
||||||
return db.SiteUser.Where(item => item.SiteId == SiteId)
|
|
||||||
.Include(item => item.User); // eager load users
|
|
||||||
}
|
|
||||||
|
|
||||||
public SiteUser AddSiteUser(SiteUser SiteUser)
|
|
||||||
{
|
|
||||||
db.SiteUser.Add(SiteUser);
|
|
||||||
db.SaveChanges();
|
|
||||||
return SiteUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SiteUser UpdateSiteUser(SiteUser SiteUser)
|
|
||||||
{
|
|
||||||
db.Entry(SiteUser).State = EntityState.Modified;
|
|
||||||
db.SaveChanges();
|
|
||||||
return SiteUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SiteUser GetSiteUser(int SiteUserId)
|
|
||||||
{
|
|
||||||
return db.SiteUser.Include(item => item.User) // eager load users
|
|
||||||
.SingleOrDefault(item => item.SiteUserId == SiteUserId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SiteUser GetSiteUser(int SiteId, int UserId)
|
|
||||||
{
|
|
||||||
return db.SiteUser.Where(item => item.SiteId == SiteId)
|
|
||||||
.Where(item => item.UserId == UserId).FirstOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteSiteUser(int SiteUserId)
|
|
||||||
{
|
|
||||||
SiteUser SiteUser = db.SiteUser.Find(SiteUserId);
|
|
||||||
db.SiteUser.Remove(SiteUser);
|
|
||||||
db.SaveChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,13 +10,6 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public class ThemeRepository : IThemeRepository
|
public class ThemeRepository : IThemeRepository
|
||||||
{
|
{
|
||||||
private readonly List<Theme> Themes;
|
|
||||||
|
|
||||||
public ThemeRepository()
|
|
||||||
{
|
|
||||||
Themes = LoadThemes();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Theme> LoadThemes()
|
private List<Theme> LoadThemes()
|
||||||
{
|
{
|
||||||
List<Theme> Themes = new List<Theme>();
|
List<Theme> Themes = new List<Theme>();
|
||||||
|
@ -119,11 +112,6 @@ namespace Oqtane.Repository
|
||||||
return themes;
|
return themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Theme> GetThemes()
|
|
||||||
{
|
|
||||||
return Themes;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetProperty(Dictionary<string, string> Properties, string Key)
|
private string GetProperty(Dictionary<string, string> Properties, string Key)
|
||||||
{
|
{
|
||||||
string Value = "";
|
string Value = "";
|
||||||
|
@ -133,5 +121,10 @@ namespace Oqtane.Repository
|
||||||
}
|
}
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Theme> GetThemes()
|
||||||
|
{
|
||||||
|
return LoadThemes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,17 +18,20 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
return db.UserRole;
|
return db.UserRole;
|
||||||
}
|
}
|
||||||
public IEnumerable<UserRole> GetUserRoles(int UserId)
|
public IEnumerable<UserRole> GetUserRoles(int SiteId)
|
||||||
{
|
{
|
||||||
return db.UserRole.Where(item => item.UserId == UserId)
|
return db.UserRole
|
||||||
.Include(item => item.Role); // eager load roles
|
.Include(item => item.Role) // eager load roles
|
||||||
|
.Include(item => item.User) // eager load users
|
||||||
|
.Where(item => item.Role.SiteId == SiteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId)
|
public IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId)
|
||||||
{
|
{
|
||||||
return db.UserRole.Where(item => item.UserId == UserId)
|
return db.UserRole.Where(item => item.UserId == UserId)
|
||||||
.Include(item => item.Role) // eager load roles
|
.Include(item => item.Role) // eager load roles
|
||||||
.Where(item => item.Role.SiteId == SiteId);
|
.Include(item => item.User) // eager load users
|
||||||
|
.Where(item => item.Role.SiteId == SiteId || item.Role.SiteId == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserRole AddUserRole(UserRole UserRole)
|
public UserRole AddUserRole(UserRole UserRole)
|
||||||
|
@ -47,7 +50,9 @@ namespace Oqtane.Repository
|
||||||
|
|
||||||
public UserRole GetUserRole(int UserRoleId)
|
public UserRole GetUserRole(int UserRoleId)
|
||||||
{
|
{
|
||||||
return db.UserRole.Include(item => item.Role) // eager load roles
|
return db.UserRole
|
||||||
|
.Include(item => item.Role) // eager load roles
|
||||||
|
.Include(item => item.User) // eager load users
|
||||||
.SingleOrDefault(item => item.UserRoleId == UserRoleId);
|
.SingleOrDefault(item => item.UserRoleId == UserRoleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ CREATE TABLE [dbo].[Site](
|
||||||
[SiteId] [int] IDENTITY(1,1) NOT NULL,
|
[SiteId] [int] IDENTITY(1,1) NOT NULL,
|
||||||
[Name] [nvarchar](200) NOT NULL,
|
[Name] [nvarchar](200) NOT NULL,
|
||||||
[Logo] [nvarchar](50) NOT NULL,
|
[Logo] [nvarchar](50) NOT NULL,
|
||||||
[DefaultThemeType] [nvarchar](200) NULL,
|
[DefaultThemeType] [nvarchar](200) NOT NULL,
|
||||||
|
[DefaultLayoutType] [nvarchar](200) NOT NULL,
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
[CreatedOn] [datetime] NOT NULL,
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||||
|
@ -83,7 +84,6 @@ CREATE TABLE [dbo].[User](
|
||||||
[Username] [nvarchar](256) NOT NULL,
|
[Username] [nvarchar](256) NOT NULL,
|
||||||
[DisplayName] [nvarchar](50) NOT NULL,
|
[DisplayName] [nvarchar](50) NOT NULL,
|
||||||
[Email] [nvarchar](256) NOT NULL,
|
[Email] [nvarchar](256) NOT NULL,
|
||||||
[IsHost] [bit] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
[CreatedOn] [datetime] NOT NULL,
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||||
|
@ -95,21 +95,6 @@ CREATE TABLE [dbo].[User](
|
||||||
)
|
)
|
||||||
GO
|
GO
|
||||||
|
|
||||||
CREATE TABLE [dbo].[SiteUser](
|
|
||||||
[SiteUserId] [int] IDENTITY(1,1) NOT NULL,
|
|
||||||
[SiteId] [int] NOT NULL,
|
|
||||||
[UserId] [int] NOT NULL,
|
|
||||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[CreatedOn] [datetime] NOT NULL,
|
|
||||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
|
||||||
[ModifiedOn] [datetime] NOT NULL,
|
|
||||||
CONSTRAINT [PK_SiteUser] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[SiteUserId] ASC
|
|
||||||
)
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE TABLE [dbo].[Role](
|
CREATE TABLE [dbo].[Role](
|
||||||
[RoleId] [int] IDENTITY(1,1) NOT NULL,
|
[RoleId] [int] IDENTITY(1,1) NOT NULL,
|
||||||
[SiteId] [int] NULL,
|
[SiteId] [int] NULL,
|
||||||
|
@ -245,20 +230,6 @@ REFERENCES [dbo].[Page] ([PageId])
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
GO
|
GO
|
||||||
|
|
||||||
ALTER TABLE [dbo].[SiteUser] WITH CHECK ADD CONSTRAINT [FK_SiteUser_Site] FOREIGN KEY([SiteId])
|
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[SiteUser] WITH CHECK ADD CONSTRAINT [FK_SiteUser_User] FOREIGN KEY([UserId])
|
|
||||||
REFERENCES [dbo].[User] ([UserId])
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[HtmlText] WITH CHECK ADD CONSTRAINT [FK_HtmlText_Module] FOREIGN KEY([ModuleId])
|
|
||||||
REFERENCES [dbo].[Module] ([ModuleId])
|
|
||||||
ON DELETE CASCADE
|
|
||||||
GO
|
|
||||||
|
|
||||||
ALTER TABLE [dbo].[Role] WITH CHECK ADD CONSTRAINT [FK_Role_Site] FOREIGN KEY ([SiteId])
|
ALTER TABLE [dbo].[Role] WITH CHECK ADD CONSTRAINT [FK_Role_Site] FOREIGN KEY ([SiteId])
|
||||||
REFERENCES [dbo].[Site] ([SiteId])
|
REFERENCES [dbo].[Site] ([SiteId])
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
|
@ -291,6 +262,12 @@ REFERENCES [dbo].[Site] ([SiteId])
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
GO
|
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 indexes
|
||||||
|
@ -311,13 +288,6 @@ CREATE UNIQUE NONCLUSTERED INDEX IX_User ON dbo.[User]
|
||||||
) ON [PRIMARY]
|
) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_SiteUser ON dbo.SiteUser
|
|
||||||
(
|
|
||||||
SiteId,
|
|
||||||
UserId
|
|
||||||
) ON [PRIMARY]
|
|
||||||
GO
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Permission ON dbo.Permission
|
CREATE UNIQUE NONCLUSTERED INDEX IX_Permission ON dbo.Permission
|
||||||
(
|
(
|
||||||
SiteId,
|
SiteId,
|
||||||
|
@ -343,482 +313,3 @@ CREATE UNIQUE NONCLUSTERED INDEX IX_UserRole ON dbo.UserRole
|
||||||
) ON [PRIMARY]
|
) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Create seed data
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
SET IDENTITY_INSERT [dbo].[Site] ON
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Site] ([SiteId], [Name], [Logo], [DefaultThemeType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (1, N'Site1', N'oqtane.png', N'Oqtane.Themes.Theme1.Theme1, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Site] ([SiteId], [Name], [Logo], [DefaultThemeType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (2, N'Site2', N'oqtane.png', N'Oqtane.Themes.Theme1.Theme1, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT [dbo].[Site] OFF
|
|
||||||
GO
|
|
||||||
|
|
||||||
SET IDENTITY_INSERT [dbo].[Role] ON
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (-1, null, N'All Users', N'All Users', 0, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (0, null, N'Host Users', N'Host Users', 0, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (1, 1, N'Administrators', N'Site Administrators', 0, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (2, 1, N'Registered Users', N'Registered Users', 1, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (3, 2, N'Administrators', N'Site Administrators', 0, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (4, 2, N'Registered Users', N'Registered Users', 1, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT [dbo].[Role] OFF
|
|
||||||
GO
|
|
||||||
|
|
||||||
SET IDENTITY_INSERT [dbo].[Profile] ON
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (1, null, 'FirstName', 'First Name', 'Your First Or Given Name', 'Name', 1, 50, '', 1, 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (2, null, 'LastName', 'Last Name', 'Your Last Or family Name', 'Name', 2, 50, '', 1, 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (3, null, 'Street', 'Street', 'Street Or Building Address', 'Address', 3, 50, '', 1, 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (4, null, 'City', 'City', 'City', 'Address', 4, 50, '', 1, 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (5, null, 'Region', 'Region', 'State Or Province', 'Address', 5, 50, '', 1, 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (6, null, 'Country', 'Country', 'Country', 'Address', 6, 50, '', 1, 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (7, null, 'PostalCode', 'Postal Code', 'Postal Code Or Zip Code', 'Address', 7, 50, '', 1, 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (8, null, 'Phone', 'Phone Number', 'Phone Number', 'Contact', 8, 50, '', 1, 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT [dbo].[Profile] OFF
|
|
||||||
GO
|
|
||||||
|
|
||||||
SET IDENTITY_INSERT [dbo].[Page] ON
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (1, 1, N'Page1', N'', N'Oqtane.Themes.Theme1.Theme1, Oqtane.Client', N'oi-home', N'Left;Right', NULL, 1, 1, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 1, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 1, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 1, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (2, 1, N'Page2', N'page2', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-plus', N'Top;Bottom', NULL, 3, 1, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 2, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 2, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (3, 1, N'Page3', N'page3', N'Oqtane.Themes.Theme3.Theme3, Oqtane.Client', N'oi-list-rich', N'Left;Right', NULL, 5, 1, N'Oqtane.Themes.Theme3.HorizontalLayout, Oqtane.Client', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 3, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 3, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 3, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (4, 1, N'Admin', N'admin', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', NULL, 7, 0, N'', '', 1, getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 4, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 4, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (8, 1, N'Site Management', N'admin/sites', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 1, 0, N'', 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 8, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 8, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (5, 1, N'Page Management', N'admin/pages', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 3, 0, N'', 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 5, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 5, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (10, 1, N'Module Management', N'admin/modules', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 5, 0, N'', 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 10, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 10, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (11, 1, N'Theme Management', N'admin/themes', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 7, 0, N'', 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 11, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 11, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (9, 1, N'User Management', N'admin/users', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 9, 0, N'', 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 9, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 9, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (16, 1, N'Role Management', N'admin/roles', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 11, 0, N'', 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 16, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 16, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (6, 1, N'Login', N'login', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 7, 0, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 6, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 6, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 6, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (7, 1, N'Register', N'register', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 9, 0, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 7, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 7, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 7, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (17, 1, N'Profile', N'profile', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 11, 0, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 17, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 17, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 17, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (12, 2, N'Page1', N'', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', NULL, 1, 1, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 12, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 12, 'View', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 12, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (13, 2, N'Page2', N'page2', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', NULL, 3, 1, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 13, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 13, 'View', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 13, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (14, 2, N'Login', N'login', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 5, 0, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 14, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 14, 'View', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 14, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (15, 2, N'Register', N'register', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 7, 0, N'', 0, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 15, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 15, 'View', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 15, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT [dbo].[Page] OFF
|
|
||||||
GO
|
|
||||||
|
|
||||||
SET IDENTITY_INSERT [dbo].[Module] ON
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (1, 1, N'Oqtane.Modules.Weather, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 1, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 1, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 1, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (2, 1, N'Oqtane.Modules.Counter, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 2, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 2, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 2, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (3, 1, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 3, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 3, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 3, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (4, 1, N'Oqtane.Modules.Weather, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 4, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 4, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 4, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (5, 1, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 5, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 5, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 5, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (6, 1, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 6, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 6, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 6, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (7, 1, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 7, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 7, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (8, 1, N'Oqtane.Modules.Admin.Pages, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 8, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 8, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (9, 1, N'Oqtane.Modules.Admin.Login, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 9, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 9, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 9, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (10, 1, N'Oqtane.Modules.Admin.Register, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 10, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 10, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 10, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (11, 1, N'Oqtane.Modules.Admin.Dashboard, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 11, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 11, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (12, 1, N'Oqtane.Modules.Admin.Sites, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 12, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 12, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (13, 1, N'Oqtane.Modules.Admin.Users, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 13, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 13, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (14, 1, N'Oqtane.Modules.Admin.ModuleDefinitions, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 14, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 14, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (15, 1, N'Oqtane.Modules.Admin.Themes, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 15, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 15, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (16, 2, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 16, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 16, 'View', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 16, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (17, 2, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 17, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 17, 'View', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 17, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (18, 2, N'Oqtane.Modules.Admin.Login, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 18, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 18, 'View', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 18, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (19, 2, N'Oqtane.Modules.Admin.Register, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 19, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 19, 'View', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 19, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (20, 1, N'Oqtane.Modules.Admin.Roles, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 20, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 20, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (21, 1, N'Oqtane.Modules.Admin.Profile, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 21, 'View', -1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 21, 'View', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 21, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT [dbo].[Module] OFF
|
|
||||||
GO
|
|
||||||
|
|
||||||
SET IDENTITY_INSERT [dbo].[PageModule] ON
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (1, 1, 1, N'Weather', N'Right', 1, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (2, 1, 2, N'Counter', N'Left', 1, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (3, 1, 3, N'Lorem ipsum', N'Left', 3, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (4, 2, 4, N'Weather', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (5, 2, 5, N'Enim sed', N'Top', 3, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (6, 3, 6, N'Id consectetur', N'Left', 1, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (7, 3, 7, N'Ornare arcu', N'Right', 1, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (8, 5, 8, N'Page Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (9, 6, 9, N'Login', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (10, 7, 10, N'Register', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (11, 4, 11, N'Administration', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (12, 8, 12, N'Site Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (13, 9, 13, N'User Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (14, 10, 14, N'Module Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (15, 11, 15, N'Theme Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (16, 12, 16, N'Id consectetur', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (17, 13, 17, N'Lorem ipsum', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (18, 14, 18, N'Login', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (19, 15, 19, N'Register', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (20, 16, 20, N'Role Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (21, 17, 21, N'User Profile', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT [dbo].[PageModule] OFF
|
|
||||||
GO
|
|
||||||
|
|
||||||
SET IDENTITY_INSERT [dbo].[HtmlText] ON
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (1, 3, N'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <br /><br /><a href="http://localhost:44357/site2/">Go To Site2</a>', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (2, 5, N'Enim sed faucibus turpis in eu mi bibendum neque egestas. Quis hendrerit dolor magna eget est lorem. Dui faucibus in ornare quam viverra orci sagittis. Integer eget aliquet nibh praesent tristique magna sit. Nunc aliquet bibendum enim facilisis gravida neque convallis a cras. Tortor id aliquet lectus proin. Diam volutpat commodo sed egestas egestas fringilla. Posuere sollicitudin aliquam ultrices sagittis orci. Viverra mauris in aliquam sem fringilla ut morbi tincidunt. Eget gravida cum sociis natoque penatibus et. Sagittis orci a scelerisque purus semper. Eget velit aliquet sagittis id consectetur purus. Volutpat blandit aliquam etiam erat. Et tortor consequat id porta nibh venenatis cras. Volutpat odio facilisis mauris sit amet. Varius duis at consectetur lorem.', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (3, 6, N'Id consectetur purus ut faucibus pulvinar elementum integer. Bibendum neque egestas congue quisque egestas diam in arcu. Eget nullam non nisi est sit amet facilisis. Sit amet consectetur adipiscing elit pellentesque. Id aliquet risus feugiat in. Enim blandit volutpat maecenas volutpat blandit aliquam etiam erat. Commodo odio aenean sed adipiscing. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Aliquet enim tortor at auctor urna nunc. Nulla pellentesque dignissim enim sit amet. Suscipit adipiscing bibendum est ultricies integer quis auctor. Lacinia quis vel eros donec ac odio tempor. Aliquam vestibulum morbi blandit cursus risus at.', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (4, 7, N'Ornare arcu dui vivamus arcu felis bibendum ut. Tortor vitae purus faucibus ornare. Lectus sit amet est placerat in egestas erat imperdiet sed. Aliquam sem et tortor consequat id. Fermentum iaculis eu non diam phasellus vestibulum. Ultricies integer quis auctor elit sed. Fermentum odio eu feugiat pretium nibh ipsum. Ut consequat semper viverra nam libero. Blandit aliquam etiam erat velit scelerisque in dictum non consectetur. At risus viverra adipiscing at in tellus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue. At varius vel pharetra vel turpis nunc eget lorem dolor. Morbi non arcu risus quis varius. Turpis massa sed elementum tempus egestas.', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (5, 16, N'Id consectetur purus ut faucibus pulvinar elementum integer. Bibendum neque egestas congue quisque egestas diam in arcu. Eget nullam non nisi est sit amet facilisis. Sit amet consectetur adipiscing elit pellentesque. Id aliquet risus feugiat in. Enim blandit volutpat maecenas volutpat blandit aliquam etiam erat. Commodo odio aenean sed adipiscing. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Aliquet enim tortor at auctor urna nunc. Nulla pellentesque dignissim enim sit amet. Suscipit adipiscing bibendum est ultricies integer quis auctor. Lacinia quis vel eros donec ac odio tempor. Aliquam vestibulum morbi blandit cursus risus at. <br /><br /><a href="http://localhost:44357/">Go To Site1</a>', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (6, 17, N'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT [dbo].[HtmlText] OFF
|
|
||||||
GO
|
|
|
@ -35,6 +35,19 @@ CREATE TABLE [dbo].[Tenant](
|
||||||
)
|
)
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[ModuleDefinition](
|
||||||
|
[ModuleDefinitionId] [int] IDENTITY(1,1) 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_ModuleDefinition] PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[ModuleDefinitionId] ASC
|
||||||
|
)
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -64,9 +77,5 @@ GO
|
||||||
INSERT [dbo].[Alias] ([AliasId], [Name], [TenantId], [SiteId], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
INSERT [dbo].[Alias] ([AliasId], [Name], [TenantId], [SiteId], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||||
VALUES (1, N'{Alias}', 1, 1, '', getdate(), '', getdate())
|
VALUES (1, N'{Alias}', 1, 1, '', getdate(), '', getdate())
|
||||||
GO
|
GO
|
||||||
INSERT [dbo].[Alias] ([AliasId], [Name], [TenantId], [SiteId], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
|
||||||
VALUES (2, N'{Alias}/site2', 1, 2, '', getdate(), '', getdate())
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT [dbo].[Alias] OFF
|
SET IDENTITY_INSERT [dbo].[Alias] OFF
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ using System.Threading.Tasks;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Oqtane.Security
|
namespace Oqtane.Security
|
||||||
{
|
{
|
||||||
|
@ -31,17 +33,15 @@ namespace Oqtane.Security
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
id.AddClaim(new Claim(ClaimTypes.PrimarySid, user.UserId.ToString()));
|
id.AddClaim(new Claim(ClaimTypes.PrimarySid, user.UserId.ToString()));
|
||||||
if (user.IsHost) // host users are part of every site by default
|
|
||||||
{
|
|
||||||
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, Constants.HostRole));
|
|
||||||
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, Constants.AdminRole));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Alias alias = Tenants.GetAlias();
|
Alias alias = Tenants.GetAlias();
|
||||||
foreach (UserRole userrole in UserRoles.GetUserRoles(user.UserId, alias.SiteId))
|
List<UserRole> userroles = UserRoles.GetUserRoles(user.UserId, alias.SiteId).ToList();
|
||||||
|
foreach (UserRole userrole in userroles)
|
||||||
{
|
{
|
||||||
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, userrole.Role.Name));
|
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, userrole.Role.Name));
|
||||||
|
// host users are admins of every site
|
||||||
|
if (userrole.Role.Name == Constants.HostRole && userroles.Where(item => item.Role.Name == Constants.AdminRole).FirstOrDefault() == null)
|
||||||
|
{
|
||||||
|
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, Constants.AdminRole));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Oqtane.Infrastructure;
|
||||||
|
|
||||||
namespace Oqtane.Server
|
namespace Oqtane.Server
|
||||||
{
|
{
|
||||||
|
@ -144,6 +145,33 @@ namespace Oqtane.Server
|
||||||
// register custom claims principal factory for role claims
|
// register custom claims principal factory for role claims
|
||||||
services.AddTransient<IUserClaimsPrincipalFactory<IdentityUser>, ClaimsPrincipalFactory<IdentityUser>>();
|
services.AddTransient<IUserClaimsPrincipalFactory<IdentityUser>, ClaimsPrincipalFactory<IdentityUser>>();
|
||||||
|
|
||||||
|
// register singleton scoped core services
|
||||||
|
services.AddSingleton<IConfigurationRoot>(Configuration);
|
||||||
|
services.AddSingleton<IInstallation, Installation>();
|
||||||
|
|
||||||
|
// install any modules or themes
|
||||||
|
ServiceProvider sp = services.BuildServiceProvider();
|
||||||
|
var Installation = sp.GetRequiredService<IInstallation>();
|
||||||
|
Installation.Install("Modules,Themes");
|
||||||
|
|
||||||
|
// register transient scoped core services
|
||||||
|
services.AddTransient<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
||||||
|
services.AddTransient<IThemeRepository, ThemeRepository>();
|
||||||
|
services.AddTransient<IUserPermissions, UserPermissions>();
|
||||||
|
services.AddTransient<ITenantResolver, TenantResolver>();
|
||||||
|
services.AddTransient<IAliasRepository, AliasRepository>();
|
||||||
|
services.AddTransient<ITenantRepository, TenantRepository>();
|
||||||
|
services.AddTransient<ISiteRepository, SiteRepository>();
|
||||||
|
services.AddTransient<IPageRepository, PageRepository>();
|
||||||
|
services.AddTransient<IModuleRepository, ModuleRepository>();
|
||||||
|
services.AddTransient<IPageModuleRepository, PageModuleRepository>();
|
||||||
|
services.AddTransient<IUserRepository, UserRepository>();
|
||||||
|
services.AddTransient<IProfileRepository, ProfileRepository>();
|
||||||
|
services.AddTransient<IRoleRepository, RoleRepository>();
|
||||||
|
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
||||||
|
services.AddTransient<IPermissionRepository, PermissionRepository>();
|
||||||
|
services.AddTransient<ISettingRepository, SettingRepository>();
|
||||||
|
|
||||||
// get list of loaded assemblies
|
// get list of loaded assemblies
|
||||||
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
@ -177,28 +205,6 @@ namespace Oqtane.Server
|
||||||
|
|
||||||
services.AddMvc().AddModuleAssemblies(moduleassemblies).AddNewtonsoftJson();
|
services.AddMvc().AddModuleAssemblies(moduleassemblies).AddNewtonsoftJson();
|
||||||
|
|
||||||
// register singleton scoped core services
|
|
||||||
services.AddSingleton<IConfigurationRoot>(Configuration);
|
|
||||||
services.AddSingleton<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
|
||||||
services.AddSingleton<IThemeRepository, ThemeRepository>();
|
|
||||||
|
|
||||||
// register transient scoped core services
|
|
||||||
services.AddTransient<IUserPermissions, UserPermissions>();
|
|
||||||
services.AddTransient<ITenantResolver, TenantResolver>();
|
|
||||||
services.AddTransient<IAliasRepository, AliasRepository>();
|
|
||||||
services.AddTransient<ITenantRepository, TenantRepository>();
|
|
||||||
services.AddTransient<ISiteRepository, SiteRepository>();
|
|
||||||
services.AddTransient<IPageRepository, PageRepository>();
|
|
||||||
services.AddTransient<IModuleRepository, ModuleRepository>();
|
|
||||||
services.AddTransient<IPageModuleRepository, PageModuleRepository>();
|
|
||||||
services.AddTransient<IUserRepository, UserRepository>();
|
|
||||||
services.AddTransient<IProfileRepository, ProfileRepository>();
|
|
||||||
services.AddTransient<ISiteUserRepository, SiteUserRepository>();
|
|
||||||
services.AddTransient<IRoleRepository, RoleRepository>();
|
|
||||||
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
|
||||||
services.AddTransient<IPermissionRepository, PermissionRepository>();
|
|
||||||
services.AddTransient<ISettingRepository, SettingRepository>();
|
|
||||||
|
|
||||||
// dynamically register module services, contexts, and repository classes
|
// dynamically register module services, contexts, and repository classes
|
||||||
assemblies = AppDomain.CurrentDomain.GetAssemblies()
|
assemblies = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
.Where(item => item.FullName.StartsWith("Oqtane.") || item.FullName.Contains(".Module.")).ToArray();
|
.Where(item => item.FullName.StartsWith("Oqtane.") || item.FullName.Contains(".Module.")).ToArray();
|
||||||
|
@ -358,10 +364,10 @@ namespace Oqtane.Server
|
||||||
|
|
||||||
// register singleton scoped core services
|
// register singleton scoped core services
|
||||||
services.AddSingleton<IConfigurationRoot>(Configuration);
|
services.AddSingleton<IConfigurationRoot>(Configuration);
|
||||||
services.AddSingleton<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
|
||||||
services.AddSingleton<IThemeRepository, ThemeRepository>();
|
|
||||||
|
|
||||||
// register transient scoped core services
|
// register transient scoped core services
|
||||||
|
services.AddTransient<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
||||||
|
services.AddTransient<IThemeRepository, ThemeRepository>();
|
||||||
services.AddTransient<IUserPermissions, UserPermissions>();
|
services.AddTransient<IUserPermissions, UserPermissions>();
|
||||||
services.AddTransient<ITenantResolver, TenantResolver>();
|
services.AddTransient<ITenantResolver, TenantResolver>();
|
||||||
services.AddTransient<IAliasRepository, AliasRepository>();
|
services.AddTransient<IAliasRepository, AliasRepository>();
|
||||||
|
@ -371,7 +377,6 @@ namespace Oqtane.Server
|
||||||
services.AddTransient<IModuleRepository, ModuleRepository>();
|
services.AddTransient<IModuleRepository, ModuleRepository>();
|
||||||
services.AddTransient<IPageModuleRepository, PageModuleRepository>();
|
services.AddTransient<IPageModuleRepository, PageModuleRepository>();
|
||||||
services.AddTransient<IUserRepository, UserRepository>();
|
services.AddTransient<IUserRepository, UserRepository>();
|
||||||
services.AddTransient<ISiteUserRepository, SiteUserRepository>();
|
|
||||||
services.AddTransient<IRoleRepository, RoleRepository>();
|
services.AddTransient<IRoleRepository, RoleRepository>();
|
||||||
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
||||||
services.AddTransient<IPermissionRepository, PermissionRepository>();
|
services.AddTransient<IPermissionRepository, PermissionRepository>();
|
||||||
|
|
|
@ -1,19 +1,47 @@
|
||||||
namespace Oqtane.Models
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Oqtane.Models
|
||||||
{
|
{
|
||||||
public class ModuleDefinition
|
public class ModuleDefinition : IAuditable
|
||||||
{
|
{
|
||||||
|
public int ModuleDefinitionId { get; set; }
|
||||||
public string ModuleDefinitionName { get; set; }
|
public string ModuleDefinitionName { get; set; }
|
||||||
|
|
||||||
|
public string CreatedBy { get; set; }
|
||||||
|
public DateTime CreatedOn { get; set; }
|
||||||
|
public string ModifiedBy { get; set; }
|
||||||
|
public DateTime ModifiedOn { get; set; }
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string Categories { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string Owner { get; set; }
|
public string Owner { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string Contact { get; set; }
|
public string Contact { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string License { get; set; }
|
public string License { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string Dependencies { get; set; }
|
public string Dependencies { get; set; }
|
||||||
public string Permissions { get; set; }
|
[NotMapped]
|
||||||
|
public string PermissionNames { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string ControlTypeTemplate { get; set; }
|
public string ControlTypeTemplate { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string ControlTypeRoutes { get; set; }
|
public string ControlTypeRoutes { get; set; }
|
||||||
|
[NotMapped]
|
||||||
public string AssemblyName { get; set; }
|
public string AssemblyName { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public int SiteId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string Permissions { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
Oqtane.Shared/Models/PageTemplate.cs
Normal file
18
Oqtane.Shared/Models/PageTemplate.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Oqtane.Models
|
||||||
|
{
|
||||||
|
public class PageTemplate
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Parent { get; set; }
|
||||||
|
public string Path { get; set; }
|
||||||
|
public int Order { get; set; }
|
||||||
|
public string Icon { get; set; }
|
||||||
|
public bool IsNavigation { get; set; }
|
||||||
|
public string PagePermissions { get; set; }
|
||||||
|
public string ModuleDefinitionName { get; set; }
|
||||||
|
public string ModulePermissions { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Pane { get; set; }
|
||||||
|
public string ContainerType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ namespace Oqtane.Models
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Logo { get; set; }
|
public string Logo { get; set; }
|
||||||
public string DefaultThemeType { get; set; }
|
public string DefaultThemeType { get; set; }
|
||||||
|
public string DefaultLayoutType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public string CreatedBy { get; set; }
|
public string CreatedBy { get; set; }
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Oqtane.Models
|
|
||||||
{
|
|
||||||
public class SiteUser : IAuditable
|
|
||||||
{
|
|
||||||
public int SiteUserId { get; set; }
|
|
||||||
public int SiteId { get; set; }
|
|
||||||
public int UserId { get; set; }
|
|
||||||
|
|
||||||
public string CreatedBy { get; set; }
|
|
||||||
public DateTime CreatedOn { get; set; }
|
|
||||||
public string ModifiedBy { get; set; }
|
|
||||||
public DateTime ModifiedOn { get; set; }
|
|
||||||
|
|
||||||
public User User { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,7 +9,7 @@ namespace Oqtane.Models
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; set; }
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
public bool IsHost { get; set; }
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int SiteId { get; set; }
|
public int SiteId { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
|
|
|
@ -16,5 +16,7 @@ namespace Oqtane.Models
|
||||||
public DateTime ModifiedOn { get; set; }
|
public DateTime ModifiedOn { get; set; }
|
||||||
|
|
||||||
public Role Role { get; set; }
|
public Role Role { get; set; }
|
||||||
|
|
||||||
|
public User User { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
public const string AllUsersRole = "All Users";
|
public const string AllUsersRole = "All Users";
|
||||||
public const string HostRole = "Host Users";
|
public const string HostRole = "Host Users";
|
||||||
public const string AdminRole = "Administrators";
|
public const string AdminRole = "Administrators";
|
||||||
|
public const string RegisteredRole = "Registered Users";
|
||||||
|
|
||||||
public const int ReloadApplication = 3;
|
public const int ReloadApplication = 3;
|
||||||
public const int ReloadSite = 2;
|
public const int ReloadSite = 2;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user