Management UI for roles, users, tenants
This commit is contained in:
parent
7f6f9427e9
commit
4de8572a87
|
@ -8,26 +8,22 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Install Module" />
|
<ActionLink Action="Add" Text="Install Module" Style="float: right; margin: 10px;" />
|
||||||
<table class="table table-borderless">
|
|
||||||
<thead>
|
<Pager Items="@moduledefinitions">
|
||||||
<tr>
|
<Header>
|
||||||
<th> </th>
|
<th>Name</th>
|
||||||
<th>Name</th>
|
<th>Version</th>
|
||||||
<th>Version</th>
|
<th> </th>
|
||||||
</tr>
|
<th> </th>
|
||||||
</thead>
|
</Header>
|
||||||
<tbody>
|
<Row>
|
||||||
@foreach (var moduledefinition in moduledefinitions)
|
<td>@context.Name</td>
|
||||||
{
|
<td>@context.Version</td>
|
||||||
<tr>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ModuleDefinitionId.ToString())" /></td>
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + moduledefinition.ModuleDefinitionId.ToString())" /></td>
|
<td><ActionLink Action="Delete" Parameters="@($"id=" + context.ModuleDefinitionId.ToString())" Class="btn btn-danger" /></td>
|
||||||
<td>@moduledefinition.Name</td>
|
</Row>
|
||||||
<td>@moduledefinition.Version</td>
|
</Pager>
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<Row>
|
<Row>
|
||||||
<td>@(new string('-', context.Level * 2))@(context.Name)</td>
|
<td>@(new string('-', context.Level * 2))@(context.Name)</td>
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.PageId.ToString())" /></td>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.PageId.ToString())" /></td>
|
||||||
<td><ActionLink Action="Delete" Parameters="@($"id=" +context.PageId.ToString())" Class="btn btn-danger" /></td>
|
<td><ActionLink Action="Delete" Parameters="@($"id=" + context.PageId.ToString())" Class="btn btn-danger" /></td>
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,14 @@
|
||||||
<input class="form-control" @bind="@email" />
|
<input class="form-control" @bind="@email" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Password: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="password" class="form-control" @bind="@password" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
@foreach (Profile profile in profiles)
|
@foreach (Profile profile in profiles)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +66,7 @@
|
||||||
|
|
||||||
string displayname = "";
|
string displayname = "";
|
||||||
string email = "";
|
string email = "";
|
||||||
|
string password = "";
|
||||||
List<Profile> profiles;
|
List<Profile> profiles;
|
||||||
Dictionary<string, string> settings;
|
Dictionary<string, string> settings;
|
||||||
string category = "";
|
string category = "";
|
||||||
|
@ -96,6 +105,7 @@
|
||||||
User user = PageState.User;
|
User user = PageState.User;
|
||||||
user.DisplayName = displayname;
|
user.DisplayName = displayname;
|
||||||
user.Email = email;
|
user.Email = email;
|
||||||
|
user.Password = password;
|
||||||
await UserService.UpdateUserAsync(user);
|
await UserService.UpdateUserAsync(user);
|
||||||
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
||||||
|
|
||||||
|
|
77
Oqtane.Client/Modules/Admin/Roles/Add.razor
Normal file
77
Oqtane.Client/Modules/Admin/Roles/Add.razor
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Roles
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject IRoleService RoleService
|
||||||
|
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@name" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Description: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<textarea class="form-control" @bind="@description" rows="5" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Auto Assigned: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@isautoassigned">
|
||||||
|
<option value="True">Yes</option>
|
||||||
|
<option value="False">No</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">System Role? </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@issystem">
|
||||||
|
<option value="True">Yes</option>
|
||||||
|
<option value="False">No</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success" @onclick="SaveRole">Save</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
|
string name = "";
|
||||||
|
string description = "";
|
||||||
|
string isautoassigned = "False";
|
||||||
|
string issystem = "False";
|
||||||
|
|
||||||
|
private async Task SaveRole()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Role role = new Role();
|
||||||
|
role.SiteId = PageState.Page.SiteId;
|
||||||
|
role.Name = name;
|
||||||
|
role.Description = description;
|
||||||
|
role.IsAutoAssigned = (isautoassigned == null ? false : Boolean.Parse(isautoassigned));
|
||||||
|
role.IsSystem = (issystem == null ? false : Boolean.Parse(issystem));
|
||||||
|
await RoleService.AddRoleAsync(role);
|
||||||
|
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
91
Oqtane.Client/Modules/Admin/Roles/Delete.razor
Normal file
91
Oqtane.Client/Modules/Admin/Roles/Delete.razor
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Roles
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject IRoleService RoleService
|
||||||
|
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@name" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Description: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<textarea class="form-control" @bind="@description" rows="5" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Auto Assigned: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@isautoassigned" readonly>
|
||||||
|
<option value="True">Yes</option>
|
||||||
|
<option value="False">No</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">System Role? </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@issystem" readonly>
|
||||||
|
<option value="True">Yes</option>
|
||||||
|
<option value="False">No</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success" @onclick="DeleteRole">Delete</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
|
int roleid;
|
||||||
|
string name = "";
|
||||||
|
string description = "";
|
||||||
|
string isautoassigned = "False";
|
||||||
|
string issystem = "False";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
roleid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
Role role = await RoleService.GetRoleAsync(roleid);
|
||||||
|
if (role != null)
|
||||||
|
{
|
||||||
|
name = role.Name;
|
||||||
|
description = role.Description;
|
||||||
|
isautoassigned = role.IsAutoAssigned.ToString();
|
||||||
|
issystem = role.IsSystem.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteRole()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await RoleService.DeleteRoleAsync(roleid);
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
99
Oqtane.Client/Modules/Admin/Roles/Edit.razor
Normal file
99
Oqtane.Client/Modules/Admin/Roles/Edit.razor
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Roles
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject IRoleService RoleService
|
||||||
|
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@name" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Description: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<textarea class="form-control" @bind="@description" rows="5" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Auto Assigned: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@isautoassigned">
|
||||||
|
<option value="True">Yes</option>
|
||||||
|
<option value="False">No</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">System Role? </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@issystem">
|
||||||
|
<option value="True">Yes</option>
|
||||||
|
<option value="False">No</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success" @onclick="SaveRole">Save</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
|
int roleid;
|
||||||
|
string name = "";
|
||||||
|
string description = "";
|
||||||
|
string isautoassigned = "False";
|
||||||
|
string issystem = "False";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
roleid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
Role role = await RoleService.GetRoleAsync(roleid);
|
||||||
|
if (role != null)
|
||||||
|
{
|
||||||
|
name = role.Name;
|
||||||
|
description = role.Description;
|
||||||
|
isautoassigned = role.IsAutoAssigned.ToString();
|
||||||
|
issystem = role.IsSystem.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveRole()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Role role = await RoleService.GetRoleAsync(roleid);
|
||||||
|
if (role != null)
|
||||||
|
{
|
||||||
|
role.Name = name;
|
||||||
|
role.Description = description;
|
||||||
|
role.IsAutoAssigned = (isautoassigned == null ? false : Boolean.Parse(isautoassigned));
|
||||||
|
role.IsSystem = (issystem == null ? false : Boolean.Parse(issystem));
|
||||||
|
await RoleService.UpdateRoleAsync(role);
|
||||||
|
}
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,21 +8,20 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<ActionLink Action="Add" Text="Add Role" Style="float: right; margin: 10px;" />
|
||||||
<thead>
|
|
||||||
<tr>
|
<Pager Items="@Roles">
|
||||||
<th>Name</th>
|
<Header>
|
||||||
</tr>
|
<th>Name</th>
|
||||||
</thead>
|
<th> </th>
|
||||||
<tbody>
|
<th> </th>
|
||||||
@foreach (var Role in Roles)
|
</Header>
|
||||||
{
|
<Row>
|
||||||
<tr>
|
<td>@context.Name</td>
|
||||||
<td>@Role.Name</td>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.RoleId.ToString())" /></td>
|
||||||
</tr>
|
<td><ActionLink Action="Delete" Parameters="@($"id=" + context.RoleId.ToString())" Class="btn btn-danger" /></td>
|
||||||
}
|
</Row>
|
||||||
</tbody>
|
</Pager>
|
||||||
</table>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
|
@ -9,22 +9,20 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<ActionLink Action="Add" Text="Add Site" Style="float: right; margin: 10px;" />
|
||||||
<thead>
|
|
||||||
<tr>
|
<Pager Items="@sites">
|
||||||
<th>Name</th>
|
<Header>
|
||||||
</tr>
|
<th>Name</th>
|
||||||
</thead>
|
<th> </th>
|
||||||
<tbody>
|
<th> </th>
|
||||||
@foreach (var site in sites)
|
</Header>
|
||||||
{
|
<Row>
|
||||||
<tr>
|
<td>@context.Name</td>
|
||||||
<td>@site.Name</td>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.SiteId.ToString())" /></td>
|
||||||
</tr>
|
<td><ActionLink Action="Delete" Parameters="@($"id=" + context.SiteId.ToString())" Class="btn btn-danger" /></td>
|
||||||
}
|
</Row>
|
||||||
</tbody>
|
</Pager>
|
||||||
</table>
|
|
||||||
<ActionLink Action="Add" Text="Add Site" />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject ITenantService TenantService
|
@inject ITenantService TenantService
|
||||||
@inject IAliasService AliasService
|
|
||||||
@inject ISiteService SiteService
|
|
||||||
@inject IPageService PageService
|
|
||||||
|
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
70
Oqtane.Client/Modules/Admin/Tenants/Delete.razor
Normal file
70
Oqtane.Client/Modules/Admin/Tenants/Delete.razor
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Tenants
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject ITenantService TenantService
|
||||||
|
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@name" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Connection String: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@connectionstring" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Schema: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@schema" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success" @onclick="DeleteTenant">Delete</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
|
int tenantid;
|
||||||
|
string name = "";
|
||||||
|
string connectionstring = "";
|
||||||
|
string schema = "";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tenantid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
Tenant tenant = await TenantService.GetTenantAsync(tenantid);
|
||||||
|
if (tenant != null)
|
||||||
|
{
|
||||||
|
name = tenant.Name;
|
||||||
|
connectionstring = tenant.DBConnectionString;
|
||||||
|
schema = tenant.DBSchema;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private async Task DeleteTenant()
|
||||||
|
{
|
||||||
|
Tenant tenant = await TenantService.GetTenantAsync(tenantid);
|
||||||
|
if (tenant != null)
|
||||||
|
{
|
||||||
|
await TenantService.DeleteTenantAsync(tenantid);
|
||||||
|
}
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
}
|
73
Oqtane.Client/Modules/Admin/Tenants/Edit.razor
Normal file
73
Oqtane.Client/Modules/Admin/Tenants/Edit.razor
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Tenants
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject ITenantService TenantService
|
||||||
|
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@name" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Connection String: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@connectionstring" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Schema: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@schema" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success" @onclick="SaveTenant">Save</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
|
int tenantid;
|
||||||
|
string name = "";
|
||||||
|
string connectionstring = "";
|
||||||
|
string schema = "";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tenantid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
Tenant tenant = await TenantService.GetTenantAsync(tenantid);
|
||||||
|
if (tenant != null)
|
||||||
|
{
|
||||||
|
name = tenant.Name;
|
||||||
|
connectionstring = tenant.DBConnectionString;
|
||||||
|
schema = tenant.DBSchema;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private async Task SaveTenant()
|
||||||
|
{
|
||||||
|
Tenant tenant = await TenantService.GetTenantAsync(tenantid);
|
||||||
|
if (tenant != null)
|
||||||
|
{
|
||||||
|
tenant.Name = name;
|
||||||
|
tenant.DBConnectionString = connectionstring;
|
||||||
|
tenant.DBSchema = schema;
|
||||||
|
await TenantService.UpdateTenantAsync(tenant);
|
||||||
|
}
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,37 +2,36 @@
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject ITenantService TenantService
|
@inject ITenantService TenantService
|
||||||
|
|
||||||
@if (Tenants == null)
|
@if (tenants == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading...</em></p>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Add Tenant" />
|
<ActionLink Action="Add" Text="Add Tenant" Style="float: right; margin: 10px;" />
|
||||||
<table class="table table-borderless">
|
|
||||||
<thead>
|
<Pager Items="@tenants">
|
||||||
<tr>
|
<Header>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
</tr>
|
<th> </th>
|
||||||
</thead>
|
<th> </th>
|
||||||
<tbody>
|
</Header>
|
||||||
@foreach (var Tenant in Tenants)
|
<Row>
|
||||||
{
|
<td>@context.Name</td>
|
||||||
<tr>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.TenantId.ToString())" /></td>
|
||||||
<td>@Tenant.Name</td>
|
<td><ActionLink Action="Delete" Parameters="@($"id=" + context.TenantId.ToString())" Class="btn btn-danger" /></td>
|
||||||
</tr>
|
</Row>
|
||||||
}
|
</Pager>
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
List<Tenant> Tenants;
|
List<Tenant> tenants;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Tenants = await TenantService.GetTenantsAsync();
|
tenants = await TenantService.GetTenantsAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,37 +2,33 @@
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject IThemeService ThemeService
|
@inject IThemeService ThemeService
|
||||||
|
|
||||||
@if (Themes == null)
|
@if (themes == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading...</em></p>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Install Theme" />
|
<ActionLink Action="Add" Text="Install Theme" Style="float: right; margin: 10px;" />
|
||||||
<table class="table table-borderless">
|
|
||||||
<thead>
|
<Pager Items="@themes">
|
||||||
<tr>
|
<Header>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
</tr>
|
<th>Version</th>
|
||||||
</thead>
|
</Header>
|
||||||
<tbody>
|
<Row>
|
||||||
@foreach (var theme in Themes)
|
<td>@context.Name</td>
|
||||||
{
|
<td>@context.Version</td>
|
||||||
<tr>
|
</Row>
|
||||||
<td>@theme.Name</td>
|
</Pager>
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||||
|
|
||||||
List<Theme> Themes;
|
List<Theme> themes;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Themes = await ThemeService.GetThemesAsync();
|
themes = await ThemeService.GetThemesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
110
Oqtane.Client/Modules/Admin/Users/Add.razor
Normal file
110
Oqtane.Client/Modules/Admin/Users/Add.razor
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Users
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject IUserService UserService
|
||||||
|
@inject IProfileService ProfileService
|
||||||
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
|
@if (profiles != null)
|
||||||
|
{
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@displayname" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Email: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@email" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Password: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="password" class="form-control" @bind="@password" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@foreach (Profile profile in profiles)
|
||||||
|
{
|
||||||
|
var p = profile;
|
||||||
|
if (p.Category != category)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" style="text-align: center;">
|
||||||
|
@p.Category
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
category = p.Category;
|
||||||
|
}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<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))" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-primary" @onclick="SaveUser">Save</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
|
string displayname = "";
|
||||||
|
string email = "";
|
||||||
|
string password = "";
|
||||||
|
List<Profile> profiles;
|
||||||
|
Dictionary<string, string> settings;
|
||||||
|
string category = "";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
profiles = await ProfileService.GetProfilesAsync(ModuleState.SiteId);
|
||||||
|
settings = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveUser()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
User user = new User();
|
||||||
|
user.DisplayName = displayname;
|
||||||
|
user.Email = email;
|
||||||
|
user.Password = password;
|
||||||
|
user = await UserService.AddUserAsync(user);
|
||||||
|
await SettingService.UpdateUserSettingsAsync(settings, user.UserId);
|
||||||
|
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProfileChanged(ChangeEventArgs e, string SettingName)
|
||||||
|
{
|
||||||
|
string value = (string)e.Value;
|
||||||
|
settings = SettingService.SetSetting(settings, SettingName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
108
Oqtane.Client/Modules/Admin/Users/Delete.razor
Normal file
108
Oqtane.Client/Modules/Admin/Users/Delete.razor
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Users
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject IUserService UserService
|
||||||
|
@inject IProfileService ProfileService
|
||||||
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
|
@if (profiles != null)
|
||||||
|
{
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@displayname" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Email: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@email" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@foreach (Profile profile in profiles)
|
||||||
|
{
|
||||||
|
var p = profile;
|
||||||
|
if (p.Category != category)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" style="text-align: center;">
|
||||||
|
@p.Category
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
category = p.Category;
|
||||||
|
}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<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)" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-primary" @onclick="DeleteUser">Delete</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
|
int userid;
|
||||||
|
string displayname = "";
|
||||||
|
string email = "";
|
||||||
|
List<Profile> profiles;
|
||||||
|
Dictionary<string, string> settings;
|
||||||
|
string category = "";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
|
||||||
|
|
||||||
|
userid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
User user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
displayname = user.DisplayName;
|
||||||
|
email = user.Email;
|
||||||
|
settings = await SettingService.GetUserSettingsAsync(user.UserId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetProfileValue(string SettingName, string DefaultValue)
|
||||||
|
{
|
||||||
|
return SettingService.GetSetting(settings, SettingName, DefaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteUser()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
User user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
await UserService.DeleteUserAsync(userid);
|
||||||
|
}
|
||||||
|
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
124
Oqtane.Client/Modules/Admin/Users/Edit.razor
Normal file
124
Oqtane.Client/Modules/Admin/Users/Edit.razor
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Users
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
@inject IUserService UserService
|
||||||
|
@inject IProfileService ProfileService
|
||||||
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
|
@if (profiles != null)
|
||||||
|
{
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Name: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@displayname" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Email: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@email" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Password: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="password" class="form-control" @bind="@password" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@foreach (Profile profile in profiles)
|
||||||
|
{
|
||||||
|
var p = profile;
|
||||||
|
if (p.Category != category)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" style="text-align: center;">
|
||||||
|
@p.Category
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
category = p.Category;
|
||||||
|
}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<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))" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-primary" @onclick="SaveUser">Save</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||||
|
|
||||||
|
int userid;
|
||||||
|
string displayname = "";
|
||||||
|
string email = "";
|
||||||
|
string password = "";
|
||||||
|
List<Profile> profiles;
|
||||||
|
Dictionary<string, string> settings;
|
||||||
|
string category = "";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
|
||||||
|
|
||||||
|
userid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
User user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
displayname = user.DisplayName;
|
||||||
|
email = user.Email;
|
||||||
|
settings = await SettingService.GetUserSettingsAsync(user.UserId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetProfileValue(string SettingName, string DefaultValue)
|
||||||
|
{
|
||||||
|
return SettingService.GetSetting(settings, SettingName, DefaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveUser()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
User user = new User();
|
||||||
|
user.DisplayName = displayname;
|
||||||
|
user.Email = email;
|
||||||
|
user.Password = password;
|
||||||
|
user = await UserService.UpdateUserAsync(user);
|
||||||
|
await SettingService.UpdateUserSettingsAsync(settings, user.UserId);
|
||||||
|
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProfileChanged(ChangeEventArgs e, string SettingName)
|
||||||
|
{
|
||||||
|
string value = (string)e.Value;
|
||||||
|
settings = SettingService.SetSetting(settings, SettingName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,21 +8,20 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<table class="table">
|
<ActionLink Action="Add" Text="Add User" Style="float: right; margin: 10px;" />
|
||||||
<thead>
|
|
||||||
<tr>
|
<Pager Items="@userroles">
|
||||||
<th>Name</th>
|
<Header>
|
||||||
</tr>
|
<th>Name</th>
|
||||||
</thead>
|
<th> </th>
|
||||||
<tbody>
|
<th> </th>
|
||||||
@foreach (UserRole userrole in userroles)
|
</Header>
|
||||||
{
|
<Row>
|
||||||
<tr>
|
<td>@context.User.DisplayName</td>
|
||||||
<td>@userrole.User.Username</td>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.UserId.ToString())" /></td>
|
||||||
</tr>
|
<td><ActionLink Action="Delete" Parameters="@($"id=" + context.UserId.ToString())" Class="btn btn-danger" /></td>
|
||||||
}
|
</Row>
|
||||||
</tbody>
|
</Pager>
|
||||||
</table>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
|
@ -82,6 +82,11 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
authorized = true; // occurs when an action does not have a corresponding module control
|
||||||
|
classname = "btn btn-warning"; // alert developer of missing module comtrol
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,28 +14,31 @@
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="pagination">
|
<div>
|
||||||
@if (Page > MaxPages)
|
@if (Page > MaxPages)
|
||||||
{
|
{
|
||||||
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
||||||
}
|
}
|
||||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
@if (EndPage > 1)
|
||||||
|
|
||||||
@for (int i = StartPage; i <= EndPage; i++)
|
|
||||||
{
|
{
|
||||||
var pager = i;
|
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||||
<button class="btn @((pager == Page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
@for (int i = StartPage; i <= EndPage; i++)
|
||||||
@pager
|
{
|
||||||
</button>
|
var pager = i;
|
||||||
|
<button class="btn @((pager == Page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
||||||
|
@pager
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
||||||
}
|
}
|
||||||
|
|
||||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
|
||||||
@if (EndPage < Pages)
|
@if (EndPage < Pages)
|
||||||
{
|
{
|
||||||
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
||||||
}
|
}
|
||||||
|
@if (EndPage > 1)
|
||||||
<span class="btn btn-link disabled">Page @Page of @Pages</span>
|
{
|
||||||
|
<span class="btn btn-link disabled">Page @Page of @Pages</span>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,12 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
Task<List<Tenant>> GetTenantsAsync();
|
Task<List<Tenant>> GetTenantsAsync();
|
||||||
|
|
||||||
Task<Tenant> GetTenantAsync();
|
Task<Tenant> GetTenantAsync(int TenantId);
|
||||||
|
|
||||||
Task<Tenant> AddTenantAsync(Tenant Tenant);
|
Task<Tenant> AddTenantAsync(Tenant Tenant);
|
||||||
|
|
||||||
|
Task<Tenant> UpdateTenantAsync(Tenant Tenant);
|
||||||
|
|
||||||
|
Task DeleteTenantAsync(int TenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
return await http.PutJsonAsync<Site>(apiurl + "/" + Site.SiteId.ToString(), Site);
|
return await http.PutJsonAsync<Site>(apiurl + "/" + Site.SiteId.ToString(), Site);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteSiteAsync(int SiteId)
|
public async Task DeleteSiteAsync(int SiteId)
|
||||||
{
|
{
|
||||||
await http.DeleteAsync(apiurl + "/" + SiteId.ToString());
|
await http.DeleteAsync(apiurl + "/" + SiteId.ToString());
|
||||||
|
|
|
@ -32,14 +32,24 @@ namespace Oqtane.Services
|
||||||
return tenants.OrderBy(item => item.Name).ToList();
|
return tenants.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tenant> GetTenantAsync()
|
public async Task<Tenant> GetTenantAsync(int TenantId)
|
||||||
{
|
{
|
||||||
return await http.GetJsonAsync<Tenant>(apiurl);
|
return await http.GetJsonAsync<Tenant>(apiurl + "/" + TenantId.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tenant> AddTenantAsync(Tenant Tenant)
|
public async Task<Tenant> AddTenantAsync(Tenant Tenant)
|
||||||
{
|
{
|
||||||
return await http.PostJsonAsync<Tenant>(apiurl, Tenant);
|
return await http.PostJsonAsync<Tenant>(apiurl, Tenant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Tenant> UpdateTenantAsync(Tenant Tenant)
|
||||||
|
{
|
||||||
|
return await http.PutJsonAsync<Tenant>(apiurl + "/" + Tenant.TenantId.ToString(), Tenant);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeleteTenantAsync(int TenantId)
|
||||||
|
{
|
||||||
|
await http.DeleteAsync(apiurl + "/" + TenantId.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,10 +136,19 @@ namespace Oqtane.Controllers
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public User Put(int id, [FromBody] User User)
|
public async Task<User> Put(int id, [FromBody] User User)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
|
if (User.Password != "")
|
||||||
|
{
|
||||||
|
IdentityUser identityuser = await IdentityUserManager.FindByNameAsync(User.Username);
|
||||||
|
if (identityuser != null)
|
||||||
|
{
|
||||||
|
identityuser.PasswordHash = IdentityUserManager.PasswordHasher.HashPassword(identityuser, User.Password);
|
||||||
|
await IdentityUserManager.UpdateAsync(identityuser);
|
||||||
|
}
|
||||||
|
}
|
||||||
User = Users.UpdateUser(User);
|
User = Users.UpdateUser(User);
|
||||||
}
|
}
|
||||||
return User;
|
return User;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user