I see that page authorization doesn't work for dialogs.
It would be nice if (in Blazor at least) the dialog service would obey the view authorization.
Perhaps there is a better way, but it seems to work if you were to generate <AuthorizeView>
component instead of Authorize attribute.
Like so:
@page "/add-customer"
@layout MainLayout
@inherits BlazorAuthTest.Pages.AddCustomerComponent
@using Radzen
@using Radzen.Blazor
@using BlazorAuthTest.Models.SalesData
@using BlazorAuthTest.Models
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@attribute [Authorize(Roles="SalesData.WriteAll")] <!--INSTEAD OF THIS-->
<RadzenContent Container="main">
<ChildContent>
<AuthorizeView Roles="SalesData.WriteAll"> <!--THIS IS THE TICKET-->
<Authorized Context="main"> <!--THIS IS THE TICKET-->
<div class="row">
<div class="col-md-12">
<RadzenTemplateForm Data="@customer" Visible="@(customer != null)" TItem="BlazorAuthTest.Models.SalesData.Customer" Submit="@Form0Submit">
...
</RadzenTemplateForm>
</div>
</div>
</Authorized> <!--THIS IS THE TICKET-->
<NotAuthorized> <!--THIS IS THE TICKET-->
<p>Unauthorized</p> <!--THIS IS THE TICKET-->
</NotAuthorized> <!--THIS IS THE TICKET-->
</AuthorizeView> <!--THIS IS THE TICKET-->
</ChildContent>
</RadzenContent>
Thanks for listening and keep up the great work. Looking forward to 3.0!
TIA,
Josh