Password encryption, Claim groups

This commit is contained in:
Andre Beging
2022-04-11 13:05:15 +02:00
parent c553047369
commit 208ea99a42
12 changed files with 273 additions and 125 deletions

View File

@@ -0,0 +1,41 @@
using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Server.Auth;
using Microsoft.AspNetCore.Components;
namespace FoodsharingSiegen.Server.Pages
{
/// <summary>
/// The fs base class (a. beging, 08.04.2022)
/// </summary>
/// <seealso cref="ComponentBase"/>
public class FsBase : ComponentBase
{
#region Dependencies (Injected)
/// <summary>
/// Gets or sets the value of the auth service (ab)
/// </summary>
[Inject] private AuthService? AuthService { get; set; }
#endregion
#region Override OnInitializedAsync
/// <summary>
/// Ons the initialized (a. beging, 11.04.2022)
/// </summary>
protected override async Task OnInitializedAsync()
{
await AuthService!.Initialize();
await base.OnInitializedAsync();
}
#endregion
/// <summary>
/// Gets the value of the current user (ab)
/// </summary>
protected User CurrentUser => AuthService?.User ?? new User();
}
}

View File

@@ -4,12 +4,19 @@
@using FoodsharingSiegen.Server.Dialogs
@using FoodsharingSiegen.Server.Controls
@using FoodsharingSiegen.Contracts.Entity
@using FoodsharingSiegen.Contracts.Helper
@inherits FsBase
<PageTitle>Einarbeitungen</PageTitle>
<h4>Aktuelle Einarbeitungen</h4>
<Button Color="Color.Primary" Clicked="() => ProspectModal.Show()">Hinzufügen</Button>
<Button
Color="Color.Primary"
Clicked="() => ProspectModal.Show()"
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
>Hinzufügen</Button>
@{
var activeProspects = ProspectList?.Where(x => x.Interactions.All(i => i.Type != InteractionType.Complete));

View File

@@ -2,6 +2,8 @@
@page "/users"
@using FoodsharingSiegen.Contracts.Entity
@inherits FsBase
@code {
private RenderFragment PopupTitleTemplate(PopupTitleContext<User> value)
@@ -24,7 +26,7 @@
<h2>Benutzerverwaltung <span style="font-size: .5em; line-height: 0;">Admin</span></h2>
<div class="my-2">
<Button Color="Color.Primary" Disabled="@(SelectedUser == null)">Passwort setzen</Button>
<Button Color="Color.Primary" Disabled="@(SelectedUser == null)"><i class="fa-solid fa-key"></i>&nbsp;setzen</Button>
</div>
<DataGrid TItem="User"
@@ -35,7 +37,7 @@
PopupTitleTemplate="PopupTitleTemplate"
RowInserted="RowInserted"
RowUpdated="RowUpdated"
SelectedRow="SelectedUser"
@bind-SelectedRow="SelectedUser"
RowDoubleClicked="arg => UserDataGrid.Edit(arg.Item)"
Editable
Responsive>