@using Koogle.Application.Interfaces @using Koogle.Application.Services @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.Authorization @inject IAuthorizationService AuthorizationService @inject AuthenticationStateProvider AuthStateProvider @inject IUserService UserService @inject NavigationManager NavigationManager @inject ICurrentClubContext CurrentClubContext

AuthTest-Component

@if (_canEdit) { } else {

Keine Berechtigung zum Editieren

} aktueller Club: @CurrentClubContext.ClubName @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; } }