@using Koogle.Application.Interfaces @using Koogle.Application.Services @using Koogle.Web.Store.AuthState @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.Authorization @using Dispatcher = Fluxor.Dispatcher @inherits FluxorComponent @inject IAuthorizationService AuthorizationService @inject AuthenticationStateProvider AuthStateProvider @inject IUserService UserService @inject NavigationManager NavigationManager @inject ICurrentClubContext CurrentClubContext @inject IState AuthState @inject IDispatcher Dispatcher

AuthTest-Component

@if (_canEdit) { } else {

Keine Berechtigung zum Editieren

} @if (AuthState.Value is { CurrentUser: not null }) { User: @AuthState.Value.CurrentUser.DisplayName } aktueller Club: @CurrentClubContext.ClubName @if(AuthState.Value != null) { } TEST @code { private bool _canEdit; protected override async Task OnParametersSetAsync() { var state = await AuthStateProvider.GetAuthenticationStateAsync(); var user = state.User; var result = await AuthorizationService.AuthorizeAsync(user, CurrentClubContext.ClubId, "ClubEditor"); _canEdit = result.Succeeded; } private void Test(MouseEventArgs obj) { Dispatcher.Dispatch(new LogoutCompleteAction()); } }