commit
d2df5e921c
|
@ -1,8 +1,8 @@
|
||||||
@inject IInstallationService InstallationService
|
@inject IInstallationService InstallationService
|
||||||
|
|
||||||
@if (Initialized)
|
@if (_initialized)
|
||||||
{
|
{
|
||||||
@if (!Installed)
|
@if (!_installed)
|
||||||
{
|
{
|
||||||
<Installer />
|
<Installer />
|
||||||
}
|
}
|
||||||
|
@ -17,20 +17,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private bool Initialized = false;
|
private bool _initialized;
|
||||||
private bool Installed = false;
|
private bool _installed;
|
||||||
private PageState PageState { get; set; }
|
private PageState PageState { get; set; }
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
var response = await InstallationService.IsInstalled();
|
var response = await InstallationService.IsInstalled();
|
||||||
Installed = response.Success;
|
_installed = response.Success;
|
||||||
Initialized = true;
|
_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeState(PageState pagestate)
|
private void ChangeState(PageState pageState)
|
||||||
{
|
{
|
||||||
PageState = pagestate;
|
PageState = pageState;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
|
||||||
<div class="row">
|
<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, PermissionNames.View, p.Permissions))
|
||||||
{
|
{
|
||||||
string url = NavigateUrl(p.Path);
|
string url = NavigateUrl(p.Path);
|
||||||
<div class="col-md-2 mx-auto text-center">
|
<div class="col-md-2 mx-auto text-center">
|
||||||
|
@ -21,11 +21,11 @@
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
List<Page> pages;
|
List<Page> _pages;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
Page admin = PageState.Pages.Where(item => item.Path == "admin").FirstOrDefault();
|
Page admin = PageState.Pages.FirstOrDefault(item => item.Path == "admin");
|
||||||
pages = PageState.Pages.Where(item => item.ParentId == admin.PageId).ToList();
|
_pages = PageState.Pages.Where(item => item.ParentId == admin?.PageId).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
@inject IFileService FileService
|
@inject IFileService FileService
|
||||||
@inject IFolderService FolderService
|
@inject IFolderService FolderService
|
||||||
|
|
||||||
@if (folders != null)
|
@if (_folders != null)
|
||||||
{
|
{
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -27,10 +27,10 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Upload: </label>
|
<label class="control-label">Upload: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<FileManager UploadMultiple="true" ShowFiles="false" FolderId="@folderid.ToString()" />
|
<FileManager UploadMultiple="true" ShowFiles="false" FolderId="@_folderId.ToString()" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Url: </label>
|
<label class="control-label">Url: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@url" />
|
<input class="form-control" @bind="@url" />
|
||||||
|
@ -47,12 +47,12 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Folder: </label>
|
<label class="control-label">Folder: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@folderid">
|
<select class="form-control" @bind="@_folderId">
|
||||||
<option value="-1"><Select Folder></option>
|
<option value="-1"><Select Folder></option>
|
||||||
@foreach (Folder folder in folders)
|
@foreach (Folder folder in _folders)
|
||||||
{
|
{
|
||||||
<option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
<option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
||||||
}
|
}
|
||||||
|
@ -73,16 +73,16 @@
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
string url = "";
|
string url = "";
|
||||||
List<Folder> folders;
|
List<Folder> _folders;
|
||||||
int folderid = -1;
|
int _folderId = -1;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
folders = await FolderService.GetFoldersAsync(ModuleState.SiteId);
|
_folders = await FolderService.GetFoldersAsync(ModuleState.SiteId);
|
||||||
|
|
||||||
if (PageState.QueryString.ContainsKey("id"))
|
if (PageState.QueryString.ContainsKey("id"))
|
||||||
{
|
{
|
||||||
folderid = int.Parse(PageState.QueryString["id"]);
|
_folderId = int.Parse(PageState.QueryString["id"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +90,9 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (url != "" && folderid != -1)
|
if (url != "" && _folderId != -1)
|
||||||
{
|
{
|
||||||
await FileService.UploadFileAsync(url, folderid);
|
await FileService.UploadFileAsync(url, _folderId);
|
||||||
await logger.LogInformation("File Downloaded Successfully From Url {Url}", url);
|
await logger.LogInformation("File Downloaded Successfully From Url {Url}", url);
|
||||||
AddModuleMessage("File Downloaded Successfully From Url", MessageType.Success);
|
AddModuleMessage("File Downloaded Successfully From Url", MessageType.Success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,20 +3,20 @@
|
||||||
@inject IFolderService FolderService
|
@inject IFolderService FolderService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
@if (folders != null)
|
@if (_folders != null)
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Parent: </label>
|
<label class="control-label">Parent: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@parentid">
|
<select class="form-control" @bind="@_parentId">
|
||||||
@if (PageState.QueryString.ContainsKey("id"))
|
@if (PageState.QueryString.ContainsKey("id"))
|
||||||
{
|
{
|
||||||
<option value="-1"><No Parent></option>
|
<option value="-1"><No Parent></option>
|
||||||
}
|
}
|
||||||
@foreach (Folder folder in folders)
|
@foreach (Folder folder in _folders)
|
||||||
{
|
{
|
||||||
<option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
<option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
||||||
}
|
}
|
||||||
|
@ -25,27 +25,27 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label 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">Permissions: </label>
|
<label class="control-label">Permissions: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<PermissionGrid EntityName="Folder" PermissionNames="Browse,View,Edit" Permissions="@permissions" @ref="permissiongrid" />
|
<PermissionGrid EntityName="Folder" PermissionNames="Browse,View,Edit" Permissions="@_permissions" @ref="_permissionGrid" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@if (!issystem)
|
@if (!_isSystem)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-success" @onclick="SaveFolder">Save</button>
|
<button type="button" class="btn btn-success" @onclick="SaveFolder">Save</button>
|
||||||
}
|
}
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
@if (!issystem && PageState.QueryString.ContainsKey("id"))
|
@if (!_isSystem && PageState.QueryString.ContainsKey("id"))
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" @onclick="DeleteFolder">Delete</button>
|
<button type="button" class="btn btn-danger" @onclick="DeleteFolder">Delete</button>
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<br />
|
<br />
|
||||||
@if (PageState.QueryString.ContainsKey("id"))
|
@if (PageState.QueryString.ContainsKey("id"))
|
||||||
{
|
{
|
||||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
|
<AuditInfo CreatedBy="@_createdBy" CreatedOn="@_createdOn" ModifiedBy="@_modifiedBy" ModifiedOn="@_modifiedOn"></AuditInfo>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,54 +61,56 @@
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
public override string Title { get { return "Folder Management"; } }
|
public override string Title { get { return "Folder Management"; } }
|
||||||
|
|
||||||
List<Folder> folders;
|
List<Folder> _folders;
|
||||||
int folderid = -1;
|
int _folderId = -1;
|
||||||
string name;
|
string _name;
|
||||||
int parentid = -1;
|
int _parentId = -1;
|
||||||
bool issystem = false;
|
bool _isSystem;
|
||||||
string permissions = "";
|
string _permissions = "";
|
||||||
string createdby;
|
string _createdBy;
|
||||||
DateTime createdon;
|
DateTime _createdOn;
|
||||||
string modifiedby;
|
string _modifiedBy;
|
||||||
DateTime modifiedon;
|
DateTime _modifiedOn;
|
||||||
|
|
||||||
PermissionGrid permissiongrid;
|
#pragma warning disable 649
|
||||||
|
PermissionGrid _permissionGrid;
|
||||||
|
#pragma warning restore 649
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
folders = await FolderService.GetFoldersAsync(PageState.Site.SiteId);
|
_folders = await FolderService.GetFoldersAsync(PageState.Site.SiteId);
|
||||||
|
|
||||||
if (PageState.QueryString.ContainsKey("id"))
|
if (PageState.QueryString.ContainsKey("id"))
|
||||||
{
|
{
|
||||||
folderid = Int32.Parse(PageState.QueryString["id"]);
|
_folderId = Int32.Parse(PageState.QueryString["id"]);
|
||||||
Folder folder = await FolderService.GetFolderAsync(folderid);
|
Folder folder = await FolderService.GetFolderAsync(_folderId);
|
||||||
if (folder != null)
|
if (folder != null)
|
||||||
{
|
{
|
||||||
parentid = folder.ParentId ?? -1;
|
_parentId = folder.ParentId ?? -1;
|
||||||
name = folder.Name;
|
_name = folder.Name;
|
||||||
issystem = folder.IsSystem;
|
_isSystem = folder.IsSystem;
|
||||||
permissions = folder.Permissions;
|
_permissions = folder.Permissions;
|
||||||
createdby = folder.CreatedBy;
|
_createdBy = folder.CreatedBy;
|
||||||
createdon = folder.CreatedOn;
|
_createdOn = folder.CreatedOn;
|
||||||
modifiedby = folder.ModifiedBy;
|
_modifiedBy = folder.ModifiedBy;
|
||||||
modifiedon = folder.ModifiedOn;
|
_modifiedOn = folder.ModifiedOn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parentid = folders[0].FolderId;
|
_parentId = _folders[0].FolderId;
|
||||||
List<PermissionString> permissionstrings = new List<PermissionString>();
|
List<PermissionString> permissionstrings = new List<PermissionString>();
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = "Browse", Permissions = Constants.AdminRole });
|
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.Browse, Permissions = Constants.AdminRole });
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = "View", Permissions = Constants.AdminRole });
|
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.View, Permissions = Constants.AdminRole });
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = "Edit", Permissions = Constants.AdminRole });
|
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.Edit, Permissions = Constants.AdminRole });
|
||||||
permissions = UserSecurity.SetPermissionStrings(permissionstrings);
|
_permissions = UserSecurity.SetPermissionStrings(permissionstrings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Loading Folder {FolderId} {Error}", folderid, ex.Message);
|
await logger.LogError(ex, "Error Loading Folder {FolderId} {Error}", _folderId, ex.Message);
|
||||||
AddModuleMessage("Error Loading Folder", MessageType.Error);
|
AddModuleMessage("Error Loading Folder", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,12 +119,12 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (name != "" && parentid != -1)
|
if (_name != "" && _parentId != -1)
|
||||||
{
|
{
|
||||||
Folder folder;
|
Folder folder;
|
||||||
if (folderid != -1)
|
if (_folderId != -1)
|
||||||
{
|
{
|
||||||
folder = await FolderService.GetFolderAsync(folderid);
|
folder = await FolderService.GetFolderAsync(_folderId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,19 +132,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
folder.SiteId = PageState.Site.SiteId;
|
folder.SiteId = PageState.Site.SiteId;
|
||||||
if (parentid == -1)
|
if (_parentId == -1)
|
||||||
{
|
{
|
||||||
folder.ParentId = null;
|
folder.ParentId = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
folder.ParentId = parentid;
|
folder.ParentId = _parentId;
|
||||||
}
|
}
|
||||||
folder.Name = name;
|
folder.Name = _name;
|
||||||
folder.IsSystem = issystem;
|
folder.IsSystem = _isSystem;
|
||||||
folder.Permissions = permissiongrid.GetPermissions();
|
folder.Permissions = _permissionGrid.GetPermissions();
|
||||||
|
|
||||||
if (folderid != -1)
|
if (_folderId != -1)
|
||||||
{
|
{
|
||||||
folder = await FolderService.UpdateFolderAsync(folder);
|
folder = await FolderService.UpdateFolderAsync(folder);
|
||||||
}
|
}
|
||||||
|
@ -161,7 +163,7 @@
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Saving Folder {FolderId} {Error}", folderid, ex.Message);
|
await logger.LogError(ex, "Error Saving Folder {FolderId} {Error}", _folderId, ex.Message);
|
||||||
AddModuleMessage("Error Saving Module", MessageType.Error);
|
AddModuleMessage("Error Saving Module", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,13 +172,13 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await FolderService.DeleteFolderAsync(folderid);
|
await FolderService.DeleteFolderAsync(_folderId);
|
||||||
await logger.LogInformation("Folder Deleted {Folder}", folderid);
|
await logger.LogInformation("Folder Deleted {Folder}", _folderId);
|
||||||
AddModuleMessage("Folder Deleted", MessageType.Success);
|
AddModuleMessage("Folder Deleted", MessageType.Success);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Deleting Folder {Folder} {Error}", folderid, ex.Message);
|
await logger.LogError(ex, "Error Deleting Folder {Folder} {Error}", _folderId, ex.Message);
|
||||||
AddModuleMessage("Error Deleting Folder", MessageType.Error);
|
AddModuleMessage("Error Deleting Folder", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,29 +4,29 @@
|
||||||
@inject IFolderService FolderService
|
@inject IFolderService FolderService
|
||||||
@inject IFileService FileService
|
@inject IFileService FileService
|
||||||
|
|
||||||
@if (Files != null)
|
@if (_files != null)
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Folder: </label>
|
<label class="control-label">Folder: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @onchange="(e => FolderChanged(e))">
|
<select class="form-control" @onchange="(e => FolderChanged(e))">
|
||||||
@foreach (Folder folder in Folders)
|
@foreach (Folder folder in _folders)
|
||||||
{
|
{
|
||||||
<option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
<option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ActionLink Action="Edit" Text="Edit Folder" Class="btn btn-secondary" Parameters="@($"id=" + folderid.ToString())" />
|
<ActionLink Action="Edit" Text="Edit Folder" Class="btn btn-secondary" Parameters="@($"id=" + _folderId.ToString())" />
|
||||||
<ActionLink Action="Edit" Text="Add Folder" Class="btn btn-secondary" />
|
<ActionLink Action="Edit" Text="Add Folder" Class="btn btn-secondary" />
|
||||||
<ActionLink Action="Add" Text="Upload Files" Parameters="@($"id=" + folderid.ToString())" />
|
<ActionLink Action="Add" Text="Upload Files" Parameters="@($"id=" + _folderId.ToString())" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<Pager Items="@Files">
|
<Pager Items="@_files">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
<td>@(context.Size / 1000) KB</td>
|
<td>@(context.Size / 1000) KB</td>
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
@if (Files.Count == 0)
|
@if (_files.Count == 0)
|
||||||
{
|
{
|
||||||
<div class="text-center">No Files Exist In Selected Folder</div>
|
<div class="text-center">No Files Exist In Selected Folder</div>
|
||||||
}
|
}
|
||||||
|
@ -51,22 +51,22 @@
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
List<Folder> Folders;
|
List<Folder> _folders;
|
||||||
int folderid = -1;
|
int _folderId = -1;
|
||||||
List<File> Files;
|
List<File> _files;
|
||||||
Uri uri;
|
Uri _uri;
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Folders = await FolderService.GetFoldersAsync(PageState.Site.SiteId);
|
_folders = await FolderService.GetFoldersAsync(PageState.Site.SiteId);
|
||||||
if (folderid == -1 && Folders.Count > 0)
|
if (_folderId == -1 && _folders.Count > 0)
|
||||||
{
|
{
|
||||||
folderid = Folders[0].FolderId;
|
_folderId = _folders[0].FolderId;
|
||||||
await GetFiles();
|
await GetFiles();
|
||||||
}
|
}
|
||||||
uri = new Uri(NavigationManager.Uri);
|
_uri = new Uri(NavigationManager.Uri);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -77,14 +77,14 @@
|
||||||
|
|
||||||
private async Task GetFiles()
|
private async Task GetFiles()
|
||||||
{
|
{
|
||||||
Files = await FileService.GetFilesAsync(folderid);
|
_files = await FileService.GetFilesAsync(_folderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void FolderChanged(ChangeEventArgs e)
|
private async void FolderChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
folderid = int.Parse((string)e.Value);
|
_folderId = int.Parse((string)e.Value);
|
||||||
await GetFiles();
|
await GetFiles();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,26 +6,26 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label 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">Type: </label>
|
<label class="control-label">Type: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@jobtype" />
|
<input class="form-control" @bind="@_jobType" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Enabled? </label>
|
<label class="control-label">Enabled? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isenabled">
|
<select class="form-control" @bind="@_isEnabled">
|
||||||
<option value="True">Yes</option>
|
<option value="True">Yes</option>
|
||||||
<option value="False">No</option>
|
<option value="False">No</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -33,11 +33,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Runs Every: </label>
|
<label class="control-label">Runs Every: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@interval" />
|
<input class="form-control" @bind="@_interval" />
|
||||||
<select class="form-control" @bind="@frequency">
|
<select class="form-control" @bind="@_frequency">
|
||||||
<option value="m">Minute(s)</option>
|
<option value="m">Minute(s)</option>
|
||||||
<option value="H">Hour(s)</option>
|
<option value="H">Hour(s)</option>
|
||||||
<option value="d">Day(s)</option>
|
<option value="d">Day(s)</option>
|
||||||
|
@ -47,26 +47,26 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Starting: </label>
|
<label class="control-label">Starting: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@startdate" />
|
<input class="form-control" @bind="@_startDate" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Ending: </label>
|
<label class="control-label">Ending: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@enddate" />
|
<input class="form-control" @bind="@_endDate" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Retention Log (Items): </label>
|
<label class="control-label">Retention Log (Items): </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@retentionhistory" />
|
<input class="form-control" @bind="@_retentionHistory" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -76,42 +76,42 @@
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
string name = "";
|
string _name = "";
|
||||||
string jobtype = "";
|
string _jobType = "";
|
||||||
string isenabled = "True";
|
string _isEnabled = "True";
|
||||||
string interval = "";
|
string _interval = "";
|
||||||
string frequency = "";
|
string _frequency = "";
|
||||||
string startdate = "";
|
string _startDate = "";
|
||||||
string enddate = "";
|
string _endDate = "";
|
||||||
string retentionhistory = "10";
|
string _retentionHistory = "10";
|
||||||
|
|
||||||
private async Task SaveJob()
|
private async Task SaveJob()
|
||||||
{
|
{
|
||||||
if (name != "" && !string.IsNullOrEmpty(jobtype) && frequency != "" && interval != "" && retentionhistory != "")
|
if (_name != "" && !string.IsNullOrEmpty(_jobType) && _frequency != "" && _interval != "" && _retentionHistory != "")
|
||||||
{
|
{
|
||||||
Job job = new Job();
|
Job job = new Job();
|
||||||
job.Name = name;
|
job.Name = _name;
|
||||||
job.JobType = jobtype;
|
job.JobType = _jobType;
|
||||||
job.IsEnabled = Boolean.Parse(isenabled);
|
job.IsEnabled = Boolean.Parse(_isEnabled);
|
||||||
job.Frequency = frequency;
|
job.Frequency = _frequency;
|
||||||
job.Interval = int.Parse(interval);
|
job.Interval = int.Parse(_interval);
|
||||||
if (startdate == "")
|
if (_startDate == "")
|
||||||
{
|
{
|
||||||
job.StartDate = null;
|
job.StartDate = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
job.StartDate = DateTime.Parse(startdate);
|
job.StartDate = DateTime.Parse(_startDate);
|
||||||
}
|
}
|
||||||
if (enddate == "")
|
if (_endDate == "")
|
||||||
{
|
{
|
||||||
job.EndDate = null;
|
job.EndDate = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
job.EndDate = DateTime.Parse(enddate);
|
job.EndDate = DateTime.Parse(_endDate);
|
||||||
}
|
}
|
||||||
job.RetentionHistory = int.Parse(retentionhistory);
|
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||||
job.IsStarted = false;
|
job.IsStarted = false;
|
||||||
job.IsExecuting = false;
|
job.IsExecuting = false;
|
||||||
job.NextExecution = null;
|
job.NextExecution = null;
|
||||||
|
|
|
@ -6,26 +6,26 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label 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">Type: </label>
|
<label class="control-label">Type: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@jobtype" />
|
<input class="form-control" @bind="@_jobType" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Enabled? </label>
|
<label class="control-label">Enabled? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isenabled">
|
<select class="form-control" @bind="@_isEnabled">
|
||||||
<option value="True">Yes</option>
|
<option value="True">Yes</option>
|
||||||
<option value="False">No</option>
|
<option value="False">No</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -33,11 +33,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Runs Every: </label>
|
<label class="control-label">Runs Every: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@interval" />
|
<input class="form-control" @bind="@_interval" />
|
||||||
<select class="form-control" @bind="@frequency">
|
<select class="form-control" @bind="@_frequency">
|
||||||
<option value="m">Minute(s)</option>
|
<option value="m">Minute(s)</option>
|
||||||
<option value="H">Hour(s)</option>
|
<option value="H">Hour(s)</option>
|
||||||
<option value="d">Day(s)</option>
|
<option value="d">Day(s)</option>
|
||||||
|
@ -47,26 +47,26 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Starting: </label>
|
<label class="control-label">Starting: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@startdate" />
|
<input class="form-control" @bind="@_startDate" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Ending: </label>
|
<label class="control-label">Ending: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@enddate" />
|
<input class="form-control" @bind="@_endDate" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Retention Log (Items): </label>
|
<label class="control-label">Retention Log (Items): </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@retentionhistory" />
|
<input class="form-control" @bind="@_retentionHistory" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -76,68 +76,68 @@
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
int jobid;
|
int _jobId;
|
||||||
string name = "";
|
string _name = "";
|
||||||
string jobtype = "";
|
string _jobType = "";
|
||||||
string isenabled = "True";
|
string _isEnabled = "True";
|
||||||
string interval = "";
|
string _interval = "";
|
||||||
string frequency = "";
|
string _frequency = "";
|
||||||
string startdate = "";
|
string _startDate = "";
|
||||||
string enddate = "";
|
string _endDate = "";
|
||||||
string retentionhistory = "";
|
string _retentionHistory = "";
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
jobid = Int32.Parse(PageState.QueryString["id"]);
|
_jobId = Int32.Parse(PageState.QueryString["id"]);
|
||||||
Job job = await JobService.GetJobAsync(jobid);
|
Job job = await JobService.GetJobAsync(_jobId);
|
||||||
if (job != null)
|
if (job != null)
|
||||||
{
|
{
|
||||||
name = job.Name;
|
_name = job.Name;
|
||||||
jobtype = job.JobType;
|
_jobType = job.JobType;
|
||||||
isenabled = job.IsEnabled.ToString();
|
_isEnabled = job.IsEnabled.ToString();
|
||||||
interval = job.Interval.ToString();
|
_interval = job.Interval.ToString();
|
||||||
frequency = job.Frequency;
|
_frequency = job.Frequency;
|
||||||
startdate = (job.StartDate != null) ? job.StartDate.ToString() : "";
|
_startDate = (job.StartDate != null) ? job.StartDate.ToString() : "";
|
||||||
enddate = (job.EndDate != null) ? job.EndDate.ToString() : "";
|
_endDate = (job.EndDate != null) ? job.EndDate.ToString() : "";
|
||||||
retentionhistory = job.RetentionHistory.ToString();
|
_retentionHistory = job.RetentionHistory.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Loading Job {JobId} {Error}", jobid, ex.Message);
|
await logger.LogError(ex, "Error Loading Job {JobId} {Error}", _jobId, ex.Message);
|
||||||
AddModuleMessage("Error Loading Job", MessageType.Error);
|
AddModuleMessage("Error Loading Job", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveJob()
|
private async Task SaveJob()
|
||||||
{
|
{
|
||||||
if (name != "" && !string.IsNullOrEmpty(jobtype) && frequency != "" && interval != "" && retentionhistory != "")
|
if (_name != "" && !string.IsNullOrEmpty(_jobType) && _frequency != "" && _interval != "" && _retentionHistory != "")
|
||||||
{
|
{
|
||||||
Job job = await JobService.GetJobAsync(jobid);
|
Job job = await JobService.GetJobAsync(_jobId);
|
||||||
job.Name = name;
|
job.Name = _name;
|
||||||
job.JobType = jobtype;
|
job.JobType = _jobType;
|
||||||
job.IsEnabled = Boolean.Parse(isenabled);
|
job.IsEnabled = Boolean.Parse(_isEnabled);
|
||||||
job.Frequency = frequency;
|
job.Frequency = _frequency;
|
||||||
job.Interval = int.Parse(interval);
|
job.Interval = int.Parse(_interval);
|
||||||
if (startdate == "")
|
if (_startDate == "")
|
||||||
{
|
{
|
||||||
job.StartDate = null;
|
job.StartDate = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
job.StartDate = DateTime.Parse(startdate);
|
job.StartDate = DateTime.Parse(_startDate);
|
||||||
}
|
}
|
||||||
if (enddate == "")
|
if (_endDate == "")
|
||||||
{
|
{
|
||||||
job.EndDate = null;
|
job.EndDate = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
job.EndDate = DateTime.Parse(enddate);
|
job.EndDate = DateTime.Parse(_endDate);
|
||||||
}
|
}
|
||||||
job.RetentionHistory = int.Parse(retentionhistory);
|
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject IJobService JobService
|
@inject IJobService JobService
|
||||||
|
|
||||||
@if (Jobs == null)
|
@if (_jobs == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading...</em></p>
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ else
|
||||||
<button type="button" class="btn btn-secondary" @onclick="(async () => await Refresh())">Refresh</button>
|
<button type="button" class="btn btn-secondary" @onclick="(async () => await Refresh())">Refresh</button>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
<Pager Items="@Jobs">
|
<Pager Items="@_jobs">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
|
@ -49,23 +49,23 @@ else
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
List<Job> Jobs;
|
List<Job> _jobs;
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
Jobs = await JobService.GetJobsAsync();
|
_jobs = await JobService.GetJobsAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DisplayStatus(bool IsEnabled, bool IsExecuting)
|
private string DisplayStatus(bool isEnabled, bool isExecuting)
|
||||||
{
|
{
|
||||||
string status = "";
|
string status = "";
|
||||||
if (!IsEnabled)
|
if (!isEnabled)
|
||||||
{
|
{
|
||||||
status = "Disabled";
|
status = "Disabled";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IsExecuting)
|
if (isExecuting)
|
||||||
{
|
{
|
||||||
status = "Executing";
|
status = "Executing";
|
||||||
}
|
}
|
||||||
|
@ -79,59 +79,59 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private string DisplayFrequency(int Interval, string Frequency)
|
private string DisplayFrequency(int interval, string frequency)
|
||||||
{
|
{
|
||||||
string frequency = "Every " + Interval.ToString() + " ";
|
string result = "Every " + interval.ToString() + " ";
|
||||||
switch (Frequency)
|
switch (frequency)
|
||||||
{
|
{
|
||||||
case "m":
|
case "m":
|
||||||
frequency += "Minute";
|
result += "Minute";
|
||||||
break;
|
break;
|
||||||
case "H":
|
case "H":
|
||||||
frequency += "Hour";
|
result += "Hour";
|
||||||
break;
|
break;
|
||||||
case "d":
|
case "d":
|
||||||
frequency += "Day";
|
result += "Day";
|
||||||
break;
|
break;
|
||||||
case "M":
|
case "M":
|
||||||
frequency += "Month";
|
result += "Month";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Interval > 1)
|
if (interval > 1)
|
||||||
{
|
{
|
||||||
frequency += "s";
|
result += "s";
|
||||||
}
|
}
|
||||||
return frequency;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteJob(Job Job)
|
private async Task DeleteJob(Job job)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await JobService.DeleteJobAsync(Job.JobId);
|
await JobService.DeleteJobAsync(job.JobId);
|
||||||
await logger.LogInformation("Job Deleted {Job}", Job);
|
await logger.LogInformation("Job Deleted {Job}", job);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Deleting Job {Job} {Error}", Job, ex.Message);
|
await logger.LogError(ex, "Error Deleting Job {Job} {Error}", job, ex.Message);
|
||||||
AddModuleMessage("Error Deleting Job", MessageType.Error);
|
AddModuleMessage("Error Deleting Job", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StartJob(int JobId)
|
private async Task StartJob(int jobId)
|
||||||
{
|
{
|
||||||
await JobService.StartJobAsync(JobId);
|
await JobService.StartJobAsync(jobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StopJob(int JobId)
|
private async Task StopJob(int jobId)
|
||||||
{
|
{
|
||||||
await JobService.StopJobAsync(JobId);
|
await JobService.StopJobAsync(jobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Refresh()
|
private async Task Refresh()
|
||||||
{
|
{
|
||||||
Jobs = await JobService.GetJobsAsync();
|
_jobs = await JobService.GetJobsAsync();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject IJobLogService JobLogService
|
@inject IJobLogService JobLogService
|
||||||
|
|
||||||
@if (JobLogs == null)
|
@if (_jobLogs == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading...</em></p>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<Pager Items="@JobLogs">
|
<Pager Items="@_jobLogs">
|
||||||
<Header>
|
<Header>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
@ -30,28 +30,28 @@ else
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
List<JobLog> JobLogs;
|
List<JobLog> _jobLogs;
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
JobLogs = await JobLogService.GetJobLogsAsync();
|
_jobLogs = await JobLogService.GetJobLogsAsync();
|
||||||
if (PageState.QueryString.ContainsKey("id"))
|
if (PageState.QueryString.ContainsKey("id"))
|
||||||
{
|
{
|
||||||
JobLogs = JobLogs.Where(item => item.JobId == Int32.Parse(PageState.QueryString["id"])).ToList();
|
_jobLogs = _jobLogs.Where(item => item.JobId == Int32.Parse(PageState.QueryString["id"])).ToList();
|
||||||
}
|
}
|
||||||
JobLogs = JobLogs.OrderByDescending(item => item.JobLogId).ToList();
|
_jobLogs = _jobLogs.OrderByDescending(item => item.JobLogId).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DisplayStatus(bool IsExecuting, bool? Succeeded)
|
private string DisplayStatus(bool isExecuting, bool? succeeded)
|
||||||
{
|
{
|
||||||
string status = "";
|
string status = "";
|
||||||
if (IsExecuting)
|
if (isExecuting)
|
||||||
{
|
{
|
||||||
status = "Executing";
|
status = "Executing";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Succeeded.Value)
|
if (succeeded != null && succeeded.Value)
|
||||||
{
|
{
|
||||||
status = "Succeeded";
|
status = "Succeeded";
|
||||||
}
|
}
|
||||||
|
@ -62,4 +62,4 @@ else
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
@namespace Oqtane.Modules.Admin.Login
|
@namespace Oqtane.Modules.Admin.Login
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IJSRuntime jsRuntime
|
@inject IJSRuntime JsRuntime
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@inject IServiceProvider ServiceProvider
|
@inject IServiceProvider ServiceProvider
|
||||||
|
|
||||||
@if (Message != "")
|
@if (_message != "")
|
||||||
{
|
{
|
||||||
<ModuleMessage Message="@Message" Type="@Type" />
|
<ModuleMessage Message="@_message" Type="@_type" />
|
||||||
}
|
}
|
||||||
<AuthorizeView>
|
<AuthorizeView>
|
||||||
<Authorizing>
|
<Authorizing>
|
||||||
|
@ -20,16 +20,16 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Username" class="control-label">Username: </label>
|
<label for="Username" class="control-label">Username: </label>
|
||||||
<input type="text" name="Username" class="form-control" placeholder="Username" @bind="@Username" />
|
<input type="text" name="Username" class="form-control" placeholder="Username" @bind="@_username" id="Username" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Password" class="control-label">Password: </label>
|
<label for="Password" class="control-label">Password: </label>
|
||||||
<input type="password" name="Password" class="form-control" placeholder="Password" @bind="@Password" />
|
<input type="password" name="Password" class="form-control" placeholder="Password" @bind="@_password" id="Password" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<label class="form-check-label" for="Remember">Remember Me?</label>
|
<label class="form-check-label" for="Remember">Remember Me?</label>
|
||||||
<input type="checkbox" class="form-check-input" name="Remember" @bind="@Remember" />
|
<input type="checkbox" class="form-check-input" name="Remember" @bind="@_remember" id="Remember" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-primary" @onclick="Login">Login</button>
|
<button type="button" class="btn btn-primary" @onclick="Login">Login</button>
|
||||||
|
@ -43,38 +43,38 @@
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Anonymous; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Anonymous; } }
|
||||||
|
|
||||||
string ReturnUrl = "";
|
string _returnUrl = "";
|
||||||
public string Message = "";
|
string _message = "";
|
||||||
public MessageType Type = MessageType.Info;
|
MessageType _type = MessageType.Info;
|
||||||
public string Username = "";
|
string _username = "";
|
||||||
public string Password = "";
|
string _password = "";
|
||||||
public bool Remember = false;
|
bool _remember = false;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
if (PageState.QueryString.ContainsKey("returnurl"))
|
if (PageState.QueryString.ContainsKey("returnurl"))
|
||||||
{
|
{
|
||||||
ReturnUrl = PageState.QueryString["returnurl"];
|
_returnUrl = PageState.QueryString["returnurl"];
|
||||||
}
|
}
|
||||||
if (PageState.QueryString.ContainsKey("name"))
|
if (PageState.QueryString.ContainsKey("name"))
|
||||||
{
|
{
|
||||||
Username = PageState.QueryString["name"];
|
_username = PageState.QueryString["name"];
|
||||||
}
|
}
|
||||||
if (PageState.QueryString.ContainsKey("token"))
|
if (PageState.QueryString.ContainsKey("token"))
|
||||||
{
|
{
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.SiteId = PageState.Site.SiteId;
|
user.SiteId = PageState.Site.SiteId;
|
||||||
user.Username = Username;
|
user.Username = _username;
|
||||||
user = await UserService.VerifyEmailAsync(user, PageState.QueryString["token"]);
|
user = await UserService.VerifyEmailAsync(user, PageState.QueryString["token"]);
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
Message = "User Account Verified Successfully. You Can Now Login With Your Username And Password Below.";
|
_message = "User Account Verified Successfully. You Can Now Login With Your Username And Password Below.";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Message = "User Account Could Not Be Verified. Please Contact Your Administrator For Further Instructions.";
|
_message = "User Account Could Not Be Verified. Please Contact Your Administrator For Further Instructions.";
|
||||||
Type = MessageType.Warning;
|
_type = MessageType.Warning;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,21 +87,21 @@
|
||||||
// server-side Blazor
|
// server-side Blazor
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.SiteId = PageState.Site.SiteId;
|
user.SiteId = PageState.Site.SiteId;
|
||||||
user.Username = Username;
|
user.Username = _username;
|
||||||
user.Password = Password;
|
user.Password = _password;
|
||||||
user = await UserService.LoginUserAsync(user, false, false);
|
user = await UserService.LoginUserAsync(user, false, false);
|
||||||
if (user.IsAuthenticated)
|
if (user.IsAuthenticated)
|
||||||
{
|
{
|
||||||
await logger.LogInformation("Login Successful For Username {Username}", Username);
|
await logger.LogInformation("Login Successful For Username {Username}", _username);
|
||||||
// complete the login on the server so that the cookies are set correctly on SignalR
|
// complete the login on the server so that the cookies are set correctly on SignalR
|
||||||
var interop = new Interop(jsRuntime);
|
var interop = new Interop(JsRuntime);
|
||||||
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
|
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
|
||||||
var fields = new { __RequestVerificationToken = antiforgerytoken, username = Username, password = Password, remember = Remember, returnurl = ReturnUrl };
|
var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl };
|
||||||
await interop.SubmitForm("/pages/login/", fields);
|
await interop.SubmitForm("/pages/login/", fields);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await logger.LogInformation("Login Failed For Username {Username}", Username);
|
await logger.LogInformation("Login Failed For Username {Username}", _username);
|
||||||
AddModuleMessage("Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Email Verification When They Initially Created.", MessageType.Error);
|
AddModuleMessage("Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Email Verification When They Initially Created.", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,18 +110,18 @@
|
||||||
// client-side Blazor
|
// client-side Blazor
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.SiteId = PageState.Site.SiteId;
|
user.SiteId = PageState.Site.SiteId;
|
||||||
user.Username = Username;
|
user.Username = _username;
|
||||||
user.Password = Password;
|
user.Password = _password;
|
||||||
user = await UserService.LoginUserAsync(user, true, Remember);
|
user = await UserService.LoginUserAsync(user, true, _remember);
|
||||||
if (user.IsAuthenticated)
|
if (user.IsAuthenticated)
|
||||||
{
|
{
|
||||||
await logger.LogInformation("Login Successful For Username {Username}", Username);
|
await logger.LogInformation("Login Successful For Username {Username}", _username);
|
||||||
authstateprovider.NotifyAuthenticationChanged();
|
authstateprovider.NotifyAuthenticationChanged();
|
||||||
NavigationManager.NavigateTo(NavigateUrl(ReturnUrl, "reload"));
|
NavigationManager.NavigateTo(NavigateUrl(_returnUrl, "reload"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await logger.LogInformation("Login Failed For Username {Username}", Username);
|
await logger.LogInformation("Login Failed For Username {Username}", _username);
|
||||||
AddModuleMessage("Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Verification When They Are Initially Created So You May Wish To Check Your Email.", MessageType.Error);
|
AddModuleMessage("Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Verification When They Are Initially Created So You May Wish To Check Your Email.", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,28 +129,28 @@
|
||||||
|
|
||||||
private void Cancel()
|
private void Cancel()
|
||||||
{
|
{
|
||||||
NavigationManager.NavigateTo(ReturnUrl);
|
NavigationManager.NavigateTo(_returnUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Forgot()
|
private async Task Forgot()
|
||||||
{
|
{
|
||||||
if (Username != "")
|
if (_username != "")
|
||||||
{
|
{
|
||||||
User user = await UserService.GetUserAsync(Username, PageState.Site.SiteId);
|
User user = await UserService.GetUserAsync(_username, PageState.Site.SiteId);
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
await UserService.ForgotPasswordAsync(user);
|
await UserService.ForgotPasswordAsync(user);
|
||||||
Message = "Please Check The Email Address Associated To Your User Account For A Password Reset Notification";
|
_message = "Please Check The Email Address Associated To Your User Account For A Password Reset Notification";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Message = "User Does Not Exist";
|
_message = "User Does Not Exist";
|
||||||
Type = MessageType.Warning;
|
_type = MessageType.Warning;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Message = "Please Enter The Username Related To Your Account And Then Select The Forgot Password Option Again";
|
_message = "Please Enter The Username Related To Your Account And Then Select The Forgot Password Option Again";
|
||||||
}
|
}
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@namespace Oqtane.Modules.Admin.Logs
|
@namespace Oqtane.Modules.Admin.Logs
|
||||||
|
@using System.Globalization
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject ILogService LogService
|
@inject ILogService LogService
|
||||||
|
@ -12,7 +13,7 @@
|
||||||
<label class="control-label">Date/Time: </label>
|
<label class="control-label">Date/Time: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@logdate" disabled />
|
<input class="form-control" @bind="@_logDate" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
<label class="control-label">Level: </label>
|
<label class="control-label">Level: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@level" disabled />
|
<input class="form-control" @bind="@_level" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -28,7 +29,7 @@
|
||||||
<label class="control-label">Feature: </label>
|
<label class="control-label">Feature: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@feature" disabled />
|
<input class="form-control" @bind="@_feature" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
<label class="control-label">Function: </label>
|
<label class="control-label">Function: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@function" disabled />
|
<input class="form-control" @bind="@_function" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -44,39 +45,39 @@
|
||||||
<label class="control-label">Category: </label>
|
<label class="control-label">Category: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@category" disabled />
|
<input class="form-control" @bind="@_category" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if (pagename != "")
|
@if (_pageName != "")
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label">Page: </label>
|
<label class="control-label">Page: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@pagename" disabled />
|
<input class="form-control" @bind="@_pageName" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@if (moduletitle != "")
|
@if (_moduleTitle != "")
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label">Module: </label>
|
<label class="control-label">Module: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@moduletitle" disabled />
|
<input class="form-control" @bind="@_moduleTitle" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@if (username != "")
|
@if (_username != "")
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label">User: </label>
|
<label class="control-label">User: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@username" disabled />
|
<input class="form-control" @bind="@_username" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -85,7 +86,7 @@
|
||||||
<label class="control-label">Url: </label>
|
<label class="control-label">Url: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@url" disabled />
|
<input class="form-control" @bind="@_url" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -93,7 +94,7 @@
|
||||||
<label class="control-label">Template: </label>
|
<label class="control-label">Template: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@template" disabled />
|
<input class="form-control" @bind="@_template" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -101,17 +102,17 @@
|
||||||
<label class="control-label">Message: </label>
|
<label class="control-label">Message: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@message" rows="5" disabled />
|
<textarea class="form-control" @bind="@_message" rows="5" disabled></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if (!string.IsNullOrEmpty(exception))
|
@if (!string.IsNullOrEmpty(_exception))
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label">Exception: </label>
|
<label class="control-label">Exception: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@exception" rows="5" disabled />
|
<textarea class="form-control" @bind="@_exception" rows="5" disabled></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@
|
||||||
<label class="control-label">Properties: </label>
|
<label class="control-label">Properties: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@properties" rows="5" disabled />
|
<textarea class="form-control" @bind="@_properties" rows="5" disabled></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -128,7 +129,7 @@
|
||||||
<label class="control-label">Server: </label>
|
<label class="control-label">Server: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@server" disabled />
|
<input class="form-control" @bind="@_server" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -137,41 +138,41 @@
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
int logid;
|
int _logId;
|
||||||
string logdate = "";
|
string _logDate = "";
|
||||||
string level = "";
|
string _level = "";
|
||||||
string feature = "";
|
string _feature = "";
|
||||||
string function = "";
|
string _function = "";
|
||||||
string category = "";
|
string _category = "";
|
||||||
string pagename = "";
|
string _pageName = "";
|
||||||
string moduletitle = "";
|
string _moduleTitle = "";
|
||||||
string username = "";
|
string _username = "";
|
||||||
string url = "";
|
string _url = "";
|
||||||
string template = "";
|
string _template = "";
|
||||||
string message = "";
|
string _message = "";
|
||||||
string exception = "";
|
string _exception = "";
|
||||||
string properties = "";
|
string _properties = "";
|
||||||
string server = "";
|
string _server = "";
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logid = Int32.Parse(PageState.QueryString["id"]);
|
_logId = Int32.Parse(PageState.QueryString["id"]);
|
||||||
Log log = await LogService.GetLogAsync(logid);
|
Log log = await LogService.GetLogAsync(_logId);
|
||||||
if (log != null)
|
if (log != null)
|
||||||
{
|
{
|
||||||
logdate = log.LogDate.ToString();
|
_logDate = log.LogDate.ToString(CultureInfo.CurrentCulture);
|
||||||
level = log.Level;
|
_level = log.Level;
|
||||||
feature = log.Feature;
|
_feature = log.Feature;
|
||||||
function = log.Function;
|
_function = log.Function;
|
||||||
category = log.Category;
|
_category = log.Category;
|
||||||
if (log.PageId != null)
|
if (log.PageId != null)
|
||||||
{
|
{
|
||||||
Page page = await PageService.GetPageAsync(log.PageId.Value);
|
Page page = await PageService.GetPageAsync(log.PageId.Value);
|
||||||
if (page != null)
|
if (page != null)
|
||||||
{
|
{
|
||||||
pagename = page.Name;
|
_pageName = page.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (log.PageId != null && log.ModuleId != null)
|
if (log.PageId != null && log.ModuleId != null)
|
||||||
|
@ -179,7 +180,7 @@
|
||||||
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(log.PageId.Value, log.ModuleId.Value);
|
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(log.PageId.Value, log.ModuleId.Value);
|
||||||
if (pagemodule != null)
|
if (pagemodule != null)
|
||||||
{
|
{
|
||||||
moduletitle = pagemodule.Title;
|
_moduleTitle = pagemodule.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (log.UserId != null)
|
if (log.UserId != null)
|
||||||
|
@ -187,20 +188,20 @@
|
||||||
User user = await UserService.GetUserAsync(log.UserId.Value, PageState.Site.SiteId);
|
User user = await UserService.GetUserAsync(log.UserId.Value, PageState.Site.SiteId);
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
username = user.Username;
|
_username = user.Username;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
url = log.Url;
|
_url = log.Url;
|
||||||
template = log.MessageTemplate;
|
_template = log.MessageTemplate;
|
||||||
message = log.Message;
|
_message = log.Message;
|
||||||
exception = log.Exception;
|
_exception = log.Exception;
|
||||||
properties = log.Properties;
|
_properties = log.Properties;
|
||||||
server = log.Server;
|
_server = log.Server;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Loading Log {LogId} {Error}", logid, ex.Message);
|
await logger.LogError(ex, "Error Loading Log {LogId} {Error}", _logId, ex.Message);
|
||||||
AddModuleMessage("Error Loading Log", MessageType.Error);
|
AddModuleMessage("Error Loading Log", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject ILogService LogService
|
@inject ILogService LogService
|
||||||
|
|
||||||
@if (Logs == null)
|
@if (_logs == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading...</em></p>
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,9 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@if (Logs.Any())
|
@if (_logs.Any())
|
||||||
{
|
{
|
||||||
<Pager Items="@Logs">
|
<Pager Items="@_logs">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
|
@ -73,10 +73,10 @@ else
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
string level = "-";
|
string _level = "-";
|
||||||
string function = "-";
|
string _function = "-";
|
||||||
string rows = "10";
|
string _rows = "10";
|
||||||
List<Log> Logs;
|
List<Log> _logs;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
level = (string)e.Value;
|
_level = (string)e.Value;
|
||||||
await GetLogs();
|
await GetLogs();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
function = (string)e.Value;
|
_function = (string)e.Value;
|
||||||
await GetLogs();
|
await GetLogs();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
rows = (string)e.Value;
|
_rows = (string)e.Value;
|
||||||
await GetLogs();
|
await GetLogs();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ else
|
||||||
|
|
||||||
private async Task GetLogs()
|
private async Task GetLogs()
|
||||||
{
|
{
|
||||||
Logs = await LogService.GetLogsAsync(PageState.Site.SiteId, ((level == "-") ? "" : level), ((function == "-") ? "" : function), int.Parse(rows));
|
_logs = await LogService.GetLogsAsync(PageState.Site.SiteId, ((_level == "-") ? "" : _level), ((_function == "-") ? "" : _function), int.Parse(_rows));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetClass(string function)
|
private string GetClass(string function)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Module: </label>
|
<label class="control-label">Module: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<FileManager Filter="nupkg" ShowFiles="false" Folder="Modules" />
|
<FileManager Filter="nupkg" ShowFiles="false" Folder="Modules" />
|
||||||
|
@ -16,12 +16,12 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@if (packages != null)
|
@if (_packages != null)
|
||||||
{
|
{
|
||||||
<hr class="app-rule" />
|
<hr class="app-rule" />
|
||||||
<div class="mx-auto text-center"><h2>Available Modules</h2></div>
|
<div class="mx-auto text-center"><h2>Available Modules</h2></div>
|
||||||
|
|
||||||
<Pager Items="@packages">
|
<Pager Items="@_packages">
|
||||||
<Header>
|
<Header>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Version</th>
|
<th>Version</th>
|
||||||
|
@ -44,19 +44,19 @@
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
List<Package> packages;
|
List<Package> _packages;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<ModuleDefinition> moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
List<ModuleDefinition> moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
||||||
packages = await PackageService.GetPackagesAsync("module");
|
_packages = await PackageService.GetPackagesAsync("module");
|
||||||
foreach(Package package in packages.ToArray())
|
foreach(Package package in _packages.ToArray())
|
||||||
{
|
{
|
||||||
if (moduledefinitions.Exists(item => Utilities.GetTypeName(item.ModuleDefinitionName) == package.PackageId))
|
if (moduledefinitions.Exists(item => Utilities.GetTypeName(item.ModuleDefinitionName) == package.PackageId))
|
||||||
{
|
{
|
||||||
packages.Remove(package);
|
_packages.Remove(package);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,18 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label 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">Permissions: </label>
|
<label class="control-label">Permissions: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<PermissionGrid EntityName="ModuleDefinition" PermissionNames="Utilize" Permissions="@permissions" @ref="permissiongrid" />
|
<PermissionGrid EntityName="ModuleDefinition" PermissionNames=PermissionNames.Utilize Permissions="@_permissions" @ref="_permissionGrid" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -25,40 +25,42 @@
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
|
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
int ModuleDefinitionId;
|
int _moduleDefinitionId;
|
||||||
string name;
|
string _name;
|
||||||
string permissions;
|
string _permissions;
|
||||||
string createdby;
|
string _createdby;
|
||||||
DateTime createdon;
|
DateTime _createdon;
|
||||||
string modifiedby;
|
string _modifiedby;
|
||||||
DateTime modifiedon;
|
DateTime _modifiedon;
|
||||||
|
|
||||||
PermissionGrid permissiongrid;
|
#pragma warning disable 649
|
||||||
|
PermissionGrid _permissionGrid;
|
||||||
|
#pragma warning restore 649
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ModuleDefinitionId = Int32.Parse(PageState.QueryString["id"]);
|
_moduleDefinitionId = Int32.Parse(PageState.QueryString["id"]);
|
||||||
ModuleDefinition moduledefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(ModuleDefinitionId, ModuleState.SiteId);
|
ModuleDefinition moduleDefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(_moduleDefinitionId, ModuleState.SiteId);
|
||||||
if (moduledefinition != null)
|
if (moduleDefinition != null)
|
||||||
{
|
{
|
||||||
name = moduledefinition.Name;
|
_name = moduleDefinition.Name;
|
||||||
permissions = moduledefinition.Permissions;
|
_permissions = moduleDefinition.Permissions;
|
||||||
createdby = moduledefinition.CreatedBy;
|
_createdby = moduleDefinition.CreatedBy;
|
||||||
createdon = moduledefinition.CreatedOn;
|
_createdon = moduleDefinition.CreatedOn;
|
||||||
modifiedby = moduledefinition.ModifiedBy;
|
_modifiedby = moduleDefinition.ModifiedBy;
|
||||||
modifiedon = moduledefinition.ModifiedOn;
|
_modifiedon = moduleDefinition.ModifiedOn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Loading ModuleDefinition {ModuleDefinitionId} {Error}", ModuleDefinitionId, ex.Message);
|
await logger.LogError(ex, "Error Loading ModuleDefinition {ModuleDefinitionId} {Error}", _moduleDefinitionId, ex.Message);
|
||||||
AddModuleMessage("Error Loading Module", MessageType.Error);
|
AddModuleMessage("Error Loading Module", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,15 +69,15 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ModuleDefinition moduledefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(ModuleDefinitionId, ModuleState.SiteId);
|
ModuleDefinition moduledefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(_moduleDefinitionId, ModuleState.SiteId);
|
||||||
moduledefinition.Permissions = permissiongrid.GetPermissions();
|
moduledefinition.Permissions = _permissionGrid.GetPermissions();
|
||||||
await ModuleDefinitionService.UpdateModuleDefinitionAsync(moduledefinition);
|
await ModuleDefinitionService.UpdateModuleDefinitionAsync(moduledefinition);
|
||||||
await logger.LogInformation("ModuleDefinition Saved {ModuleDefinition}", moduledefinition);
|
await logger.LogInformation("ModuleDefinition Saved {ModuleDefinition}", moduledefinition);
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Saving ModuleDefinition {ModuleDefinitionId} {Error}", ModuleDefinitionId, ex.Message);
|
await logger.LogError(ex, "Error Saving ModuleDefinition {ModuleDefinitionId} {Error}", _moduleDefinitionId, ex.Message);
|
||||||
AddModuleMessage("Error Saving Module", MessageType.Error);
|
AddModuleMessage("Error Saving Module", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
@inject IModuleDefinitionService ModuleDefinitionService
|
@inject IModuleDefinitionService ModuleDefinitionService
|
||||||
@inject IPackageService PackageService
|
@inject IPackageService PackageService
|
||||||
|
|
||||||
@if (moduledefinitions == null)
|
@if (_moduleDefinitions == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading...</em></p>
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ else
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Install Module" />
|
<ActionLink Action="Add" Text="Install Module" />
|
||||||
|
|
||||||
<Pager Items="@moduledefinitions">
|
<Pager Items="@_moduleDefinitions">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
|
@ -43,15 +43,15 @@ else
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
List<ModuleDefinition> moduledefinitions;
|
List<ModuleDefinition> _moduleDefinitions;
|
||||||
List<Package> packages;
|
List<Package> _packages;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
_moduleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
||||||
packages = await PackageService.GetPackagesAsync("module");
|
_packages = await PackageService.GetPackagesAsync("module");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ else
|
||||||
private bool UpgradeAvailable(string moduledefinitionname, string version)
|
private bool UpgradeAvailable(string moduledefinitionname, string version)
|
||||||
{
|
{
|
||||||
bool upgradeavailable = false;
|
bool upgradeavailable = false;
|
||||||
Package package = packages.Where(item => item.PackageId == Utilities.GetTypeName(moduledefinitionname)).FirstOrDefault();
|
Package package = _packages.Where(item => item.PackageId == Utilities.GetTypeName(moduledefinitionname)).FirstOrDefault();
|
||||||
if (package != null)
|
if (package != null)
|
||||||
{
|
{
|
||||||
upgradeavailable = (Version.Parse(package.Version).CompareTo(Version.Parse(version)) > 0);
|
upgradeavailable = (Version.Parse(package.Version).CompareTo(Version.Parse(version)) > 0);
|
||||||
|
@ -87,18 +87,18 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteModule(ModuleDefinition ModuleDefinition)
|
private async Task DeleteModule(ModuleDefinition moduleDefinition)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await ModuleDefinitionService.DeleteModuleDefinitionAsync(ModuleDefinition.ModuleDefinitionId, ModuleDefinition.SiteId);
|
await ModuleDefinitionService.DeleteModuleDefinitionAsync(moduleDefinition.ModuleDefinitionId, moduleDefinition.SiteId);
|
||||||
await logger.LogInformation("Module Deleted {ModuleDefinition}", ModuleDefinition);
|
await logger.LogInformation("Module Deleted {ModuleDefinition}", moduleDefinition);
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Deleting Module {ModuleDefinition} {Error}", ModuleDefinition, ex.Message);
|
await logger.LogError(ex, "Error Deleting Module {ModuleDefinition} {Error}", moduleDefinition, ex.Message);
|
||||||
AddModuleMessage("Error Deleting Module", MessageType.Error);
|
AddModuleMessage("Error Deleting Module", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Title" class="control-label">Content: </label>
|
<label class="control-label">Content: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@content" rows="5" />
|
<textarea class="form-control" @bind="@_content" rows="5"></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -23,10 +23,10 @@
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
public override string Title { get { return "Export Module"; } }
|
public override string Title { get { return "Export Module"; } }
|
||||||
|
|
||||||
string content = "";
|
string _content = "";
|
||||||
|
|
||||||
private async Task ExportModule()
|
private async Task ExportModule()
|
||||||
{
|
{
|
||||||
content = await ModuleService.ExportModuleAsync(ModuleState.ModuleId);
|
_content = await ModuleService.ExportModuleAsync(ModuleState.ModuleId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<label for="Title" class="control-label">Content: </label>
|
<label for="Title" class="control-label">Content: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@content" rows="5" />
|
<textarea class="form-control" @bind="@_content" rows="5"></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -23,16 +23,16 @@
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
public override string Title { get { return "Import Module"; } }
|
public override string Title { get { return "Import Module"; } }
|
||||||
|
|
||||||
string content = "";
|
string _content = "";
|
||||||
|
|
||||||
|
|
||||||
private async Task ImportModule()
|
private async Task ImportModule()
|
||||||
{
|
{
|
||||||
if (content != "")
|
if (_content != "")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await ModuleService.ImportModuleAsync(ModuleState.ModuleId, content);
|
await ModuleService.ImportModuleAsync(ModuleState.ModuleId, _content);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<label for="Title" class="control-label">Title: </label>
|
<label for="Title" class="control-label">Title: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="Title" class="form-control" @bind="@title" />
|
<input type="text" name="Title" class="form-control" @bind="@_title" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
<label for="Container" class="control-label">Container: </label>
|
<label for="Container" class="control-label">Container: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@containertype">
|
<select class="form-control" @bind="@_containerType">
|
||||||
<option value=""><Select Container></option>
|
<option value=""><Select Container></option>
|
||||||
@foreach (KeyValuePair<string, string> container in containers)
|
@foreach (KeyValuePair<string, string> container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.Key">@container.Value</option>
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<label for="Name" class="control-label">Permissions: </label>
|
<label for="Name" class="control-label">Permissions: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<PermissionGrid EntityName="Module" PermissionNames="@permissionnames" Permissions="@permissions" @ref="permissiongrid" />
|
<PermissionGrid EntityName="Module" PermissionNames="@_permissionNames" Permissions="@_permissions" @ref="_permissionGrid" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
<label for="Page" class="control-label">Page: </label>
|
<label for="Page" class="control-label">Page: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@pageid">
|
<select class="form-control" @bind="@_pageId">
|
||||||
@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>
|
||||||
|
@ -63,26 +63,26 @@
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Edit; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Edit; } }
|
||||||
public override string Title { get { return "Module Settings"; } }
|
public override string Title { get { return "Module Settings"; } }
|
||||||
|
|
||||||
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 _permissionNames = "";
|
||||||
string permissions;
|
string _permissions;
|
||||||
string pageid;
|
string _pageId;
|
||||||
|
|
||||||
PermissionGrid permissiongrid;
|
PermissionGrid _permissionGrid;
|
||||||
|
|
||||||
RenderFragment DynamicComponent { get; set; }
|
RenderFragment DynamicComponent { get; set; }
|
||||||
object settings;
|
object _settings;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
title = ModuleState.Title;
|
_title = ModuleState.Title;
|
||||||
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 = ModuleState.ModuleDefinition.PermissionNames;
|
_permissionNames = ModuleState.ModuleDefinition.PermissionNames;
|
||||||
pageid = ModuleState.PageId.ToString();
|
_pageId = ModuleState.PageId.ToString();
|
||||||
|
|
||||||
DynamicComponent = builder =>
|
DynamicComponent = builder =>
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
if (moduleType != null)
|
if (moduleType != null)
|
||||||
{
|
{
|
||||||
builder.OpenComponent(0, moduleType);
|
builder.OpenComponent(0, moduleType);
|
||||||
builder.AddComponentReferenceCapture(1, inst => { settings = Convert.ChangeType(inst, moduleType); });
|
builder.AddComponentReferenceCapture(1, inst => { _settings = Convert.ChangeType(inst, moduleType); });
|
||||||
builder.CloseComponent();
|
builder.CloseComponent();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -99,20 +99,20 @@
|
||||||
private async Task SaveModule()
|
private async Task SaveModule()
|
||||||
{
|
{
|
||||||
Module module = ModuleState;
|
Module module = ModuleState;
|
||||||
module.Permissions = permissiongrid.GetPermissions();
|
module.Permissions = _permissionGrid.GetPermissions();
|
||||||
await ModuleService.UpdateModuleAsync(module);
|
await ModuleService.UpdateModuleAsync(module);
|
||||||
|
|
||||||
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
||||||
pagemodule.PageId = int.Parse(pageid);
|
pagemodule.PageId = int.Parse(_pageId);
|
||||||
pagemodule.Title = title;
|
pagemodule.Title = _title;
|
||||||
pagemodule.ContainerType = containertype;
|
pagemodule.ContainerType = _containerType;
|
||||||
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
||||||
await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
|
await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
|
||||||
|
|
||||||
Type moduleType = Type.GetType(ModuleState.ModuleType);
|
Type moduleType = Type.GetType(ModuleState.ModuleType);
|
||||||
if (moduleType != null)
|
if (moduleType != null)
|
||||||
{
|
{
|
||||||
moduleType.GetMethod("UpdateSettings").Invoke(settings, null); // method must be public in settings component
|
moduleType.GetMethod("UpdateSettings")?.Invoke(_settings, null); // method must be public in settings component
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
|
|
@ -184,8 +184,8 @@
|
||||||
layouttype = PageState.Site.DefaultLayoutType;
|
layouttype = PageState.Site.DefaultLayoutType;
|
||||||
|
|
||||||
List<PermissionString> permissionstrings = new List<PermissionString>();
|
List<PermissionString> permissionstrings = new List<PermissionString>();
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = "View", Permissions = Constants.AdminRole });
|
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.View, Permissions = Constants.AdminRole });
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = "Edit", Permissions = Constants.AdminRole });
|
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.Edit, Permissions = Constants.AdminRole });
|
||||||
permissions = UserSecurity.SetPermissionStrings(permissionstrings);
|
permissions = UserSecurity.SetPermissionStrings(permissionstrings);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -209,7 +209,7 @@
|
||||||
themes = ThemeService.GetThemeTypes(Themes);
|
themes = ThemeService.GetThemeTypes(Themes);
|
||||||
|
|
||||||
PageId = Int32.Parse(PageState.QueryString["id"]);
|
PageId = Int32.Parse(PageState.QueryString["id"]);
|
||||||
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
|
Page page = PageState.Pages.FirstOrDefault(item => item.PageId == PageId);
|
||||||
if (page != null)
|
if (page != null)
|
||||||
{
|
{
|
||||||
name = page.Name;
|
name = page.Name;
|
||||||
|
@ -310,7 +310,7 @@
|
||||||
if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)))
|
if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)))
|
||||||
{
|
{
|
||||||
page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
|
page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
|
||||||
string currentpath = page.Path;
|
string currentPath = page.Path;
|
||||||
|
|
||||||
page.Name = name;
|
page.Name = name;
|
||||||
if (path == "" && name.ToLower() != "home")
|
if (path == "" && name.ToLower() != "home")
|
||||||
|
@ -329,7 +329,7 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
page.ParentId = Int32.Parse(parentid);
|
page.ParentId = Int32.Parse(parentid);
|
||||||
Page parent = PageState.Pages.Where(item => item.PageId == page.ParentId).FirstOrDefault();
|
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
|
||||||
if (parent.Path == "")
|
if (parent.Path == "")
|
||||||
{
|
{
|
||||||
page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(path);
|
page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(path);
|
||||||
|
@ -348,12 +348,12 @@
|
||||||
page.Order = 0;
|
page.Order = 0;
|
||||||
break;
|
break;
|
||||||
case "<":
|
case "<":
|
||||||
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
|
child = PageState.Pages.FirstOrDefault(item => item.PageId == childid);
|
||||||
page.Order = child.Order - 1;
|
if (child != null) page.Order = child.Order - 1;
|
||||||
break;
|
break;
|
||||||
case ">":
|
case ">":
|
||||||
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
|
child = PageState.Pages.FirstOrDefault(item => item.PageId == childid);
|
||||||
page.Order = child.Order + 1;
|
if (child != null) page.Order = child.Order + 1;
|
||||||
break;
|
break;
|
||||||
case ">>":
|
case ">>":
|
||||||
page.Order = int.MaxValue;
|
page.Order = int.MaxValue;
|
||||||
|
@ -363,8 +363,8 @@
|
||||||
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
|
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
|
||||||
page.EditMode = (mode == "edit" ? true : false);
|
page.EditMode = (mode == "edit" ? true : false);
|
||||||
page.ThemeType = themetype;
|
page.ThemeType = themetype;
|
||||||
page.LayoutType = (layouttype == null ? "" : layouttype);
|
page.LayoutType = layouttype ?? "";
|
||||||
page.Icon = (icon == null ? "" : icon);
|
page.Icon = icon ?? "";
|
||||||
page.Permissions = permissiongrid.GetPermissions();
|
page.Permissions = permissiongrid.GetPermissions();
|
||||||
|
|
||||||
if (page.ThemeType == PageState.Site.DefaultThemeType)
|
if (page.ThemeType == PageState.Site.DefaultThemeType)
|
||||||
|
@ -375,7 +375,7 @@
|
||||||
{
|
{
|
||||||
page.LayoutType = "";
|
page.LayoutType = "";
|
||||||
}
|
}
|
||||||
page.IsPersonalizable = (ispersonalizable == null ? false : Boolean.Parse(ispersonalizable));
|
page.IsPersonalizable = (ispersonalizable != null && Boolean.Parse(ispersonalizable));
|
||||||
page.UserId = null;
|
page.UserId = null;
|
||||||
|
|
||||||
page = await PageService.UpdatePageAsync(page);
|
page = await PageService.UpdatePageAsync(page);
|
||||||
|
@ -392,9 +392,9 @@
|
||||||
// update child paths
|
// update child paths
|
||||||
if (parentid != currentparentid)
|
if (parentid != currentparentid)
|
||||||
{
|
{
|
||||||
foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentpath)))
|
foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentPath)))
|
||||||
{
|
{
|
||||||
p.Path = p.Path.Replace(currentpath, page.Path);
|
p.Path = p.Path.Replace(currentPath, page.Path);
|
||||||
await PageService.UpdatePageAsync(p);
|
await PageService.UpdatePageAsync(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label class="control-label">Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@name" />
|
<input class="form-control" @bind="@name" />
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Title: </label>
|
<label class="control-label">Title: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@title" />
|
<input class="form-control" @bind="@title" />
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Description: </label>
|
<label class="control-label">Description: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@description" rows="5" />
|
<textarea class="form-control" @bind="@description" rows="5" />
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Category: </label>
|
<label class="control-label">Category: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@category" />
|
<input class="form-control" @bind="@category" />
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Order: </label>
|
<label class="control-label">Order: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@vieworder" />
|
<input class="form-control" @bind="@vieworder" />
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Length: </label>
|
<label class="control-label">Length: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@maxlength" />
|
<input class="form-control" @bind="@maxlength" />
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Value: </label>
|
<label class="control-label">Default Value: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@defaultvalue" />
|
<input class="form-control" @bind="@defaultvalue" />
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Required? </label>
|
<label class="control-label">Required? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isrequired">
|
<select class="form-control" @bind="@isrequired">
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Private? </label>
|
<label class="control-label">Private? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isprivate">
|
<select class="form-control" @bind="@isprivate">
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Username" class="control-label">Username: </label>
|
<label for="Username" class="control-label">Username: </label>
|
||||||
<input type="text" class="form-control" placeholder="Username" @bind="@Username" readonly />
|
<input type="text" class="form-control" placeholder="Username" @bind="@_username" readonly id="Username"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Password" class="control-label">Password: </label>
|
<label for="Password" class="control-label">Password: </label>
|
||||||
<input type="password" class="form-control" placeholder="Password" @bind="@Password" />
|
<input type="password" class="form-control" placeholder="Password" @bind="@_password" id="Password"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Password" class="control-label">Confirm Password: </label>
|
<label for="Confirm" class="control-label">Confirm Password: </label>
|
||||||
<input type="password" class="form-control" placeholder="Password" @bind="@Confirm" />
|
<input type="password" class="form-control" placeholder="Password" @bind="@_confirm" id="Confirm"/>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-primary" @onclick="Reset">Reset Password</button>
|
<button type="button" class="btn btn-primary" @onclick="Reset">Reset Password</button>
|
||||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||||
|
@ -23,15 +23,15 @@
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Anonymous; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Anonymous; } }
|
||||||
|
|
||||||
string Username = "";
|
string _username = "";
|
||||||
string Password = "";
|
string _password = "";
|
||||||
string Confirm = "";
|
string _confirm = "";
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
if (PageState.QueryString.ContainsKey("name") && PageState.QueryString.ContainsKey("token"))
|
if (PageState.QueryString.ContainsKey("name") && PageState.QueryString.ContainsKey("token"))
|
||||||
{
|
{
|
||||||
Username = PageState.QueryString["name"];
|
_username = PageState.QueryString["name"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -43,24 +43,26 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Username != "" && Password != "" && Confirm != "")
|
if (_username != "" && _password != "" && _confirm != "")
|
||||||
{
|
{
|
||||||
if (Password == Confirm)
|
if (_password == _confirm)
|
||||||
{
|
{
|
||||||
User user = new User();
|
User user = new User
|
||||||
user.SiteId = PageState.Site.SiteId;
|
{
|
||||||
user.Username = Username;
|
SiteId = PageState.Site.SiteId,
|
||||||
user.Password = Password;
|
Username = _username,
|
||||||
|
Password = _password
|
||||||
|
};
|
||||||
user = await UserService.ResetPasswordAsync(user, PageState.QueryString["token"]);
|
user = await UserService.ResetPasswordAsync(user, PageState.QueryString["token"]);
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
await logger.LogInformation("User Password Reset {Username}", Username);
|
await logger.LogInformation("User Password Reset {Username}", _username);
|
||||||
NavigationManager.NavigateTo(NavigateUrl("login"));
|
NavigationManager.NavigateTo(NavigateUrl("login"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await logger.LogError("Error Resetting User Password {Username}", Username);
|
await logger.LogError("Error Resetting User Password {Username}", _username);
|
||||||
AddModuleMessage("Error Resetting User Password. Please Ensure Password Meets Complexity Requirements.", MessageType.Error);
|
AddModuleMessage("Error Resetting User Password. Please Ensure Password Meets Complexity Requirements.", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +78,7 @@
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", Username, ex.Message);
|
await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", _username, ex.Message);
|
||||||
AddModuleMessage("Error Resetting User Password", MessageType.Error);
|
AddModuleMessage("Error Resetting User Password", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label class="control-label">Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@name" />
|
<input class="form-control" @bind="@name" />
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Description: </label>
|
<label class="control-label">Description: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@description" rows="5" />
|
<textarea class="form-control" @bind="@description" rows="5" />
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Auto Assigned? </label>
|
<label class="control-label">Auto Assigned? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isautoassigned">
|
<select class="form-control" @bind="@isautoassigned">
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">System Role? </label>
|
<label class="control-label">System Role? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@issystem">
|
<select class="form-control" @bind="@issystem">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label class="control-label">Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@name" />
|
<input class="form-control" @bind="@name" />
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Description: </label>
|
<label class="control-label">Description: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@description" rows="5" />
|
<textarea class="form-control" @bind="@description" rows="5" />
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Auto Assigned? </label>
|
<label class="control-label">Auto Assigned? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isautoassigned">
|
<select class="form-control" @bind="@isautoassigned">
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">System Role? </label>
|
<label class="control-label">System Role? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@issystem">
|
<select class="form-control" @bind="@issystem">
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label class="control-label">Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@name" />
|
<input class="form-control" @bind="@name" />
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Tenant: </label>
|
<label class="control-label">Tenant: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@tenant" readonly />
|
<input class="form-control" @bind="@tenant" readonly />
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Aliases: </label>
|
<label class="control-label">Aliases: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@urls" rows="3" />
|
<textarea class="form-control" @bind="@urls" rows="3" />
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Logo: </label>
|
<label class="control-label">Logo: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<FileManager FileId="@logofileid.ToString()" @ref="filemanager" />
|
<FileManager FileId="@logofileid.ToString()" @ref="filemanager" />
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Theme: </label>
|
<label class="control-label">Default Theme: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Layout: </label>
|
<label class="control-label">Default Layout: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@layouttype">
|
<select class="form-control" @bind="@layouttype">
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Container: </label>
|
<label class="control-label">Default Container: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@containertype">
|
<select class="form-control" @bind="@containertype">
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Is Deleted? </label>
|
<label class="control-label">Is Deleted? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isdeleted">
|
<select class="form-control" @bind="@isdeleted">
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Host: </label>
|
<label class="control-label">Host: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@smtphost" />
|
<input class="form-control" @bind="@smtphost" />
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Port: </label>
|
<label class="control-label">Port: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@smtpport" />
|
<input class="form-control" @bind="@smtpport" />
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">SSL Enabled: </label>
|
<label class="control-label">SSL Enabled: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@smtpssl" />
|
<input class="form-control" @bind="@smtpssl" />
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Username: </label>
|
<label class="control-label">Username: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@smtpusername" />
|
<input class="form-control" @bind="@smtpusername" />
|
||||||
|
@ -143,7 +143,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Password: </label>
|
<label class="control-label">Password: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" class="form-control" @bind="@smtppassword" />
|
<input type="password" class="form-control" @bind="@smtppassword" />
|
||||||
|
|
|
@ -16,7 +16,7 @@ else
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Tenant: </label>
|
<label class="control-label">Tenant: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @onchange="(e => TenantChanged(e))">
|
<select class="form-control" @onchange="(e => TenantChanged(e))">
|
||||||
|
@ -30,7 +30,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label class="control-label">Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@name" />
|
<input class="form-control" @bind="@name" />
|
||||||
|
@ -38,7 +38,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Aliases: </label>
|
<label class="control-label">Aliases: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@urls" rows="3" />
|
<textarea class="form-control" @bind="@urls" rows="3" />
|
||||||
|
@ -46,7 +46,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Theme: </label>
|
<label class="control-label">Default Theme: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||||
|
@ -60,7 +60,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Layout: </label>
|
<label class="control-label">Default Layout: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@layouttype">
|
<select class="form-control" @bind="@layouttype">
|
||||||
|
@ -74,7 +74,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Container: </label>
|
<label class="control-label">Default Container: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@containertype">
|
<select class="form-control" @bind="@containertype">
|
||||||
|
@ -90,7 +90,7 @@ else
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Host Username:</label>
|
<label class="control-label">Host Username:</label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@username" readonly />
|
<input class="form-control" @bind="@username" readonly />
|
||||||
|
@ -98,7 +98,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Host Password:</label>
|
<label class="control-label">Host Password:</label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" class="form-control" @bind="@password" />
|
<input type="password" class="form-control" @bind="@password" />
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label class="control-label">Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@name" />
|
<input class="form-control" @bind="@name" />
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Tenant: </label>
|
<label class="control-label">Tenant: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@tenant" readonly />
|
<input class="form-control" @bind="@tenant" readonly />
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Aliases: </label>
|
<label class="control-label">Aliases: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@urls" rows="3" />
|
<textarea class="form-control" @bind="@urls" rows="3" />
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Theme: </label>
|
<label class="control-label">Default Theme: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Layout: </label>
|
<label class="control-label">Default Layout: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@layouttype">
|
<select class="form-control" @bind="@layouttype">
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Default Container: </label>
|
<label class="control-label">Default Container: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@containertype">
|
<select class="form-control" @bind="@containertype">
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Is Deleted? </label>
|
<label class="control-label">Is Deleted? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isdeleted">
|
<select class="form-control" @bind="@isdeleted">
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Log(Alias, LogLevel.Information, "Edit", null, "Site Saved {Site}", site);
|
await Log(Alias, LogLevel.Information,PermissionNames.Edit, null, "Site Saved {Site}", site);
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label class="control-label">Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@name" />
|
<input class="form-control" @bind="@name" />
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Schema: </label>
|
<label class="control-label">Schema: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@schema" />
|
<input class="form-control" @bind="@schema" />
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Name: </label>
|
<label class="control-label">Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@name" />
|
<input class="form-control" @bind="@name" />
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Connection String: </label>
|
<label class="control-label">Connection String: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@connectionstring" />
|
<input class="form-control" @bind="@connectionstring" />
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Schema: </label>
|
<label class="control-label">Schema: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@schema" />
|
<input class="form-control" @bind="@schema" />
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Theme: </label>
|
<label class="control-label">Theme: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<FileManager Filter="nupkg" ShowFiles="false" Folder="Themes" />
|
<FileManager Filter="nupkg" ShowFiles="false" Folder="Themes" />
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Framework: </label>
|
<label class="control-label">Framework: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<FileManager Filter="nupkg" ShowFiles="false" Folder="Framework" />
|
<FileManager Filter="nupkg" ShowFiles="false" Folder="Framework" />
|
||||||
|
@ -56,4 +56,4 @@
|
||||||
await InstallationService.Upgrade();
|
await InstallationService.Upgrade();
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">To: </label>
|
<label class="control-label">To: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@userid">
|
<select class="form-control" @bind="@userid">
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Subject: </label>
|
<label class="control-label">Subject: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@subject" />
|
<input class="form-control" @bind="@subject" />
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Message: </label>
|
<label class="control-label">Message: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@body" rows="5" />
|
<textarea class="form-control" @bind="@body" rows="5" />
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
<label for="@p.Name" class="control-label">@p.Title: </label>
|
<label for="@p.Name" class="control-label">@p.Title: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" placeholder="@p.Description" @onchange="(e => ProfileChanged(e, p.Name))" />
|
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" placeholder="@p.Description" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">@title: </label>
|
<label class="control-label">@title: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" readonly @bind="userid">
|
<select class="form-control" readonly @bind="userid">
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Subject: </label>
|
<label class="control-label">Subject: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@subject" />
|
<input class="form-control" @bind="@subject" />
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Date: </label>
|
<label class="control-label">Date: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@createdon" />
|
<input class="form-control" @bind="@createdon" />
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
}
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Message: </label>
|
<label class="control-label">Message: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea class="form-control" @bind="@body" rows="5" />
|
<textarea class="form-control" @bind="@body" rows="5" />
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Username: </label>
|
<label class="control-label">Username: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@username" />
|
<input class="form-control" @bind="@username" />
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Password: </label>
|
<label class="control-label">Password: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" class="form-control" @bind="@password" />
|
<input type="password" class="form-control" @bind="@password" />
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Confirm Password: </label>
|
<label class="control-label">Confirm Password: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" class="form-control" @bind="@confirm" />
|
<input type="password" class="form-control" @bind="@confirm" />
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Email: </label>
|
<label class="control-label">Email: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@email" />
|
<input class="form-control" @bind="@email" />
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Full Name: </label>
|
<label class="control-label">Full Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@displayname" />
|
<input class="form-control" @bind="@displayname" />
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
<label for="@p.Name" class="control-label">@p.Title: </label>
|
<label for="@p.Name" class="control-label">@p.Title: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" maxlength="@p.MaxLength" placeholder="@p.Description" @onchange="(e => ProfileChanged(e, p.Name))" />
|
<input class="form-control" maxlength="@p.MaxLength" placeholder="@p.Description" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Username: </label>
|
<label class="control-label">Username: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@username" readonly />
|
<input class="form-control" @bind="@username" readonly />
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Password: </label>
|
<label class="control-label">Password: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" class="form-control" @bind="@password" />
|
<input type="password" class="form-control" @bind="@password" />
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Confirm Password: </label>
|
<label class="control-label">Confirm Password: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" class="form-control" @bind="@confirm" />
|
<input type="password" class="form-control" @bind="@confirm" />
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Email: </label>
|
<label class="control-label">Email: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@email" />
|
<input class="form-control" @bind="@email" />
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Full Name: </label>
|
<label class="control-label">Full Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@displayname" />
|
<input class="form-control" @bind="@displayname" />
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Photo: </label>
|
<label class="control-label">Photo: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<FileManager FileId="@photofileid.ToString()" @ref="filemanager" />
|
<FileManager FileId="@photofileid.ToString()" @ref="filemanager" />
|
||||||
|
@ -82,13 +82,13 @@
|
||||||
<label for="@p.Name" class="control-label">@p.Title: </label>
|
<label for="@p.Name" class="control-label">@p.Title: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" placeholder="@p.Description" @onchange="(e => ProfileChanged(e, p.Name))" />
|
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" placeholder="@p.Description" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Is Deleted? </label>
|
<label class="control-label">Is Deleted? </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@isdeleted">
|
<select class="form-control" @bind="@isdeleted">
|
||||||
|
|
|
@ -12,7 +12,7 @@ else
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Role: </label>
|
<label class="control-label">Role: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" @bind="@roleid">
|
<select class="form-control" @bind="@roleid">
|
||||||
|
@ -26,7 +26,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Effective Date: </label>
|
<label class="control-label">Effective Date: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@effectivedate" />
|
<input class="form-control" @bind="@effectivedate" />
|
||||||
|
@ -34,7 +34,7 @@ else
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Name" class="control-label">Expiry Date: </label>
|
<label class="control-label">Expiry Date: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@expirydate" />
|
<input class="form-control" @bind="@expirydate" />
|
||||||
|
@ -184,4 +184,4 @@ else
|
||||||
AddModuleMessage("Error Removing User From Role", MessageType.Error);
|
AddModuleMessage("Error Removing User From Role", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,10 @@
|
||||||
authorized = true;
|
authorized = true;
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.View:
|
case SecurityAccessLevel.View:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, "View", ModuleState.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, ModuleState.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Edit:
|
case SecurityAccessLevel.Edit:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Admin:
|
case SecurityAccessLevel.Admin:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
||||||
|
|
|
@ -110,10 +110,10 @@
|
||||||
authorized = true;
|
authorized = true;
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.View:
|
case SecurityAccessLevel.View:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, "View", ModuleState.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, ModuleState.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Edit:
|
case SecurityAccessLevel.Edit:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Admin:
|
case SecurityAccessLevel.Admin:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
Folder folder = folders.Where(item => item.FolderId == folderid).FirstOrDefault();
|
Folder folder = folders.Where(item => item.FolderId == folderid).FirstOrDefault();
|
||||||
if (folder != null)
|
if (folder != null)
|
||||||
{
|
{
|
||||||
haseditpermission = UserSecurity.IsAuthorized(PageState.User, "Edit", folder.Permissions);
|
haseditpermission = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, folder.Permissions);
|
||||||
files = await FileService.GetFilesAsync(folderid);
|
files = await FileService.GetFilesAsync(folderid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string _visibleText;
|
string _visibleText = "d-none";
|
||||||
string _visibleRich;
|
string _visibleRich;
|
||||||
bool _richTextEditorMode;
|
bool _richTextEditorMode;
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Oqtane.Services;
|
|
||||||
using Oqtane.Modules.HtmlText.Models;
|
using Oqtane.Modules.HtmlText.Models;
|
||||||
|
using Oqtane.Services;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.Models;
|
|
||||||
|
|
||||||
namespace Oqtane.Modules.HtmlText.Services
|
namespace Oqtane.Modules.HtmlText.Services
|
||||||
{
|
{
|
||||||
public class HtmlTextService : ServiceBase, IHtmlTextService
|
public class HtmlTextService : ServiceBase, IHtmlTextService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
private readonly HttpClient _http;
|
||||||
private readonly SiteState _siteState;
|
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
private readonly SiteState _siteState;
|
||||||
|
|
||||||
public HtmlTextService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public HtmlTextService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
||||||
{
|
{
|
||||||
|
@ -23,42 +22,39 @@ namespace Oqtane.Modules.HtmlText.Services
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string apiurl
|
private string ApiUrl => CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "HtmlText");
|
||||||
{
|
|
||||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "HtmlText"); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<HtmlTextInfo> GetHtmlTextAsync(int ModuleId)
|
public async Task<HtmlTextInfo> GetHtmlTextAsync(int moduleId)
|
||||||
{
|
{
|
||||||
HtmlTextInfo htmltext;
|
HtmlTextInfo htmlText;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//because GetJsonAsync() returns an error if no content exists for the ModuleId ( https://github.com/aspnet/AspNetCore/issues/14041 )
|
//because GetJsonAsync() returns an error if no content exists for the ModuleId ( https://github.com/aspnet/AspNetCore/issues/14041 )
|
||||||
//null value is transfered as empty list
|
//null value is transfered as empty list
|
||||||
var htmltextList = await _http.GetJsonAsync<List<HtmlTextInfo>>(apiurl + "/" + ModuleId.ToString() + "?entityid=" + ModuleId.ToString());
|
var htmlTextList = await _http.GetJsonAsync<List<HtmlTextInfo>>(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
||||||
htmltext = htmltextList.FirstOrDefault();
|
htmlText = htmlTextList.FirstOrDefault();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
htmltext = null;
|
htmlText = null;
|
||||||
}
|
}
|
||||||
return htmltext;
|
|
||||||
|
return htmlText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task AddHtmlTextAsync(HtmlTextInfo htmltext)
|
public async Task AddHtmlTextAsync(HtmlTextInfo htmlText)
|
||||||
{
|
{
|
||||||
await _http.PostJsonAsync(apiurl + "?entityid=" + htmltext.ModuleId.ToString(), htmltext);
|
await _http.PostJsonAsync(ApiUrl + "?entityid=" + htmlText.ModuleId, htmlText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmltext)
|
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmlText)
|
||||||
{
|
{
|
||||||
await _http.PutJsonAsync(apiurl + "/" + htmltext.HtmlTextId.ToString() + "?entityid=" + htmltext.ModuleId.ToString(), htmltext);
|
await _http.PutJsonAsync(ApiUrl + "/" + htmlText.HtmlTextId + "?entityid=" + htmlText.ModuleId, htmlText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteHtmlTextAsync(int ModuleId)
|
public async Task DeleteHtmlTextAsync(int moduleId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync(apiurl + "/" + ModuleId.ToString() + "?entityid=" + ModuleId.ToString());
|
await _http.DeleteAsync(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<PackageReleaseNotes>Not for production use.</PackageReleaseNotes>
|
<PackageReleaseNotes>Not for production use.</PackageReleaseNotes>
|
||||||
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Wasm|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Wasm|AnyCPU'">
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
@inject IPageModuleService PageModuleService
|
@inject IPageModuleService PageModuleService
|
||||||
@inject ILogService logger
|
@inject ILogService logger
|
||||||
|
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
@if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
<div class="app-controlpanel" style="@_display">
|
<div class="app-controlpanel" style="@_display">
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
<option value="-"><Select Module></option>
|
<option value="-"><Select Module></option>
|
||||||
@foreach (var moduledefinition in _moduleDefinitions)
|
@foreach (var moduledefinition in _moduleDefinitions)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "Utilize", moduledefinition.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Utilize, moduledefinition.Permissions))
|
||||||
{
|
{
|
||||||
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
|
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions) || (PageState.Page.IsPersonalizable && PageState.User != null))
|
@if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions) || (PageState.Page.IsPersonalizable && PageState.User != null))
|
||||||
{
|
{
|
||||||
@if (PageState.Page.EditMode)
|
@if (PageState.Page.EditMode)
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
@if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
<button type="button" class="btn @ButtonClass" @onclick="ShowControlPanel">
|
<button type="button" class="btn @ButtonClass" @onclick="ShowControlPanel">
|
||||||
<span class="oi oi-menu"></span>
|
<span class="oi oi-menu"></span>
|
||||||
|
@ -244,7 +244,7 @@
|
||||||
BodyClass = "card-body";
|
BodyClass = "card-body";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
_pages?.Clear();
|
_pages?.Clear();
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@
|
||||||
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories == "").ToList();
|
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories == "").ToList();
|
||||||
foreach (Page p in PageState.Pages)
|
foreach (Page p in PageState.Pages)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, p.Permissions))
|
||||||
{
|
{
|
||||||
_pages.Add(p);
|
_pages.Add(p);
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@
|
||||||
{
|
{
|
||||||
foreach (Module module in PageState.Modules.Where(item => item.PageId == int.Parse(_pageId) && !item.IsDeleted))
|
foreach (Module module in PageState.Modules.Where(item => item.PageId == int.Parse(_pageId) && !item.IsDeleted))
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, module.Permissions))
|
||||||
{
|
{
|
||||||
_modules.Add(module);
|
_modules.Add(module);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@
|
||||||
|
|
||||||
private async Task AddModule()
|
private async Task AddModule()
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
if ((_moduleType == "new" && _moduleDefinitionName != "-") || (_moduleType != "new" && _moduleId != "-"))
|
if ((_moduleType == "new" && _moduleDefinitionName != "-") || (_moduleType != "new" && _moduleId != "-"))
|
||||||
{
|
{
|
||||||
|
@ -381,7 +381,7 @@
|
||||||
|
|
||||||
private async Task ToggleEditMode(bool EditMode)
|
private async Task ToggleEditMode(bool EditMode)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
if (EditMode)
|
if (EditMode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
foreach (Page p in PageState.Pages.Where(item => item.IsNavigation && !item.IsDeleted))
|
foreach (Page p in PageState.Pages.Where(item => item.IsNavigation && !item.IsDeleted))
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions) && p.Level <= securitylevel)
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, p.Permissions) && p.Level <= securitylevel)
|
||||||
{
|
{
|
||||||
securitylevel = int.MaxValue;
|
securitylevel = int.MaxValue;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
menu += "<ul class=\"navbar-nav mr-auto\">";
|
menu += "<ul class=\"navbar-nav mr-auto\">";
|
||||||
foreach (Page p in PageState.Pages.Where(item => item.IsNavigation && !item.IsDeleted))
|
foreach (Page p in PageState.Pages.Where(item => item.IsNavigation && !item.IsDeleted))
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions) && p.ParentId == PageState.Page.ParentId && p.Level == PageState.Page.Level)
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, p.Permissions) && p.ParentId == PageState.Page.ParentId && p.Level == PageState.Page.Level)
|
||||||
{
|
{
|
||||||
if (p.PageId == PageState.Page.PageId)
|
if (p.PageId == PageState.Page.PageId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@inject IPageModuleService PageModuleService
|
@inject IPageModuleService PageModuleService
|
||||||
|
|
||||||
@if (PageState.EditMode && !PageState.Page.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
|
@if (PageState.EditMode && !PageState.Page.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions))
|
||||||
{
|
{
|
||||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
|
||||||
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
|
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
|
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions))
|
||||||
{
|
{
|
||||||
actions = new List<ActionViewModel>();
|
actions = new List<ActionViewModel>();
|
||||||
actions.Add(new ActionViewModel { Action = "settings", Name = "Manage Settings" });
|
actions.Add(new ActionViewModel { Action = "settings", Name = "Manage Settings" });
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
|
|
||||||
protected async Task ModuleAction(string action)
|
protected async Task ModuleAction(string action)
|
||||||
{
|
{
|
||||||
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
|
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions))
|
||||||
{
|
{
|
||||||
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
||||||
|
|
||||||
|
@ -125,4 +125,4 @@
|
||||||
public string Action { set; get; }
|
public string Action { set; get; }
|
||||||
public string Name { set; get; }
|
public string Name { set; get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
if (PageState.EditMode && !PageState.Page.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions) && Name != Constants.AdminPane)
|
if (PageState.EditMode && !PageState.Page.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions) && Name != Constants.AdminPane)
|
||||||
{
|
{
|
||||||
paneadminborder = "app-pane-admin-border";
|
paneadminborder = "app-pane-admin-border";
|
||||||
panetitle = "<div class=\"app-pane-admin-title\">" + Name + " Pane</div>";
|
panetitle = "<div class=\"app-pane-admin-title\">" + Name + " Pane</div>";
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
bool authorized = false;
|
bool authorized = false;
|
||||||
if (Constants.DefaultModuleActions.Contains(PageState.Action))
|
if (Constants.DefaultModuleActions.Contains(PageState.Action))
|
||||||
{
|
{
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -68,10 +68,10 @@
|
||||||
authorized = true;
|
authorized = true;
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.View:
|
case SecurityAccessLevel.View:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, module.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Edit:
|
case SecurityAccessLevel.Edit:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, "Edit", module.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, module.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Admin:
|
case SecurityAccessLevel.Admin:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
if (module != null && module.Pane.ToLower() == Name.ToLower())
|
if (module != null && module.Pane.ToLower() == Name.ToLower())
|
||||||
{
|
{
|
||||||
// check if user is authorized to view module
|
// check if user is authorized to view module
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, module.Permissions))
|
||||||
{
|
{
|
||||||
builder.OpenComponent(0, Type.GetType(Constants.ContainerComponent));
|
builder.OpenComponent(0, Type.GetType(Constants.ContainerComponent));
|
||||||
builder.AddAttribute(1, "Module", module);
|
builder.AddAttribute(1, "Module", module);
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
foreach (Module module in PageState.Modules.Where(item => item.PageId == PageState.Page.PageId && item.Pane.ToLower() == Name.ToLower() && !item.IsDeleted).OrderBy(x => x.Order).ToArray())
|
foreach (Module module in PageState.Modules.Where(item => item.PageId == PageState.Page.PageId && item.Pane.ToLower() == Name.ToLower() && !item.IsDeleted).OrderBy(x => x.Order).ToArray())
|
||||||
{
|
{
|
||||||
// check if user is authorized to view module
|
// check if user is authorized to view module
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, module.Permissions))
|
||||||
{
|
{
|
||||||
builder.OpenComponent(0, Type.GetType(Constants.ContainerComponent));
|
builder.OpenComponent(0, Type.GetType(Constants.ContainerComponent));
|
||||||
builder.AddAttribute(1, "Module", module);
|
builder.AddAttribute(1, "Module", module);
|
||||||
|
@ -132,4 +132,4 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if user is authorized to view page
|
// check if user is authorized to view page
|
||||||
if (UserSecurity.IsAuthorized(user, "View", page.Permissions))
|
if (UserSecurity.IsAuthorized(user,PermissionNames.View, page.Permissions))
|
||||||
{
|
{
|
||||||
page = await ProcessPage(page, site, user);
|
page = await ProcessPage(page, site, user);
|
||||||
|
|
||||||
|
@ -453,4 +453,4 @@
|
||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Oqtane.Controllers
|
||||||
if (int.TryParse(folder, out folderid))
|
if (int.TryParse(folder, out folderid))
|
||||||
{
|
{
|
||||||
Folder f = _folders.GetFolder(folderid);
|
Folder f = _folders.GetFolder(folderid);
|
||||||
if (f != null && _userPermissions.IsAuthorized(User, "Browse", f.Permissions))
|
if (f != null && _userPermissions.IsAuthorized(User, PermissionNames.Browse, f.Permissions))
|
||||||
{
|
{
|
||||||
files = _files.GetFiles(folderid).ToList();
|
files = _files.GetFiles(folderid).ToList();
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ namespace Oqtane.Controllers
|
||||||
Folder folder = _folders.GetFolder(siteId, folderPath);
|
Folder folder = _folders.GetFolder(siteId, folderPath);
|
||||||
List<Models.File> files;
|
List<Models.File> files;
|
||||||
if (folder != null)
|
if (folder != null)
|
||||||
if (_userPermissions.IsAuthorized(User, "Browse", folder.Permissions))
|
if (_userPermissions.IsAuthorized(User, PermissionNames.Browse, folder.Permissions))
|
||||||
{
|
{
|
||||||
files = _files.GetFiles(folder.FolderId).ToList();
|
files = _files.GetFiles(folder.FolderId).ToList();
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ namespace Oqtane.Controllers
|
||||||
public Models.File Get(int id)
|
public Models.File Get(int id)
|
||||||
{
|
{
|
||||||
Models.File file = _files.GetFile(id);
|
Models.File file = _files.GetFile(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "View", file.Folder.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.View, file.Folder.Permissions))
|
||||||
{
|
{
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Models.File Put(int id, [FromBody] Models.File File)
|
public Models.File Put(int id, [FromBody] Models.File File)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Folder", File.Folder.FolderId, "Edit"))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, File.Folder.FolderId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
File = _files.UpdateFile(File);
|
File = _files.UpdateFile(File);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "File Updated {File}", File);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "File Updated {File}", File);
|
||||||
|
@ -140,7 +140,7 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Models.File file = _files.GetFile(id);
|
Models.File file = _files.GetFile(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "Folder", file.Folder.FolderId, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, file.Folder.FolderId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_files.DeleteFile(id);
|
_files.DeleteFile(id);
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
Models.File file = null;
|
Models.File file = null;
|
||||||
Folder folder = _folders.GetFolder(int.Parse(folderid));
|
Folder folder = _folders.GetFolder(int.Parse(folderid));
|
||||||
if (folder != null && _userPermissions.IsAuthorized(User, "Edit", folder.Permissions))
|
if (folder != null && _userPermissions.IsAuthorized(User,PermissionNames.Edit, folder.Permissions))
|
||||||
{
|
{
|
||||||
string folderpath = GetFolderPath(folder);
|
string folderpath = GetFolderPath(folder);
|
||||||
CreateDirectory(folderpath);
|
CreateDirectory(folderpath);
|
||||||
|
@ -213,7 +213,7 @@ namespace Oqtane.Controllers
|
||||||
if (int.TryParse(folder, out folderid))
|
if (int.TryParse(folder, out folderid))
|
||||||
{
|
{
|
||||||
Folder Folder = _folders.GetFolder(folderid);
|
Folder Folder = _folders.GetFolder(folderid);
|
||||||
if (Folder != null && _userPermissions.IsAuthorized(User, "Edit", Folder.Permissions))
|
if (Folder != null && _userPermissions.IsAuthorized(User,PermissionNames.Edit, Folder.Permissions))
|
||||||
{
|
{
|
||||||
folderpath = GetFolderPath(Folder);
|
folderpath = GetFolderPath(Folder);
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ namespace Oqtane.Controllers
|
||||||
public IActionResult Download(int id)
|
public IActionResult Download(int id)
|
||||||
{
|
{
|
||||||
Models.File file = _files.GetFile(id);
|
Models.File file = _files.GetFile(id);
|
||||||
if (file != null && _userPermissions.IsAuthorized(User, "View", file.Folder.Permissions))
|
if (file != null && _userPermissions.IsAuthorized(User,PermissionNames.View, file.Folder.Permissions))
|
||||||
{
|
{
|
||||||
string filepath = GetFolderPath(file.Folder) + file.Name;
|
string filepath = GetFolderPath(file.Folder) + file.Name;
|
||||||
if (System.IO.File.Exists(filepath))
|
if (System.IO.File.Exists(filepath))
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Oqtane.Controllers
|
||||||
List<Folder> folders = new List<Folder>();
|
List<Folder> folders = new List<Folder>();
|
||||||
foreach(Folder folder in _folders.GetFolders(int.Parse(siteid)))
|
foreach(Folder folder in _folders.GetFolders(int.Parse(siteid)))
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Browse", folder.Permissions))
|
if (_userPermissions.IsAuthorized(User, PermissionNames.Browse, folder.Permissions))
|
||||||
{
|
{
|
||||||
folders.Add(folder);
|
folders.Add(folder);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ namespace Oqtane.Controllers
|
||||||
public Folder Get(int id)
|
public Folder Get(int id)
|
||||||
{
|
{
|
||||||
Folder folder = _folders.GetFolder(id);
|
Folder folder = _folders.GetFolder(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "Browse", folder.Permissions))
|
if (_userPermissions.IsAuthorized(User, PermissionNames.Browse, folder.Permissions))
|
||||||
{
|
{
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ namespace Oqtane.Controllers
|
||||||
var folderPath = WebUtility.UrlDecode(path);
|
var folderPath = WebUtility.UrlDecode(path);
|
||||||
Folder folder = _folders.GetFolder(siteId, folderPath);
|
Folder folder = _folders.GetFolder(siteId, folderPath);
|
||||||
if (folder != null)
|
if (folder != null)
|
||||||
if (_userPermissions.IsAuthorized(User, "Browse", folder.Permissions))
|
if (_userPermissions.IsAuthorized(User, PermissionNames.Browse, folder.Permissions))
|
||||||
{
|
{
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,9 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
permissions = UserSecurity.SetPermissionStrings(new List<PermissionString> { new PermissionString { PermissionName = "Edit", Permissions = Constants.AdminRole } });
|
permissions = UserSecurity.SetPermissionStrings(new List<PermissionString> { new PermissionString { PermissionName = PermissionNames.Edit, Permissions = Constants.AdminRole } });
|
||||||
}
|
}
|
||||||
if (_userPermissions.IsAuthorized(User, "Edit", permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.Edit, permissions))
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Folder.Path) && Folder.ParentId != null)
|
if (string.IsNullOrEmpty(Folder.Path) && Folder.ParentId != null)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Folder Put(int id, [FromBody] Folder Folder)
|
public Folder Put(int id, [FromBody] Folder Folder)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Folder", Folder.FolderId, "Edit"))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, Folder.FolderId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Folder.Path) && Folder.ParentId != null)
|
if (string.IsNullOrEmpty(Folder.Path) && Folder.ParentId != null)
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Put(int siteid, int folderid, int? parentid)
|
public void Put(int siteid, int folderid, int? parentid)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Folder", folderid, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, folderid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
int order = 1;
|
int order = 1;
|
||||||
List<Folder> folders = _folders.GetFolders(siteid).ToList();
|
List<Folder> folders = _folders.GetFolders(siteid).ToList();
|
||||||
|
@ -175,7 +175,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Folder", id, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, id, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_folders.DeleteFolder(id);
|
_folders.DeleteFolder(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Folder Deleted {FolderId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Folder Deleted {FolderId}", id);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Oqtane.Controllers
|
||||||
List<Models.Module> modules = new List<Models.Module>();
|
List<Models.Module> modules = new List<Models.Module>();
|
||||||
foreach (PageModule pagemodule in _pageModules.GetPageModules(int.Parse(siteid)))
|
foreach (PageModule pagemodule in _pageModules.GetPageModules(int.Parse(siteid)))
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "View", pagemodule.Module.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.View, pagemodule.Module.Permissions))
|
||||||
{
|
{
|
||||||
Models.Module module = new Models.Module();
|
Models.Module module = new Models.Module();
|
||||||
module.SiteId = pagemodule.Module.SiteId;
|
module.SiteId = pagemodule.Module.SiteId;
|
||||||
|
@ -70,7 +70,7 @@ namespace Oqtane.Controllers
|
||||||
public Models.Module Get(int id)
|
public Models.Module Get(int id)
|
||||||
{
|
{
|
||||||
Models.Module module = _modules.GetModule(id);
|
Models.Module module = _modules.GetModule(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "View", module.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.View, module.Permissions))
|
||||||
{
|
{
|
||||||
List<ModuleDefinition> moduledefinitions = _moduleDefinitions.GetModuleDefinitions(module.SiteId).ToList();
|
List<ModuleDefinition> moduledefinitions = _moduleDefinitions.GetModuleDefinitions(module.SiteId).ToList();
|
||||||
module.ModuleDefinition = moduledefinitions.Find(item => item.ModuleDefinitionName == module.ModuleDefinitionName);
|
module.ModuleDefinition = moduledefinitions.Find(item => item.ModuleDefinitionName == module.ModuleDefinitionName);
|
||||||
|
@ -89,7 +89,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Models.Module Post([FromBody] Models.Module Module)
|
public Models.Module Post([FromBody] Models.Module Module)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Page", Module.PageId, "Edit"))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, Module.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
Module = _modules.AddModule(Module);
|
Module = _modules.AddModule(Module);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Module Added {Module}", Module);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Module Added {Module}", Module);
|
||||||
|
@ -108,7 +108,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Models.Module Put(int id, [FromBody] Models.Module Module)
|
public Models.Module Put(int id, [FromBody] Models.Module Module)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Module", Module.ModuleId, "Edit"))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, Module.ModuleId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
Module = _modules.UpdateModule(Module);
|
Module = _modules.UpdateModule(Module);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Updated {Module}", Module);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Updated {Module}", Module);
|
||||||
|
@ -127,7 +127,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Module", id, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Module, id, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_modules.DeleteModule(id);
|
_modules.DeleteModule(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
|
||||||
|
@ -145,7 +145,7 @@ namespace Oqtane.Controllers
|
||||||
public string Export(int moduleid)
|
public string Export(int moduleid)
|
||||||
{
|
{
|
||||||
string content = "";
|
string content = "";
|
||||||
if (_userPermissions.IsAuthorized(User, "Module", moduleid, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Module, moduleid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
content = _modules.ExportModule(moduleid);
|
content = _modules.ExportModule(moduleid);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ namespace Oqtane.Controllers
|
||||||
public bool Import(int moduleid, [FromBody] string Content)
|
public bool Import(int moduleid, [FromBody] string Content)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Module", moduleid, "Edit"))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, moduleid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
success = _modules.ImportModule(moduleid, Content);
|
success = _modules.ImportModule(moduleid, Content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Oqtane.Controllers
|
||||||
List<ModuleDefinition> moduledefinitions = new List<ModuleDefinition>();
|
List<ModuleDefinition> moduledefinitions = new List<ModuleDefinition>();
|
||||||
foreach(ModuleDefinition moduledefinition in _moduleDefinitions.GetModuleDefinitions(int.Parse(siteid)))
|
foreach(ModuleDefinition moduledefinition in _moduleDefinitions.GetModuleDefinitions(int.Parse(siteid)))
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Utilize", moduledefinition.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.Utilize, moduledefinition.Permissions))
|
||||||
{
|
{
|
||||||
moduledefinitions.Add(moduledefinition);
|
moduledefinitions.Add(moduledefinition);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace Oqtane.Controllers
|
||||||
public ModuleDefinition Get(int id, string siteid)
|
public ModuleDefinition Get(int id, string siteid)
|
||||||
{
|
{
|
||||||
ModuleDefinition moduledefinition = _moduleDefinitions.GetModuleDefinition(id, int.Parse(siteid));
|
ModuleDefinition moduledefinition = _moduleDefinitions.GetModuleDefinition(id, int.Parse(siteid));
|
||||||
if (_userPermissions.IsAuthorized(User, "Utilize", moduledefinition.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.Utilize, moduledefinition.Permissions))
|
||||||
{
|
{
|
||||||
return moduledefinition;
|
return moduledefinition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Oqtane.Controllers
|
||||||
List<Page> pages = new List<Page>();
|
List<Page> pages = new List<Page>();
|
||||||
foreach (Page page in _pages.GetPages(int.Parse(siteid)))
|
foreach (Page page in _pages.GetPages(int.Parse(siteid)))
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "View", page.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.View, page.Permissions))
|
||||||
{
|
{
|
||||||
pages.Add(page);
|
pages.Add(page);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
page = _pages.GetPage(id, int.Parse(userid));
|
page = _pages.GetPage(id, int.Parse(userid));
|
||||||
}
|
}
|
||||||
if (_userPermissions.IsAuthorized(User, "View", page.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.View, page.Permissions))
|
||||||
{
|
{
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace Oqtane.Controllers
|
||||||
Page page = _pages.GetPage(WebUtility.UrlDecode(path), siteid);
|
Page page = _pages.GetPage(WebUtility.UrlDecode(path), siteid);
|
||||||
if (page != null)
|
if (page != null)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "View", page.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.View, page.Permissions))
|
||||||
{
|
{
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
@ -110,13 +110,13 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
permissions = UserSecurity.SetPermissionStrings(new List<PermissionString> { new PermissionString { PermissionName = "Edit", Permissions = Constants.AdminRole } });
|
permissions = UserSecurity.SetPermissionStrings(new List<PermissionString> { new PermissionString { PermissionName = PermissionNames.Edit, Permissions = Constants.AdminRole } });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_userPermissions.IsAuthorized(User, "Edit", permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.Edit, permissions))
|
||||||
{
|
{
|
||||||
Page = _pages.AddPage(Page);
|
Page = _pages.AddPage(Page);
|
||||||
_syncManager.AddSyncEvent("Site", Page.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, Page.SiteId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Added {Page}", Page);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Added {Page}", Page);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -150,13 +150,13 @@ namespace Oqtane.Controllers
|
||||||
page.LayoutType = parent.LayoutType;
|
page.LayoutType = parent.LayoutType;
|
||||||
page.Icon = parent.Icon;
|
page.Icon = parent.Icon;
|
||||||
List<PermissionString> permissions = new List<PermissionString>();
|
List<PermissionString> permissions = new List<PermissionString>();
|
||||||
permissions.Add(new PermissionString { PermissionName = "View", Permissions = "[" + userid + "]" });
|
permissions.Add(new PermissionString { PermissionName = PermissionNames.View, Permissions = "[" + userid + "]" });
|
||||||
permissions.Add(new PermissionString { PermissionName = "Edit", Permissions = "[" + userid + "]" });
|
permissions.Add(new PermissionString { PermissionName = PermissionNames.Edit, Permissions = "[" + userid + "]" });
|
||||||
page.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
page.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
||||||
page.IsPersonalizable = false;
|
page.IsPersonalizable = false;
|
||||||
page.UserId = int.Parse(userid);
|
page.UserId = int.Parse(userid);
|
||||||
page = _pages.AddPage(page);
|
page = _pages.AddPage(page);
|
||||||
_syncManager.AddSyncEvent("Site", page.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, page.SiteId);
|
||||||
|
|
||||||
// copy modules
|
// copy modules
|
||||||
List<PageModule> pagemodules = _pageModules.GetPageModules(page.SiteId).ToList();
|
List<PageModule> pagemodules = _pageModules.GetPageModules(page.SiteId).ToList();
|
||||||
|
@ -167,8 +167,8 @@ namespace Oqtane.Controllers
|
||||||
module.PageId = page.PageId;
|
module.PageId = page.PageId;
|
||||||
module.ModuleDefinitionName = pm.Module.ModuleDefinitionName;
|
module.ModuleDefinitionName = pm.Module.ModuleDefinitionName;
|
||||||
permissions = new List<PermissionString>();
|
permissions = new List<PermissionString>();
|
||||||
permissions.Add(new PermissionString { PermissionName = "View", Permissions = "[" + userid + "]" });
|
permissions.Add(new PermissionString { PermissionName = PermissionNames.View, Permissions = "[" + userid + "]" });
|
||||||
permissions.Add(new PermissionString { PermissionName = "Edit", Permissions = "[" + userid + "]" });
|
permissions.Add(new PermissionString { PermissionName = PermissionNames.Edit, Permissions = "[" + userid + "]" });
|
||||||
module.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
module.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
||||||
module = _modules.AddModule(module);
|
module = _modules.AddModule(module);
|
||||||
|
|
||||||
|
@ -197,10 +197,10 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Page Put(int id, [FromBody] Page Page)
|
public Page Put(int id, [FromBody] Page Page)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Page", Page.PageId, "Edit"))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, Page.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
Page = _pages.UpdatePage(Page);
|
Page = _pages.UpdatePage(Page);
|
||||||
_syncManager.AddSyncEvent("Site", Page.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, Page.SiteId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Updated {Page}", Page);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Updated {Page}", Page);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -217,7 +217,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Put(int siteid, int pageid, int? parentid)
|
public void Put(int siteid, int pageid, int? parentid)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Page", pageid, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pageid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
int order = 1;
|
int order = 1;
|
||||||
List<Page> pages = _pages.GetPages(siteid).ToList();
|
List<Page> pages = _pages.GetPages(siteid).ToList();
|
||||||
|
@ -230,7 +230,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
order += 2;
|
order += 2;
|
||||||
}
|
}
|
||||||
_syncManager.AddSyncEvent("Site", siteid);
|
_syncManager.AddSyncEvent(EntityNames.Site, siteid);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Order Updated {SiteId} {PageId} {ParentId}", siteid, pageid, parentid);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Order Updated {SiteId} {PageId} {ParentId}", siteid, pageid, parentid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -246,10 +246,10 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Page page = _pages.GetPage(id);
|
Page page = _pages.GetPage(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "Page", page.PageId, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, page.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_pages.DeletePage(page.PageId);
|
_pages.DeletePage(page.PageId);
|
||||||
_syncManager.AddSyncEvent("Site", page.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, page.SiteId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Deleted {PageId}", page.PageId);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Deleted {PageId}", page.PageId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Oqtane.Controllers
|
||||||
public PageModule Get(int id)
|
public PageModule Get(int id)
|
||||||
{
|
{
|
||||||
PageModule pagemodule = _pageModules.GetPageModule(id);
|
PageModule pagemodule = _pageModules.GetPageModule(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "View", pagemodule.Module.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.View, pagemodule.Module.Permissions))
|
||||||
{
|
{
|
||||||
return pagemodule;
|
return pagemodule;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ namespace Oqtane.Controllers
|
||||||
public PageModule Get(int pageid, int moduleid)
|
public PageModule Get(int pageid, int moduleid)
|
||||||
{
|
{
|
||||||
PageModule pagemodule = _pageModules.GetPageModule(pageid, moduleid);
|
PageModule pagemodule = _pageModules.GetPageModule(pageid, moduleid);
|
||||||
if (_userPermissions.IsAuthorized(User, "View", pagemodule.Module.Permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.View, pagemodule.Module.Permissions))
|
||||||
{
|
{
|
||||||
return pagemodule;
|
return pagemodule;
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,10 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public PageModule Post([FromBody] PageModule PageModule)
|
public PageModule Post([FromBody] PageModule PageModule)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Page", PageModule.PageId, "Edit"))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, PageModule.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
PageModule = _pageModules.AddPageModule(PageModule);
|
PageModule = _pageModules.AddPageModule(PageModule);
|
||||||
_syncManager.AddSyncEvent("Page", PageModule.PageId);
|
_syncManager.AddSyncEvent(EntityNames.Page, PageModule.PageId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Module Added {PageModule}", PageModule);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Module Added {PageModule}", PageModule);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -87,10 +87,10 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public PageModule Put(int id, [FromBody] PageModule PageModule)
|
public PageModule Put(int id, [FromBody] PageModule PageModule)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Module", PageModule.ModuleId, "Edit"))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, PageModule.ModuleId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
PageModule = _pageModules.UpdatePageModule(PageModule);
|
PageModule = _pageModules.UpdatePageModule(PageModule);
|
||||||
_syncManager.AddSyncEvent("Page", PageModule.PageId);
|
_syncManager.AddSyncEvent(EntityNames.Page, PageModule.PageId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Updated {PageModule}", PageModule);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Updated {PageModule}", PageModule);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -107,7 +107,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Put(int pageid, string pane)
|
public void Put(int pageid, string pane)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Page", pageid, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pageid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
int order = 1;
|
int order = 1;
|
||||||
List<PageModule> pagemodules = _pageModules.GetPageModules(pageid, pane).OrderBy(item => item.Order).ToList();
|
List<PageModule> pagemodules = _pageModules.GetPageModules(pageid, pane).OrderBy(item => item.Order).ToList();
|
||||||
|
@ -120,7 +120,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
order += 2;
|
order += 2;
|
||||||
}
|
}
|
||||||
_syncManager.AddSyncEvent("Page", pageid);
|
_syncManager.AddSyncEvent(EntityNames.Page, pageid);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Order Updated {PageId} {Pane}", pageid, pane);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Order Updated {PageId} {Pane}", pageid, pane);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -136,10 +136,10 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
PageModule pagemodule = _pageModules.GetPageModule(id);
|
PageModule pagemodule = _pageModules.GetPageModule(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "Page", pagemodule.PageId, "Edit"))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pagemodule.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_pageModules.DeletePageModule(id);
|
_pageModules.DeletePageModule(id);
|
||||||
_syncManager.AddSyncEvent("Page", pagemodule.PageId);
|
_syncManager.AddSyncEvent(EntityNames.Page, pagemodule.PageId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Module Deleted {PageModuleId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Module Deleted {PageModuleId}", id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace Oqtane.Controllers
|
||||||
public IEnumerable<Setting> Get(string entityname, int entityid)
|
public IEnumerable<Setting> Get(string entityname, int entityid)
|
||||||
{
|
{
|
||||||
List<Setting> settings = new List<Setting>();
|
List<Setting> settings = new List<Setting>();
|
||||||
if (IsAuthorized(entityname, entityid, "View"))
|
if (IsAuthorized(entityname, entityid, PermissionNames.View))
|
||||||
{
|
{
|
||||||
settings = _settings.GetSettings(entityname, entityid).ToList();
|
settings = _settings.GetSettings(entityname, entityid).ToList();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace Oqtane.Controllers
|
||||||
public Setting Get(int id)
|
public Setting Get(int id)
|
||||||
{
|
{
|
||||||
Setting setting = _settings.GetSetting(id);
|
Setting setting = _settings.GetSetting(id);
|
||||||
if (IsAuthorized(setting.EntityName, setting.EntityId, "View"))
|
if (IsAuthorized(setting.EntityName, setting.EntityId, PermissionNames.View))
|
||||||
{
|
{
|
||||||
return setting;
|
return setting;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ namespace Oqtane.Controllers
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public Setting Post([FromBody] Setting Setting)
|
public Setting Post([FromBody] Setting Setting)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && IsAuthorized(Setting.EntityName, Setting.EntityId, "Edit"))
|
if (ModelState.IsValid && IsAuthorized(Setting.EntityName, Setting.EntityId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
Setting = _settings.AddSetting(Setting);
|
Setting = _settings.AddSetting(Setting);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Setting Added {Setting}", Setting);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Setting Added {Setting}", Setting);
|
||||||
|
@ -82,7 +82,7 @@ namespace Oqtane.Controllers
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
public Setting Put(int id, [FromBody] Setting Setting)
|
public Setting Put(int id, [FromBody] Setting Setting)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && IsAuthorized(Setting.EntityName, Setting.EntityId, "Edit"))
|
if (ModelState.IsValid && IsAuthorized(Setting.EntityName, Setting.EntityId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
Setting = _settings.UpdateSetting(Setting);
|
Setting = _settings.UpdateSetting(Setting);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Setting Updated {Setting}", Setting);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Setting Updated {Setting}", Setting);
|
||||||
|
@ -101,7 +101,7 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Setting setting = _settings.GetSetting(id);
|
Setting setting = _settings.GetSetting(id);
|
||||||
if (IsAuthorized(setting.EntityName, setting.EntityId, "Edit"))
|
if (IsAuthorized(setting.EntityName, setting.EntityId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_settings.DeleteSetting(id);
|
_settings.DeleteSetting(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Setting Deleted {Setting}", setting);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Setting Deleted {Setting}", setting);
|
||||||
|
@ -116,27 +116,27 @@ namespace Oqtane.Controllers
|
||||||
private bool IsAuthorized(string EntityName, int EntityId, string PermissionName)
|
private bool IsAuthorized(string EntityName, int EntityId, string PermissionName)
|
||||||
{
|
{
|
||||||
bool authorized = false;
|
bool authorized = false;
|
||||||
if (EntityName == "PageModule")
|
if (EntityName == EntityNames.PageModule)
|
||||||
{
|
{
|
||||||
EntityName = "Module";
|
EntityName = EntityNames.Module;
|
||||||
EntityId = _pageModules.GetPageModule(EntityId).ModuleId;
|
EntityId = _pageModules.GetPageModule(EntityId).ModuleId;
|
||||||
}
|
}
|
||||||
switch (EntityName)
|
switch (EntityName)
|
||||||
{
|
{
|
||||||
case "Host":
|
case EntityNames.Host:
|
||||||
authorized = User.IsInRole(Constants.HostRole);
|
authorized = User.IsInRole(Constants.HostRole);
|
||||||
break;
|
break;
|
||||||
case "Site":
|
case EntityNames.Site:
|
||||||
authorized = User.IsInRole(Constants.AdminRole);
|
authorized = User.IsInRole(Constants.AdminRole);
|
||||||
break;
|
break;
|
||||||
case "Page":
|
case EntityNames.Page:
|
||||||
case "Module":
|
case EntityNames.Module:
|
||||||
case "Folder":
|
case EntityNames.Folder:
|
||||||
authorized = _userPermissions.IsAuthorized(User, EntityName, EntityId, PermissionName);
|
authorized = _userPermissions.IsAuthorized(User, EntityName, EntityId, PermissionName);
|
||||||
break;
|
break;
|
||||||
case "User":
|
case EntityNames.User:
|
||||||
authorized = true;
|
authorized = true;
|
||||||
if (PermissionName == "Edit")
|
if (PermissionName == PermissionNames.Edit)
|
||||||
{
|
{
|
||||||
authorized = User.IsInRole(Constants.AdminRole) || (_userPermissions.GetUser(User).UserId == EntityId);
|
authorized = User.IsInRole(Constants.AdminRole) || (_userPermissions.GetUser(User).UserId == EntityId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace Oqtane.Controllers
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
Site = _sites.UpdateSite(Site);
|
Site = _sites.UpdateSite(Site);
|
||||||
_syncManager.AddSyncEvent("Site", Site.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, Site.SiteId);
|
||||||
_logger.Log(Site.SiteId, LogLevel.Information, this, LogFunction.Update, "Site Updated {Site}", Site);
|
_logger.Log(Site.SiteId, LogLevel.Information, this, LogFunction.Update, "Site Updated {Site}", Site);
|
||||||
}
|
}
|
||||||
return Site;
|
return Site;
|
||||||
|
|
|
@ -187,7 +187,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
User = _users.UpdateUser(User);
|
User = _users.UpdateUser(User);
|
||||||
_syncManager.AddSyncEvent("User", User.UserId);
|
_syncManager.AddSyncEvent(EntityNames.User, User.UserId);
|
||||||
User.Password = ""; // remove sensitive information
|
User.Password = ""; // remove sensitive information
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "User Updated {User}", User);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "User Updated {User}", User);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Oqtane.Controllers
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
UserRole = _userRoles.AddUserRole(UserRole);
|
UserRole = _userRoles.AddUserRole(UserRole);
|
||||||
_syncManager.AddSyncEvent("User", UserRole.UserId);
|
_syncManager.AddSyncEvent(EntityNames.User, UserRole.UserId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", UserRole);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", UserRole);
|
||||||
}
|
}
|
||||||
return UserRole;
|
return UserRole;
|
||||||
|
@ -60,7 +60,7 @@ namespace Oqtane.Controllers
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
UserRole = _userRoles.UpdateUserRole(UserRole);
|
UserRole = _userRoles.UpdateUserRole(UserRole);
|
||||||
_syncManager.AddSyncEvent("User", UserRole.UserId);
|
_syncManager.AddSyncEvent(EntityNames.User, UserRole.UserId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "User Role Updated {UserRole}", UserRole);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "User Role Updated {UserRole}", UserRole);
|
||||||
}
|
}
|
||||||
return UserRole;
|
return UserRole;
|
||||||
|
@ -73,7 +73,7 @@ namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
UserRole userRole = _userRoles.GetUserRole(id);
|
UserRole userRole = _userRoles.GetUserRole(id);
|
||||||
_userRoles.DeleteUserRole(id);
|
_userRoles.DeleteUserRole(id);
|
||||||
_syncManager.AddSyncEvent("User", userRole.UserId);
|
_syncManager.AddSyncEvent(EntityNames.User, userRole.UserId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Role Deleted {UserRole}", userRole);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Role Deleted {UserRole}", userRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<PackageReleaseNotes>Not for production use.</PackageReleaseNotes>
|
<PackageReleaseNotes>Not for production use.</PackageReleaseNotes>
|
||||||
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Wasm|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Wasm|AnyCPU'">
|
||||||
|
|
|
@ -78,12 +78,12 @@ namespace Oqtane.Server
|
||||||
// register authorization services
|
// register authorization services
|
||||||
services.AddAuthorizationCore(options =>
|
services.AddAuthorizationCore(options =>
|
||||||
{
|
{
|
||||||
options.AddPolicy("ViewPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "View")));
|
options.AddPolicy("ViewPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", PermissionNames.View)));
|
||||||
options.AddPolicy("EditPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "Edit")));
|
options.AddPolicy("EditPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", PermissionNames.Edit)));
|
||||||
options.AddPolicy("ViewModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "View")));
|
options.AddPolicy("ViewModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", PermissionNames.View)));
|
||||||
options.AddPolicy("EditModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "Edit")));
|
options.AddPolicy("EditModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", PermissionNames.Edit)));
|
||||||
options.AddPolicy("ViewFolder", policy => policy.Requirements.Add(new PermissionRequirement("Folder", "View")));
|
options.AddPolicy("ViewFolder", policy => policy.Requirements.Add(new PermissionRequirement("Folder", PermissionNames.View)));
|
||||||
options.AddPolicy("EditFolder", policy => policy.Requirements.Add(new PermissionRequirement("Folder", "Edit")));
|
options.AddPolicy("EditFolder", policy => policy.Requirements.Add(new PermissionRequirement("Folder", PermissionNames.Edit)));
|
||||||
options.AddPolicy("ListFolder", policy => policy.Requirements.Add(new PermissionRequirement("Folder", "List")));
|
options.AddPolicy("ListFolder", policy => policy.Requirements.Add(new PermissionRequirement("Folder", "List")));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -253,10 +253,10 @@ namespace Oqtane.Server
|
||||||
// register authorization services
|
// register authorization services
|
||||||
services.AddAuthorizationCore(options =>
|
services.AddAuthorizationCore(options =>
|
||||||
{
|
{
|
||||||
options.AddPolicy("ViewPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "View")));
|
options.AddPolicy("ViewPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", PermissionNames.View)));
|
||||||
options.AddPolicy("EditPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "Edit")));
|
options.AddPolicy("EditPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", PermissionNames.Edit)));
|
||||||
options.AddPolicy("ViewModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "View")));
|
options.AddPolicy("ViewModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", PermissionNames.View)));
|
||||||
options.AddPolicy("EditModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "Edit")));
|
options.AddPolicy("EditModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", PermissionNames.Edit)));
|
||||||
});
|
});
|
||||||
|
|
||||||
// register scoped core services
|
// register scoped core services
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<PackageReleaseNotes>Not for production use.</PackageReleaseNotes>
|
<PackageReleaseNotes>Not for production use.</PackageReleaseNotes>
|
||||||
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Wasm|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Wasm|AnyCPU'">
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Oqtane.Security
|
||||||
{
|
{
|
||||||
string permissions = "";
|
string permissions = "";
|
||||||
List<PermissionString> permissionstrings = JsonSerializer.Deserialize<List<PermissionString>>(PermissionStrings);
|
List<PermissionString> permissionstrings = JsonSerializer.Deserialize<List<PermissionString>>(PermissionStrings);
|
||||||
PermissionString permissionstring = permissionstrings.Where(item => item.PermissionName == PermissionName).FirstOrDefault();
|
PermissionString permissionstring = permissionstrings.FirstOrDefault(item => item.PermissionName == PermissionName);
|
||||||
if (permissionstring != null)
|
if (permissionstring != null)
|
||||||
{
|
{
|
||||||
permissions = permissionstring.Permissions;
|
permissions = permissionstring.Permissions;
|
||||||
|
|
13
Oqtane.Shared/Shared/EntityNames.cs
Normal file
13
Oqtane.Shared/Shared/EntityNames.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace Oqtane.Shared
|
||||||
|
{
|
||||||
|
public class EntityNames
|
||||||
|
{
|
||||||
|
public const string Module = "Module";
|
||||||
|
public const string PageModule = "PageModule";
|
||||||
|
public const string Host = "Host";
|
||||||
|
public const string Site = "Site";
|
||||||
|
public const string Page = "Page";
|
||||||
|
public const string Folder = "Folder";
|
||||||
|
public const string User = "User";
|
||||||
|
}
|
||||||
|
}
|
11
Oqtane.Shared/Shared/PermissionNames.cs
Normal file
11
Oqtane.Shared/Shared/PermissionNames.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
namespace Oqtane.Shared
|
||||||
|
{
|
||||||
|
public class PermissionNames
|
||||||
|
{
|
||||||
|
public const string Browse = "Browse";
|
||||||
|
public const string View = "View";
|
||||||
|
public const string Edit = "Edit";
|
||||||
|
public const string Utilize = "Utilize";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
45
Oqtane.Test/Oqtane.Test.csproj
Normal file
45
Oqtane.Test/Oqtane.Test.csproj
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<RazorLangVersion>3.0</RazorLangVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||||
|
<PackageReference Include="bunit" Version="1.0.0-beta-6" />
|
||||||
|
<PackageReference Include="Moq" Version="4.13.1" />
|
||||||
|
<PackageReference Include="xunit.core" Version="2.4.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="Repository\**" />
|
||||||
|
<Compile Remove="Security\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Remove="Repository\**" />
|
||||||
|
<EmbeddedResource Remove="Security\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="Repository\**" />
|
||||||
|
<None Remove="Security\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Remove="Repository\**" />
|
||||||
|
<Content Remove="Security\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oqtane.Shared", "Oqtane.Sha
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oqtane.Upgrade", "Oqtane.Upgrade\Oqtane.Upgrade.csproj", "{2E8C6889-37CF-4C8D-88B1-505547F25098}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oqtane.Upgrade", "Oqtane.Upgrade\Oqtane.Upgrade.csproj", "{2E8C6889-37CF-4C8D-88B1-505547F25098}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Oqtane.Test", "Oqtane.Test\Oqtane.Test.csproj", "{823B556D-8D4E-4BB8-A65A-C4EB5E7E7424}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -42,6 +44,12 @@ Global
|
||||||
{2E8C6889-37CF-4C8D-88B1-505547F25098}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2E8C6889-37CF-4C8D-88B1-505547F25098}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{2E8C6889-37CF-4C8D-88B1-505547F25098}.Wasm|Any CPU.ActiveCfg = Debug|Any CPU
|
{2E8C6889-37CF-4C8D-88B1-505547F25098}.Wasm|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2E8C6889-37CF-4C8D-88B1-505547F25098}.Wasm|Any CPU.Build.0 = Debug|Any CPU
|
{2E8C6889-37CF-4C8D-88B1-505547F25098}.Wasm|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{823B556D-8D4E-4BB8-A65A-C4EB5E7E7424}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{823B556D-8D4E-4BB8-A65A-C4EB5E7E7424}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{823B556D-8D4E-4BB8-A65A-C4EB5E7E7424}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{823B556D-8D4E-4BB8-A65A-C4EB5E7E7424}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{823B556D-8D4E-4BB8-A65A-C4EB5E7E7424}.Wasm|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{823B556D-8D4E-4BB8-A65A-C4EB5E7E7424}.Wasm|Any CPU.Build.0 = Debug|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user