You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor

118 lines
5.5 KiB

@page "/identity/roles"
@attribute [Authorize(IdentityPermissions.Roles.Default)]
@using Volo.Abp.Identity
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Volo.Abp.PermissionManagement.Blazor.Components
@using Microsoft.Extensions.Localization
@using Volo.Abp.Identity.Localization
@using Volo.Abp.AspNetCore.Components.WebAssembly.Theming
@using Volo.Abp.BlazoriseUI.Components.ObjectExtending
@using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Layout
@inject AbpBlazorMessageLocalizerHelper<IdentityResource> LH
@inherits AbpCrudPageBase<IIdentityRoleAppService, IdentityRoleDto, Guid, GetIdentityRolesInput, IdentityRoleCreateDto, IdentityRoleUpdateDto>
<Card>
<CardHeader>
@* ************************* PAGE HEADER ************************* *@
<PageHeader Title="@L["Roles"]"
BreadcrumbItems="@BreadcrumbItems"
Toolbar="@Toolbar">
</PageHeader>
</CardHeader>
<CardBody>
@* ************************* DATA GRID ************************* *@
<AbpExtensibleDataGrid TItem="IdentityRoleDto"
Data="@Entities"
ReadData="@OnDataGridReadAsync"
TotalItems="@TotalCount"
ShowPager="true"
PageSize="@PageSize"
CurrentPage="@CurrentPage"
Columns="@RoleManagementTableColumns">
</AbpExtensibleDataGrid>
</CardBody>
</Card>
@* ************************* CREATE MODAL ************************* *@
@if (HasCreatePermission)
{
<Modal @ref="CreateModal">
<ModalBackdrop/>
<ModalContent Centered="true">
<Form>
<ModalHeader>
<ModalTitle>@L["NewRole"]</ModalTitle>
<CloseButton Clicked="CloseCreateModalAsync"/>
</ModalHeader>
<ModalBody>
<Validations @ref="@CreateValidationsRef" Model="@NewEntity" ValidateOnLoad="false">
<Validation MessageLocalizer="@LH.Localize">
<Field>
<FieldLabel>@L["DisplayName:RoleName"]</FieldLabel>
<TextEdit @bind-Text="@NewEntity.Name" Autofocus="true">
<Feedback>
<ValidationError/>
</Feedback>
</TextEdit>
</Field>
<ExtensionProperties TEntityType="IdentityRoleCreateDto" TResourceType="IdentityResource" Entity="@NewEntity" LH="@LH"/>
</Validation>
<Field>
<Check TValue="bool" @bind-Checked="@NewEntity.IsDefault">@L["DisplayName:IsDefault"]</Check>
<Check TValue="bool" @bind-Checked="@NewEntity.IsPublic">@L["DisplayName:IsPublic"]</Check>
</Field>
</Validations>
</ModalBody>
<ModalFooter>
<Button Color="Color.Secondary" Clicked="CloseCreateModalAsync">@L["Cancel"]</Button>
<SubmitButton Clicked="@CreateEntityAsync"/>
</ModalFooter>
</Form>
</ModalContent>
</Modal>
}
@* ************************* EDIT MODAL ************************* *@
@if (HasUpdatePermission)
{
<Modal @ref="EditModal">
<ModalBackdrop/>
<ModalContent Centered="true">
<Form>
<ModalHeader>
<ModalTitle>@L["Edit"]</ModalTitle>
<CloseButton Clicked="CloseEditModalAsync"/>
</ModalHeader>
<ModalBody>
<Validations @ref="@EditValidationsRef" Model="@EditingEntity" ValidateOnLoad="false">
<input type="hidden" name="ConcurrencyStamp" @bind-value="EditingEntity.ConcurrencyStamp"/>
<Validation MessageLocalizer="@LH.Localize">
<Field>
<FieldLabel>@L["DisplayName:RoleName"]</FieldLabel>
<TextEdit @bind-Text="EditingEntity.Name" Autofocus="true">
<Feedback>
<ValidationError/>
</Feedback>
</TextEdit>
</Field>
<ExtensionProperties TEntityType="IdentityRoleUpdateDto" TResourceType="IdentityResource" Entity="@EditingEntity" LH="@LH"/>
</Validation>
<Field>
<Check TValue="bool" @bind-Checked="@EditingEntity.IsDefault">@L["DisplayName:IsDefault"]</Check>
<Check TValue="bool" @bind-Checked="@EditingEntity.IsPublic">@L["DisplayName:IsPublic"]</Check>
</Field>
</Validations>
</ModalBody>
<ModalFooter>
<Button Color="Color.Secondary" Clicked="CloseEditModalAsync">@L["Cancel"]</Button>
<SubmitButton Clicked="@UpdateEntityAsync"/>
</ModalFooter>
</Form>
</ModalContent>
</Modal>
}
@if (HasManagePermissionsPermission)
{
<PermissionManagementModal @ref="PermissionManagementModal"/>
}