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,16 +1,11 @@
@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">
<Content>
<RadzenTemplateForm TItem="InputModel" Data=@Input Submit="@DoAddUserAsync"> <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
@ -56,8 +51,6 @@
</RadzenStack> </RadzenStack>
</RadzenStack> </RadzenStack>
</RadzenTemplateForm> </RadzenTemplateForm>
</Content>
</AuthorizedContent>
@code { @code {
sealed class InputModel sealed class InputModel

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 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">
<Content>
<RadzenTemplateForm TItem="InputModel" Data=@Input Submit="@DoEditUserAsync"> <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
@ -53,8 +48,6 @@
</RadzenStack> </RadzenStack>
</RadzenStack> </RadzenStack>
</RadzenTemplateForm> </RadzenTemplateForm>
</Content>
</AuthorizedContent>
@code { @code {
sealed class InputModel sealed class InputModel