Create new layout for pages with authorization checks

This commit is contained in:
2025-10-15 11:48:57 +09:00
parent d95589ae58
commit 8e1d313483
3 changed files with 62 additions and 34 deletions

View File

@ -0,0 +1,22 @@
@inherits LayoutComponentBase
@using Microsoft.AspNetCore.Authorization
@layout MainLayout
<AuthorizeView Roles="@Roles">
<Authorized>
<CascadingValue Value="this">
@Body
</CascadingValue>
</Authorized>
<NotAuthorized>
<RadzenAlert AllowClose="false" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter">
У вас нет прав для доступа к этой странице
</RadzenAlert>
</NotAuthorized>
</AuthorizeView>
@code {
public string Roles { get; set; }
}