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