fix Swashbuckle reference, fix folder issue in installationmanager, disabled blazor linking on build

This commit is contained in:
Shaun Walker 2019-09-26 18:02:47 -04:00
parent b2c44f970e
commit 00d8f17254
8 changed files with 274 additions and 267 deletions

View File

@ -47,7 +47,7 @@
<option value="<">Before</option> <option value="<">Before</option>
<option value=">">After</option> <option value=">">After</option>
} }
<option value=">>" selected>At End</option> <option value=">>">At End</option>
</select> </select>
@if (children != null && children.Count > 0 && (insert == "<" || insert == ">")) @if (children != null && children.Count > 0 && (insert == "<" || insert == ">"))
{ {
@ -74,12 +74,12 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Edit Mode? </label> <label for="Name" class="control-label">Default Mode? </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@editmode"> <select class="form-control" @bind="@mode">
<option value="True">Yes</option> <option value="view">View Mode</option>
<option value="False">No</option> <option value="edit">Edit Mode</option>
</select> </select>
</td> </td>
</tr> </tr>
@ -145,7 +145,7 @@
List<Page> children; List<Page> children;
int childid = -1; int childid = -1;
string isnavigation = "True"; string isnavigation = "True";
string editmode = "False"; string mode = "view";
string themetype = ""; string themetype = "";
string layouttype = ""; string layouttype = "";
string icon = ""; string icon = "";
@ -250,7 +250,7 @@
break; break;
} }
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
page.EditMode = (editmode == null ? true : Boolean.Parse(editmode)); page.EditMode = (mode == "edit" ? true : false);
page.ThemeType = themetype; page.ThemeType = themetype;
page.LayoutType = (layouttype == null ? "" : layouttype); page.LayoutType = (layouttype == null ? "" : layouttype);
page.Icon = (icon == null ? "" : icon); page.Icon = (icon == null ? "" : icon);

View File

@ -4,104 +4,104 @@
@inject IPageService PageService @inject IPageService PageService
@inject IThemeService ThemeService @inject IThemeService ThemeService
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Name: </label> <label for="Name" class="control-label">Name: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@name" readonly /> <input class="form-control" @bind="@name" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Path: </label> <label for="Name" class="control-label">Path: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@path" readonly /> <input class="form-control" @bind="@path" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Parent: </label> <label for="Name" class="control-label">Parent: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@parentid" readonly> <select class="form-control" @bind="@parentid" readonly>
<option value="">&lt;Select Parent&gt;</option> <option value="">&lt;Select Parent&gt;</option>
@foreach (Page p in PageState.Pages) @foreach (Page p in PageState.Pages)
{ {
<option value="@p.PageId">@p.Name</option> <option value="@p.PageId">@p.Name</option>
} }
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Navigation? </label> <label for="Name" class="control-label">Navigation? </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@isnavigation" readonly> <select class="form-control" @bind="@isnavigation" readonly>
<option value="True">Yes</option> <option value="True">Yes</option>
<option value="False">No</option> <option value="False">No</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Edit Mode? </label> <label for="Name" class="control-label">Default Mode? </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@editmode" readonly> <select class="form-control" @bind="@mode">
<option value="True">Yes</option> <option value="view">View Mode</option>
<option value="False">No</option> <option value="edit">Edit Mode</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Theme: </label> <label for="Name" class="control-label">Theme: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@themetype" readonly> <select class="form-control" @bind="@themetype" readonly>
<option value="">&lt;Select Theme&gt;</option> <option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes) @foreach (KeyValuePair<string, string> item in themes)
{ {
<option value="@item.Key">@item.Value</option> <option value="@item.Key">@item.Value</option>
} }
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Layout: </label> <label for="Name" class="control-label">Layout: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@layouttype" readonly> <select class="form-control" @bind="@layouttype" readonly>
<option value="">&lt;Select Layout&gt;</option> <option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in panelayouts) @foreach (KeyValuePair<string, string> panelayout in panelayouts)
{ {
<option value="@panelayout.Key">@panelayout.Value</option> <option value="@panelayout.Key">@panelayout.Value</option>
} }
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Icon: </label> <label for="Name" class="control-label">Icon: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@icon" readonly /> <input class="form-control" @bind="@icon" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Permissions: </label> <label for="Name" class="control-label">Permissions: </label>
</td> </td>
<td> <td>
<PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" /> <PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" />
</td> </td>
</tr> </tr>
</table> </table>
<button type="button" class="btn btn-danger" @onclick="DeletePage">Delete</button> <button type="button" class="btn btn-danger" @onclick="DeletePage">Delete</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br /> <br />
@ -119,7 +119,7 @@
string path; string path;
string parentid = ""; string parentid = "";
string isnavigation; string isnavigation;
string editmode; string mode;
string themetype; string themetype;
string layouttype; string layouttype;
string icon; string icon;
@ -145,7 +145,7 @@
name = page.Name; name = page.Name;
path = page.Path; path = page.Path;
isnavigation = page.IsNavigation.ToString(); isnavigation = page.IsNavigation.ToString();
editmode = page.EditMode.ToString(); mode = (page.EditMode) ? "edit" : "view";
themetype = page.ThemeType; themetype = page.ThemeType;
layouttype = page.LayoutType; layouttype = page.LayoutType;
icon = page.Icon; icon = page.Icon;

View File

@ -4,141 +4,141 @@
@inject IPageService PageService @inject IPageService PageService
@inject IThemeService ThemeService @inject IThemeService ThemeService
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Name: </label> <label for="Name" class="control-label">Name: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@name" /> <input class="form-control" @bind="@name" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Path: </label> <label for="Name" class="control-label">Path: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@path" /> <input class="form-control" @bind="@path" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Parent: </label> <label for="Name" class="control-label">Parent: </label>
</td> </td>
<td> <td>
<select class="form-control" @onchange="(e => ParentChanged(e))"> <select class="form-control" @onchange="(e => ParentChanged(e))">
<option value="-1">&lt;Site Root&gt;</option> <option value="-1">&lt;Site Root&gt;</option>
@foreach (Page page in pages) @foreach (Page page in pages)
{
if (page.PageId.ToString() == parentid)
{ {
<option value="@(page.PageId)" selected>@(new string('-', page.Level * 2))@(page.Name)</option> if (page.PageId.ToString() == parentid)
} {
else <option value="@(page.PageId)" selected>@(new string('-', page.Level * 2))@(page.Name)</option>
{ }
<option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option> else
} {
} <option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
</select> }
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Move : </label>
</td>
<td>
<select class="form-control" @bind="@insert">
@if (parentid == currentparentid)
{
<option value="">&lt;Maintain Current Location&gt;</option>
}
<option value="<<">To Beginning</option>
@if (children != null && children.Count > 0)
{
<option value="<">Before</option>
<option value=">">After</option>
}
<option value=">>" selected>To End</option>
</select>
@if (children != null && children.Count > 0 && (insert == "<" || insert == ">"))
{
<select class="form-control" @bind="@childid">
<option value="-1">&lt;Select Page&gt;</option>
@foreach (Page page in children)
{
<option value="@(page.PageId)">@(page.Name)</option>
} }
</select> </select>
} </td>
</td> </tr>
</tr> <tr>
<tr> <td>
<td> <label for="Name" class="control-label">Move : </label>
<label for="Name" class="control-label">Navigation? </label> </td>
</td> <td>
<td> <select class="form-control" @bind="@insert">
<select class="form-control" @bind="@isnavigation"> @if (parentid == currentparentid)
<option value="True">Yes</option> {
<option value="False">No</option> <option value="=">&lt;Maintain Current Location&gt;</option>
</select> }
</td> <option value="<<">To Beginning</option>
</tr> @if (children != null && children.Count > 0)
<tr> {
<td> <option value="<">Before</option>
<label for="Name" class="control-label">Edit Mode? </label> <option value=">">After</option>
</td> }
<td> <option value=">>">To End</option>
<select class="form-control" @bind="@editmode"> </select>
<option value="True">Yes</option> @if (children != null && children.Count > 0 && (insert == "<" || insert == ">"))
<option value="False">No</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Theme: </label>
</td>
<td>
<select class="form-control" @bind="@themetype">
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes)
{ {
<option value="@item.Key">@item.Value</option> <select class="form-control" @bind="@childid">
<option value="-1">&lt;Select Page&gt;</option>
@foreach (Page page in children)
{
<option value="@(page.PageId)">@(page.Name)</option>
}
</select>
} }
</select> </td>
</td> </tr>
</tr> <tr>
<tr> <td>
<td> <label for="Name" class="control-label">Navigation? </label>
<label for="Name" class="control-label">Layout: </label> </td>
</td> <td>
<td> <select class="form-control" @bind="@isnavigation">
<select class="form-control" @bind="@layouttype"> <option value="True">Yes</option>
<option value="">&lt;Select Layout&gt;</option> <option value="False">No</option>
@foreach (KeyValuePair<string, string> panelayout in panelayouts) </select>
{ </td>
<option value="@panelayout.Key">@panelayout.Value</option> </tr>
} <tr>
</select> <td>
</td> <label for="Name" class="control-label">Default Mode? </label>
</tr> </td>
<tr> <td>
<td> <select class="form-control" @bind="@mode">
<label for="Name" class="control-label">Icon: </label> <option value="view">View Mode</option>
</td> <option value="edit">Edit Mode</option>
<td> </select>
<input class="form-control" @bind="@icon" /> </td>
</td> </tr>
</tr> <tr>
<tr> <td>
<td> <label for="Name" class="control-label">Theme: </label>
<label for="Name" class="control-label">Permissions: </label> </td>
</td> <td>
<td> <select class="form-control" @bind="@themetype">
<PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" /> <option value="">&lt;Select Theme&gt;</option>
</td> @foreach (KeyValuePair<string, string> item in themes)
</tr> {
</table> <option value="@item.Key">@item.Value</option>
}
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Layout: </label>
</td>
<td>
<select class="form-control" @bind="@layouttype">
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
{
<option value="@panelayout.Key">@panelayout.Value</option>
}
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Icon: </label>
</td>
<td>
<input class="form-control" @bind="@icon" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Permissions: </label>
</td>
<td>
<PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" />
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button> <button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br /> <br />
@ -157,11 +157,11 @@
string path; string path;
string currentparentid; string currentparentid;
string parentid; string parentid;
string insert = ""; string insert = "=";
List<Page> children; List<Page> children;
int childid = -1; int childid = -1;
string isnavigation; string isnavigation;
string editmode; string mode;
string themetype; string themetype;
string layouttype; string layouttype;
string icon; string icon;
@ -203,7 +203,7 @@
} }
currentparentid = parentid; currentparentid = parentid;
isnavigation = page.IsNavigation.ToString(); isnavigation = page.IsNavigation.ToString();
editmode = page.EditMode.ToString(); mode = (page.EditMode) ? "edit" : "view";
themetype = page.ThemeType; themetype = page.ThemeType;
layouttype = page.LayoutType; layouttype = page.LayoutType;
icon = page.Icon; icon = page.Icon;
@ -235,7 +235,7 @@
} }
if (parentid == currentparentid) if (parentid == currentparentid)
{ {
insert = ""; insert = "=";
} }
else else
{ {
@ -283,7 +283,7 @@
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path); page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path);
} }
} }
if (insert != "") if (insert != "=")
{ {
Page child; Page child;
switch (insert) switch (insert)
@ -305,7 +305,7 @@
} }
} }
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
page.EditMode = (editmode == null ? true : Boolean.Parse(editmode)); page.EditMode = (mode == "edit" ? true : false);
page.ThemeType = themetype; page.ThemeType = themetype;
page.LayoutType = (layouttype == null ? "" : layouttype); page.LayoutType = (layouttype == null ? "" : layouttype);
page.Icon = (icon == null ? "" : icon); page.Icon = (icon == null ? "" : icon);

View File

@ -3,6 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<BlazorLinkOnBuild>false</BlazorLinkOnBuild>
<RestoreAdditionalProjectSources> <RestoreAdditionalProjectSources>
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json; https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;

View File

@ -28,23 +28,21 @@ window.interop = {
return ""; return "";
} }
}, },
addCSS: function (fileName) { addCSS: function (id, url) {
var head = document.head; if (document.getElementById(id) === null) {
var link = document.createElement("link"); var link = document.createElement("link");
link.id = id;
link.type = "text/css"; link.type = "text/css";
link.rel = "stylesheet"; link.rel = "stylesheet";
link.href = fileName; link.href = url;
document.head.appendChild(link);
head.appendChild(link); }
}, },
removeCSS: function (filePattern) { removeCSS: function (pattern) {
var head = document.head;
var links = document.getElementsByTagName("link"); var links = document.getElementsByTagName("link");
for (var i = 0; i < links.length; i++) { for (var i = 0; i < links.length; i++) {
var link = links[i]; if (links[i].id.includes(pattern)) {
if (link.rel === 'stylesheet' && link.href.includes(filePattern)) { document.head.removeChild(links[i]);
head.removeChild(link);
} }
} }
}, },

View File

@ -57,7 +57,12 @@ namespace Oqtane.Infrastructure
case ".svg": case ".svg":
case ".js": case ".js":
case ".css": case ".css":
entry.ExtractToFile(folder + "\\" + entry.FullName.Replace("wwwroot", name).Replace("/","\\"), true); filename = folder + "\\" + entry.FullName.Replace("wwwroot", name).Replace("/", "\\");
if (!Directory.Exists(Path.GetDirectoryName(filename)))
{
Directory.CreateDirectory(Path.GetDirectoryName(filename));
}
entry.ExtractToFile(filename, true);
break; break;
} }
} }

View File

@ -276,6 +276,16 @@ namespace Oqtane.Server
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
// register authorization services
services.AddAuthorizationCore(options =>
{
options.AddPolicy("ViewPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "View")));
options.AddPolicy("EditPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "Edit")));
options.AddPolicy("ViewModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "View")));
options.AddPolicy("EditModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "Edit")));
});
services.AddScoped<IAuthorizationHandler, PermissionHandler>();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddDbContext<MasterDBContext>(options => services.AddDbContext<MasterDBContext>(options =>
@ -307,15 +317,8 @@ namespace Oqtane.Server
options.User.RequireUniqueEmail = false; options.User.RequireUniqueEmail = false;
}); });
// register authorization services services.AddAuthentication(IdentityConstants.ApplicationScheme)
services.AddAuthorizationCore(options => .AddCookie(IdentityConstants.ApplicationScheme);
{
options.AddPolicy("ViewPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "View")));
options.AddPolicy("EditPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "Edit")));
options.AddPolicy("ViewModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "View")));
options.AddPolicy("EditModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "Edit")));
});
services.AddScoped<IAuthorizationHandler, PermissionHandler>();
services.ConfigureApplicationCookie(options => services.ConfigureApplicationCookie(options =>
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB