authorization changes

This commit is contained in:
Shaun Walker
2020-02-17 19:48:26 -05:00
parent 2fa7f852d5
commit 066c616eca
44 changed files with 880 additions and 529 deletions

View File

@ -8,56 +8,65 @@
}
else
{
<div class="form-group">
<label>Level: </label>
<select class="form-control" @onchange="(e => LevelChanged(e))">
<option value="-">&lt;All Levels&gt;</option>
<option value="Trace">Trace</option>
<option value="Debug">Debug</option>
<option value="Information">Information</option>
<option value="Warning">Warning</option>
<option value="Error">Error</option>
<option value="Critical">Critical</option>
</select>
<label>Function: </label>
<select class="form-control" @onchange="(e => FunctionChanged(e))">
<option value="-">&lt;All Functions&gt;</option>
<option value="Create">Create</option>
<option value="Read">Read</option>
<option value="Update">Update</option>
<option value="Delete">Delete</option>
<option value="Security">Security</option>
<option value="Other">Other</option>
</select>
<label>Rows: </label>
<select class="form-control" @onchange="(e => RowsChanged(e))">
<option value="10">10</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
<table class="table table-borderless">
<tr>
<td>
<label>Level: </label>
<select class="form-control" @onchange="(e => LevelChanged(e))">
<option value="-">&lt;All Levels&gt;</option>
<option value="Trace">Trace</option>
<option value="Debug">Debug</option>
<option value="Information">Information</option>
<option value="Warning">Warning</option>
<option value="Error">Error</option>
<option value="Critical">Critical</option>
</select>
</td>
<td>
<label>Function: </label>
<select class="form-control" @onchange="(e => FunctionChanged(e))">
<option value="-">&lt;All Functions&gt;</option>
<option value="Create">Create</option>
<option value="Read">Read</option>
<option value="Update">Update</option>
<option value="Delete">Delete</option>
<option value="Security">Security</option>
<option value="Other">Other</option>
</select>
</td>
<td>
<label>Rows: </label>
<select class="form-control" @onchange="(e => RowsChanged(e))">
<option value="10">10</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</td>
</tr>
</table>
@if (Logs.Any())
{
<Pager Items="@Logs">
<Header>
<th>&nbsp;</th>
<th>Date</th>
<th>Level</th>
<th>Feature</th>
<th>Function</th>
</Header>
<Row>
<td class="@GetClass(context.Function)"><ActionLink Action="Detail" Parameters="@($"id=" + context.LogId.ToString())" /></td>
<td class="@GetClass(context.Function)">@context.LogDate</td>
<td class="@GetClass(context.Function)">@context.Level</td>
<td class="@GetClass(context.Function)">@context.Feature</td>
<td class="@GetClass(context.Function)">@context.Function</td>
</Row>
</Pager>
<Pager Items="@Logs">
<Header>
<th>&nbsp;</th>
<th>Date</th>
<th>Level</th>
<th>Feature</th>
<th>Function</th>
</Header>
<Row>
<td class="@GetClass(context.Function)"><ActionLink Action="Detail" Parameters="@($"id=" + context.LogId.ToString())" /></td>
<td class="@GetClass(context.Function)">@context.LogDate</td>
<td class="@GetClass(context.Function)">@context.Level</td>
<td class="@GetClass(context.Function)">@context.Feature</td>
<td class="@GetClass(context.Function)">@context.Function</td>
</Row>
</Pager>
}
else
{
<p><em>No Logs Match The Criteria Specified</em></p>
<p><em>No Logs Match The Criteria Specified</em></p>
}
}
@ -159,4 +168,4 @@ else
}
return classname;
}
}
}

View File

@ -45,7 +45,7 @@
try
{
ModuleDefinitionId = Int32.Parse(PageState.QueryString["id"]);
ModuleDefinition moduledefinition = PageState.ModuleDefinitions.Where(item => item.ModuleDefinitionId == ModuleDefinitionId).FirstOrDefault();
ModuleDefinition moduledefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(ModuleDefinitionId, ModuleState.SiteId);
if (moduledefinition != null)
{
name = moduledefinition.Name;
@ -67,7 +67,7 @@
{
try
{
ModuleDefinition moduledefinition = PageState.ModuleDefinitions.Where(item => item.ModuleDefinitionId == ModuleDefinitionId).FirstOrDefault();
ModuleDefinition moduledefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(ModuleDefinitionId, ModuleState.SiteId);
moduledefinition.Permissions = permissiongrid.GetPermissions();
await ModuleDefinitionService.UpdateModuleDefinitionAsync(moduledefinition);
await logger.LogInformation("ModuleDefinition Saved {ModuleDefinition}", moduledefinition);

View File

@ -81,7 +81,7 @@
containers = ThemeService.GetContainerTypes(await ThemeService.GetThemesAsync());
containertype = ModuleState.ContainerType;
permissions = ModuleState.Permissions;
permissionnames = PageState.ModuleDefinitions.Find(item => item.ModuleDefinitionName == ModuleState.ModuleDefinitionName).PermissionNames;
permissionnames = ModuleState.ModuleDefinition.PermissionNames;
pageid = ModuleState.PageId.ToString();
DynamicComponent = builder =>

View File

@ -148,6 +148,7 @@
Dictionary<string, string> themes = new Dictionary<string, string>();
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
List<Theme> Themes;
List<Page> pages;
string name;
string path = "";
@ -169,13 +170,14 @@
{
try
{
Themes = await ThemeService.GetThemesAsync();
pages = PageState.Pages;
children = PageState.Pages.Where(item => item.ParentId == null).ToList();
themes = ThemeService.GetThemeTypes(PageState.Themes);
themes = ThemeService.GetThemeTypes(Themes);
themetype = PageState.Site.DefaultThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype);
layouttype = PageState.Site.DefaultLayoutType;
List<PermissionString> permissionstrings = new List<PermissionString>();
@ -219,7 +221,7 @@
themetype = (string)e.Value;
if (themetype != "")
{
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype);
}
else
{

View File

@ -169,6 +169,7 @@
Dictionary<string, string> themes = new Dictionary<string, string>();
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
List<Theme> Themes;
List<Page> pages;
int PageId;
string name;
@ -198,10 +199,11 @@
{
try
{
Themes = await ThemeService.GetThemesAsync();
pages = PageState.Pages;
children = PageState.Pages.Where(item => item.ParentId == null).ToList();
themes = ThemeService.GetThemeTypes(PageState.Themes);
themes = ThemeService.GetThemeTypes(Themes);
PageId = Int32.Parse(PageState.QueryString["id"]);
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
@ -226,7 +228,7 @@
ispersonalizable = page.IsPersonalizable.ToString();
mode = (page.EditMode) ? "edit" : "view";
themetype = page.ThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype);
layouttype = page.LayoutType;
icon = page.Icon;
permissions = page.Permissions;
@ -282,7 +284,7 @@
themetype = (string)e.Value;
if (themetype != "")
{
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype);
}
else
{

View File

@ -125,6 +125,7 @@ else
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
Dictionary<string, string> containers = new Dictionary<string, string>();
List<Theme> Themes;
List<Tenant> tenants;
string tenantid = "-1";
string name = "";
@ -139,10 +140,11 @@ else
protected override async Task OnInitializedAsync()
{
Themes = await ThemeService.GetThemesAsync();
tenants = await TenantService.GetTenantsAsync();
urls = PageState.Alias.Name;
themes = ThemeService.GetThemeTypes(PageState.Themes);
containers = ThemeService.GetContainerTypes(PageState.Themes);
themes = ThemeService.GetThemeTypes(Themes);
containers = ThemeService.GetContainerTypes(Themes);
username = Constants.HostUser;
}
@ -175,7 +177,7 @@ else
themetype = (string)e.Value;
if (themetype != "")
{
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype);
}
else
{

View File

@ -157,6 +157,7 @@
Dictionary<string, string> panelayouts;
Dictionary<string, string> containers;
List<Theme> Themes;
Alias Alias;
int siteid;
string name = "";
@ -186,14 +187,15 @@
{
try
{
Alias = PageState.Aliases.Where(item => item.AliasId == Int32.Parse(PageState.QueryString["id"])).FirstOrDefault();
Themes = await ThemeService.GetThemesAsync();
aliases = await AliasService.GetAliasesAsync();
Alias = aliases.Where(item => item.AliasId == int.Parse(PageState.QueryString["id"])).FirstOrDefault();
siteid = Alias.SiteId;
Site site = await SiteService.GetSiteAsync(siteid, Alias);
if (site != null)
{
name = site.Name;
aliases = PageState.Aliases.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList();
foreach (Alias alias in aliases)
foreach (Alias alias in aliases.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
{
urls += alias.Name + "\n";
}
@ -202,7 +204,7 @@
logofileid = site.LogoFileId.Value;
}
themetype = site.DefaultThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype);
layouttype = site.DefaultLayoutType;
containertype = site.DefaultContainerType;
@ -222,8 +224,8 @@
isdeleted = site.IsDeleted.ToString();
}
themes = ThemeService.GetThemeTypes(PageState.Themes);
containers = ThemeService.GetContainerTypes(PageState.Themes);
themes = ThemeService.GetThemeTypes(Themes);
containers = ThemeService.GetContainerTypes(Themes);
}
catch (Exception ex)
{
@ -239,7 +241,7 @@
themetype = (string)e.Value;
if (themetype != "")
{
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype);
}
else
{

View File

@ -32,13 +32,14 @@ else
List<Alias> sites;
string scheme;
protected override void OnParametersSet()
protected override async Task OnParametersSetAsync()
{
Uri uri = new Uri(NavigationManager.Uri);
scheme = uri.Scheme + "://";
List<Alias> aliases = await AliasService.GetAliasesAsync();
sites = new List<Alias>();
foreach (Alias alias in PageState.Aliases.OrderBy(item => item.Name))
foreach (Alias alias in aliases)
{
if (!sites.Exists(item => item.TenantId == alias.TenantId && item.SiteId == alias.SiteId))
{