Remove redundant roles check

This commit is contained in:
2025-11-05 09:05:25 +09:00
parent a063ef40a5
commit 35c4bb37ce
2 changed files with 86 additions and 100 deletions

View File

@ -1,17 +1,12 @@
@using Hcs.WebApp.Services @using Hcs.WebApp.Services
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@attribute [Authorize]
@inject RoleManager<AppRole> RoleManager @inject RoleManager<AppRole> RoleManager
@inject UsersService UsersService @inject UsersService UsersService
@inject DialogService DialogService @inject DialogService DialogService
<AuthorizedContent Roles="@AppRole.ADMINISTRATOR_TYPE"> <RadzenTemplateForm TItem="InputModel" Data=@Input Submit="@DoAddUserAsync">
<Content>
<RadzenTemplateForm TItem="InputModel" Data=@Input Submit="@DoAddUserAsync">
<RadzenAlert Visible="@hasError" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter" AllowClose="false"> <RadzenAlert Visible="@hasError" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter" AllowClose="false">
@errorMessage @errorMessage
</RadzenAlert> </RadzenAlert>
@ -55,9 +50,7 @@
<RadzenButton Click="@DoClose" ButtonStyle="ButtonStyle.Light" Disabled="@inProgress" Text="Отмена"></RadzenButton> <RadzenButton Click="@DoClose" ButtonStyle="ButtonStyle.Light" Disabled="@inProgress" Text="Отмена"></RadzenButton>
</RadzenStack> </RadzenStack>
</RadzenStack> </RadzenStack>
</RadzenTemplateForm> </RadzenTemplateForm>
</Content>
</AuthorizedContent>
@code { @code {
sealed class InputModel sealed class InputModel

View File

@ -1,18 +1,13 @@
@using Hcs.WebApp.Services @using Hcs.WebApp.Services
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@attribute [Authorize]
@inject UserManager<AppUser> UserManager; @inject UserManager<AppUser> UserManager;
@inject RoleManager<AppRole> RoleManager @inject RoleManager<AppRole> RoleManager
@inject UsersService UsersService @inject UsersService UsersService
@inject DialogService DialogService @inject DialogService DialogService
<AuthorizedContent Roles="@AppRole.ADMINISTRATOR_TYPE"> <RadzenTemplateForm TItem="InputModel" Data=@Input Submit="@DoEditUserAsync">
<Content>
<RadzenTemplateForm TItem="InputModel" Data=@Input Submit="@DoEditUserAsync">
<RadzenAlert Visible="@hasError" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter" AllowClose="false"> <RadzenAlert Visible="@hasError" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter" AllowClose="false">
@errorMessage @errorMessage
</RadzenAlert> </RadzenAlert>
@ -52,9 +47,7 @@
<RadzenButton Click="@DoClose" ButtonStyle="ButtonStyle.Light" Disabled="@inProgress" Text="Отмена"></RadzenButton> <RadzenButton Click="@DoClose" ButtonStyle="ButtonStyle.Light" Disabled="@inProgress" Text="Отмена"></RadzenButton>
</RadzenStack> </RadzenStack>
</RadzenStack> </RadzenStack>
</RadzenTemplateForm> </RadzenTemplateForm>
</Content>
</AuthorizedContent>
@code { @code {
sealed class InputModel sealed class InputModel