Merge pull request #1465 from sbwalker/dev

added IsClickable Page property #1092, improve validation in Role Management, display database information in SQL Management, improve HttpClient header support
This commit is contained in:
Shaun Walker
2021-06-10 20:06:41 -04:00
committed by GitHub
14 changed files with 483 additions and 289 deletions

View File

@ -9,7 +9,8 @@ namespace Oqtane.Controllers
public class ModuleControllerBase : Controller
{
protected readonly ILogManager _logger;
// querystring parameters for policy authorization and validation
// parameters for policy authorization and validation
protected Dictionary<string, int> _authEntityId = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
protected int _entityId = -1; // legacy support
@ -17,7 +18,7 @@ namespace Oqtane.Controllers
{
_logger = logger;
// populate policy authorization dictionary from querystring and headers
// populate policy authorization dictionary from querystring
int value;
foreach (var param in accessor.HttpContext.Request.Query)
{
@ -25,12 +26,16 @@ namespace Oqtane.Controllers
{
_authEntityId.Add(param.Key.Substring(4, param.Key.Length - 6), value);
}
}
foreach (var param in accessor.HttpContext.Request.Headers)
}
// if policy authorization dictionary is empty populate from headers
if (_authEntityId.Count == 0)
{
if (param.Key.StartsWith("auth") && param.Key.EndsWith("id") && int.TryParse(param.Value, out value))
foreach (var param in accessor.HttpContext.Request.Headers)
{
_authEntityId.Add(param.Key.Substring(4, param.Key.Length - 6), value);
if (param.Key.StartsWith("auth") && param.Key.EndsWith("id") && int.TryParse(param.Value, out value))
{
_authEntityId.Add(param.Key.Substring(4, param.Key.Length - 6), value);
}
}
}

View File

@ -52,7 +52,7 @@ namespace Oqtane.Controllers
}
catch (Exception ex)
{
_logger.Log(LogLevel.Error, this, LogFunction.Other, "Sql Query {Query} Executed on Tenant {TenantId} Results In An Error {Error}", sqlquery.Query, sqlquery.TenantId, ex.Message);
_logger.Log(LogLevel.Error, this, LogFunction.Other, "Sql Query {Query} Executed on Tenant {TenantId} Resulted In An Error {Error}", sqlquery.Query, sqlquery.TenantId, ex.Message);
}
sqlquery.Results = results;
return sqlquery;

View File

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Databases.Interfaces;
using Oqtane.Migrations.EntityBuilders;
using Oqtane.Repository;
namespace Oqtane.Migrations.Tenant
{
[DbContext(typeof(TenantDBContext))]
[Migration("Tenant.02.01.01.00")]
public class AddPageIsClickable : MultiDatabaseMigration
{
public AddPageIsClickable(IDatabase database) : base(database)
{
}
protected override void Up(MigrationBuilder migrationBuilder)
{
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
pageEntityBuilder.AddBooleanColumn("IsClickable");
pageEntityBuilder.UpdateColumn("IsClickable", "true");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
pageEntityBuilder.DropColumn("IsClickable");
}
}
}

View File

@ -768,7 +768,8 @@ namespace Oqtane.Repository
Icon = pagetemplate.Icon,
Permissions = pagetemplate.PagePermissions,
IsPersonalizable = pagetemplate.IsPersonalizable,
UserId = null
UserId = null,
IsClickable = true
};
page = _pageRepository.AddPage(page);