diff --git a/Hcs.WebApp/Components/Layout/AuthorizedLayout.razor b/Hcs.WebApp/Components/Layout/AuthorizedLayout.razor new file mode 100644 index 0000000..5d2d127 --- /dev/null +++ b/Hcs.WebApp/Components/Layout/AuthorizedLayout.razor @@ -0,0 +1,22 @@ +@inherits LayoutComponentBase + +@using Microsoft.AspNetCore.Authorization + +@layout MainLayout + + + + + @Body + + + + + У вас нет прав для доступа к этой странице + + + + +@code { + public string Roles { get; set; } +} diff --git a/Hcs.WebApp/Components/Pages/Test/Export.razor b/Hcs.WebApp/Components/Pages/Test/Export.razor index 31ddf59..ff97d85 100644 --- a/Hcs.WebApp/Components/Pages/Test/Export.razor +++ b/Hcs.WebApp/Components/Pages/Test/Export.razor @@ -9,49 +9,49 @@ @using Hcs.WebApp.Utils @using Microsoft.AspNetCore.Authorization -@implements IDisposable - @attribute [Authorize] +@layout AuthorizedLayout + +@implements IDisposable + @inject NavigationManager NavigationManager @inject IConfiguration Configuration @inject IClientProvider ClientProvider Тестирование экспорта - - - - - - - - - Сервис nsi - OnNsiExportItem1Click()) Disabled=@inputDisabled Text="Экспорт НСИ 1" ButtonStyle="ButtonStyle.Primary" /> - + + + + + + + + Сервис nsi + OnNsiExportItem1Click()) Disabled=@inputDisabled Text="Экспорт НСИ 1" ButtonStyle="ButtonStyle.Primary" /> - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @code { EventConsole console = default!; @@ -66,10 +66,15 @@ FileMessageCapturer messageCapturer; bool catchMessageBody; + [CascadingParameter] + public AuthorizedLayout Layout { get; set; } + protected override void OnInitialized() { base.OnInitialized(); + Layout.Roles = AppRole.ADMINISTRATOR_TYPE; + logger.OnWriteLine += OnLog; messageCapturer = new FileMessageCapturer("test/export", logger); diff --git a/Hcs.WebApp/Components/_Imports.razor b/Hcs.WebApp/Components/_Imports.razor index 6f10ec9..a43542d 100644 --- a/Hcs.WebApp/Components/_Imports.razor +++ b/Hcs.WebApp/Components/_Imports.razor @@ -2,6 +2,7 @@ @using System.Net.Http.Json @using Hcs.WebApp @using Hcs.WebApp.Components +@using Hcs.WebApp.Components.Layout @using Hcs.WebApp.Components.Shared @using Hcs.WebApp.Data @using Microsoft.AspNetCore.Components.Authorization