|
|
|
@ -2,12 +2,10 @@ |
|
|
|
@attribute [Authorize(IdentityPermissions.Users.Default)] |
|
|
|
@using Microsoft.AspNetCore.Authorization |
|
|
|
@using Microsoft.Extensions.Localization |
|
|
|
@using Volo.Abp.Application.Dtos |
|
|
|
@using Volo.Abp.Identity.Localization |
|
|
|
@using Volo.Abp.PermissionManagement.Blazor.Components |
|
|
|
@inherits UserManagementBase |
|
|
|
@inject IStringLocalizer<IdentityResource> L |
|
|
|
@inject IAuthorizationService AuthorizationService |
|
|
|
|
|
|
|
@* ************************* PAGE HEADER ************************* *@ |
|
|
|
<Row> |
|
|
|
@ -15,7 +13,7 @@ |
|
|
|
<h1>@L["Users"]</h1> |
|
|
|
</Column> |
|
|
|
<Column ColumnSize="ColumnSize.Is6"> |
|
|
|
@if (canCreate) |
|
|
|
@if (HasCreatePermission) |
|
|
|
{ |
|
|
|
<Paragraph Alignment="TextAlignment.Right"> |
|
|
|
<Button Color="Color.Primary" Clicked="OpenCreateModalAsync">@L["NewUser"]</Button> |
|
|
|
@ -32,7 +30,7 @@ |
|
|
|
ShowPager="true" |
|
|
|
PageSize="PageSize"> |
|
|
|
<DataGridColumns> |
|
|
|
@if (canEdit || canDelete || canEditPermissions) |
|
|
|
@if (ShouldShowEntityActions) |
|
|
|
{ |
|
|
|
<DataGridColumn Width="150px" TItem="IdentityUserDto" Field="@nameof(IdentityUserDto.UserName)" Sortable="false" Caption="@L["Actions"].Value"> |
|
|
|
<DisplayTemplate> |
|
|
|
@ -41,15 +39,15 @@ |
|
|
|
@L["Actions"] |
|
|
|
</DropdownToggle> |
|
|
|
<DropdownMenu> |
|
|
|
@if (canEdit) |
|
|
|
@if (HasUpdatePermission) |
|
|
|
{ |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context.As<IdentityUserDto>().Id)">@L["Edit"]</DropdownItem> |
|
|
|
} |
|
|
|
@if (canEditPermissions) |
|
|
|
@if (HasManagePermissionsPermission) |
|
|
|
{ |
|
|
|
<DropdownItem Clicked="() => PermissionManagementModal.OpenAsync(PermissionProviderName,context.As<IdentityUserDto>().Id.ToString())">@L["Permissions"]</DropdownItem> |
|
|
|
<DropdownItem Clicked="() => PermissionManagementModal.OpenAsync(PermissionProviderName, context.As<IdentityUserDto>().Id.ToString())">@L["Permissions"]</DropdownItem> |
|
|
|
} |
|
|
|
@if (canDelete) |
|
|
|
@if (HasDeletePermission) |
|
|
|
{ |
|
|
|
<DropdownDivider/> |
|
|
|
<DropdownItem Clicked="() => DeleteEntityAsync(context.As<IdentityUserDto>())">@L["Delete"]</DropdownItem> |
|
|
|
@ -78,161 +76,149 @@ |
|
|
|
</DataGrid> |
|
|
|
|
|
|
|
@* ************************* CREATE MODAL ************************* *@ |
|
|
|
<Modal @ref="CreateModal"> |
|
|
|
<ModalBackdrop /> |
|
|
|
<ModalContent IsCentered="true"> |
|
|
|
<ModalHeader> |
|
|
|
<ModalTitle>@L["NewUser"]</ModalTitle> |
|
|
|
<CloseButton Clicked="CloseCreateModalAsync" /> |
|
|
|
</ModalHeader> |
|
|
|
<ModalBody> |
|
|
|
<Tabs @bind-SelectedTab="@_createModalSelectedTab"> |
|
|
|
<Items> |
|
|
|
<Tab Name="UserInformations">@L["UserInformations"]</Tab> |
|
|
|
<Tab Name="Roles">@L["Roles"]</Tab> |
|
|
|
</Items> |
|
|
|
<Content> |
|
|
|
<TabPanel Name="UserInformations"> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:UserName"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.UserName" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Name"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.Name" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Surname"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.Surname" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Password"]</FieldLabel> |
|
|
|
<TextEdit Role="TextRole.Password" @bind-text="NewEntity.Password" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Email"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.Email" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:PhoneNumber"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.PhoneNumber" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<Check TValue="bool" @bind-checked="@NewEntity.LockoutEnabled">@L["DisplayName:LockoutEnabled"]</Check> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<Check TValue="bool" @bind-checked="@NewEntity.TwoFactorEnabled">@L["DisplayName:TwoFactorEnabled"]</Check> |
|
|
|
</Field> |
|
|
|
</TabPanel> |
|
|
|
<TabPanel Name="Roles"> |
|
|
|
@if (NewUserRoles != null) |
|
|
|
{ |
|
|
|
@foreach (var role in NewUserRoles) |
|
|
|
@if (HasCreatePermission) |
|
|
|
{ |
|
|
|
<Modal @ref="CreateModal"> |
|
|
|
<ModalBackdrop/> |
|
|
|
<ModalContent IsCentered="true"> |
|
|
|
<ModalHeader> |
|
|
|
<ModalTitle>@L["NewUser"]</ModalTitle> |
|
|
|
<CloseButton Clicked="CloseCreateModalAsync"/> |
|
|
|
</ModalHeader> |
|
|
|
<ModalBody> |
|
|
|
<Tabs @bind-SelectedTab="@_createModalSelectedTab"> |
|
|
|
<Items> |
|
|
|
<Tab Name="UserInformations">@L["UserInformations"]</Tab> |
|
|
|
<Tab Name="Roles">@L["Roles"]</Tab> |
|
|
|
</Items> |
|
|
|
<Content> |
|
|
|
<TabPanel Name="UserInformations"> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:UserName"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.UserName"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Name"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.Name"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Surname"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.Surname"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Password"]</FieldLabel> |
|
|
|
<TextEdit Role="TextRole.Password" @bind-text="NewEntity.Password"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Email"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.Email"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:PhoneNumber"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="NewEntity.PhoneNumber"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<Check TValue="bool" @bind-checked="@NewEntity.LockoutEnabled">@L["DisplayName:LockoutEnabled"]</Check> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<Check TValue="bool" @bind-checked="@NewEntity.TwoFactorEnabled">@L["DisplayName:TwoFactorEnabled"]</Check> |
|
|
|
</Field> |
|
|
|
</TabPanel> |
|
|
|
<TabPanel Name="Roles"> |
|
|
|
@if (NewUserRoles != null) |
|
|
|
{ |
|
|
|
<Field> |
|
|
|
<input type="hidden" @bind-value="@role.Name" /> |
|
|
|
<Check TValue="bool" @bind-checked="@role.IsAssigned">@role.Name</Check> |
|
|
|
</Field> |
|
|
|
@foreach (var role in NewUserRoles) |
|
|
|
{ |
|
|
|
<Field> |
|
|
|
<input type="hidden" @bind-value="@role.Name"/> |
|
|
|
<Check TValue="bool" @bind-checked="@role.IsAssigned">@role.Name</Check> |
|
|
|
</Field> |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</TabPanel> |
|
|
|
</Content> |
|
|
|
</Tabs> |
|
|
|
</ModalBody> |
|
|
|
<ModalFooter> |
|
|
|
<Button Color="Color.Secondary" Clicked="CloseCreateModalAsync">@L["Cancel"]</Button> |
|
|
|
<Button Color="Color.Primary" Clicked="CreateEntityAsync">@L["Save"]</Button> |
|
|
|
</ModalFooter> |
|
|
|
</ModalContent> |
|
|
|
</Modal> |
|
|
|
</TabPanel> |
|
|
|
</Content> |
|
|
|
</Tabs> |
|
|
|
</ModalBody> |
|
|
|
<ModalFooter> |
|
|
|
<Button Color="Color.Secondary" Clicked="CloseCreateModalAsync">@L["Cancel"]</Button> |
|
|
|
<Button Color="Color.Primary" Clicked="CreateEntityAsync">@L["Save"]</Button> |
|
|
|
</ModalFooter> |
|
|
|
</ModalContent> |
|
|
|
</Modal> |
|
|
|
} |
|
|
|
|
|
|
|
@* ************************* EDIT MODAL ************************* *@ |
|
|
|
<Modal @ref="EditModal"> |
|
|
|
<ModalBackdrop /> |
|
|
|
<ModalContent IsCentered="true"> |
|
|
|
<ModalHeader> |
|
|
|
<ModalTitle>role</ModalTitle> |
|
|
|
<CloseButton Clicked="CloseEditModalAsync" /> |
|
|
|
</ModalHeader> |
|
|
|
<ModalBody> |
|
|
|
<input type="hidden" name="ConcurrencyStamp" @bind-value="EditingEntity.ConcurrencyStamp" /> |
|
|
|
@if (HasUpdatePermission) |
|
|
|
{ |
|
|
|
<Modal @ref="EditModal"> |
|
|
|
<ModalBackdrop/> |
|
|
|
<ModalContent IsCentered="true"> |
|
|
|
<ModalHeader> |
|
|
|
<ModalTitle>role</ModalTitle> |
|
|
|
<CloseButton Clicked="CloseEditModalAsync"/> |
|
|
|
</ModalHeader> |
|
|
|
<ModalBody> |
|
|
|
<input type="hidden" name="ConcurrencyStamp" @bind-value="EditingEntity.ConcurrencyStamp"/> |
|
|
|
|
|
|
|
<Tabs @bind-SelectedTab="@_editModalSelectedTab"> |
|
|
|
<Items> |
|
|
|
<Tab Name="UserInformations">@L["UserInformations"]</Tab> |
|
|
|
<Tab Name="Roles">@L["Roles"]</Tab> |
|
|
|
</Items> |
|
|
|
<Content> |
|
|
|
<TabPanel Name="UserInformations"> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:UserName"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.UserName" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Name"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.Name" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Surname"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.Surname" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Password"]</FieldLabel> |
|
|
|
<TextEdit Role="TextRole.Password" @bind-text="EditingEntity.Password" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Email"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.Email" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:PhoneNumber"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.PhoneNumber" /> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<Check TValue="bool" @bind-checked="EditingEntity.LockoutEnabled">@L["DisplayName:LockoutEnabled"]</Check> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<Check TValue="bool" @bind-checked="EditingEntity.TwoFactorEnabled">@L["DisplayName:TwoFactorEnabled"]</Check> |
|
|
|
</Field> |
|
|
|
</TabPanel> |
|
|
|
<TabPanel Name="Roles"> |
|
|
|
@if (EditUserRoles != null) |
|
|
|
{ |
|
|
|
@foreach (var role in EditUserRoles) |
|
|
|
<Tabs @bind-SelectedTab="@_editModalSelectedTab"> |
|
|
|
<Items> |
|
|
|
<Tab Name="UserInformations">@L["UserInformations"]</Tab> |
|
|
|
<Tab Name="Roles">@L["Roles"]</Tab> |
|
|
|
</Items> |
|
|
|
<Content> |
|
|
|
<TabPanel Name="UserInformations"> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:UserName"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.UserName"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Name"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.Name"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Surname"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.Surname"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Password"]</FieldLabel> |
|
|
|
<TextEdit Role="TextRole.Password" @bind-text="EditingEntity.Password"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:Email"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.Email"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<FieldLabel>@L["DisplayName:PhoneNumber"]</FieldLabel> |
|
|
|
<TextEdit @bind-text="EditingEntity.PhoneNumber"/> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<Check TValue="bool" @bind-checked="EditingEntity.LockoutEnabled">@L["DisplayName:LockoutEnabled"]</Check> |
|
|
|
</Field> |
|
|
|
<Field> |
|
|
|
<Check TValue="bool" @bind-checked="EditingEntity.TwoFactorEnabled">@L["DisplayName:TwoFactorEnabled"]</Check> |
|
|
|
</Field> |
|
|
|
</TabPanel> |
|
|
|
<TabPanel Name="Roles"> |
|
|
|
@if (EditUserRoles != null) |
|
|
|
{ |
|
|
|
<Field> |
|
|
|
<input type="hidden" @bind-value="@role.Name" /> |
|
|
|
<Check TValue="bool" @bind-checked="@role.IsAssigned">@role.Name</Check> |
|
|
|
</Field> |
|
|
|
@foreach (var role in EditUserRoles) |
|
|
|
{ |
|
|
|
<Field> |
|
|
|
<input type="hidden" @bind-value="@role.Name"/> |
|
|
|
<Check TValue="bool" @bind-checked="@role.IsAssigned">@role.Name</Check> |
|
|
|
</Field> |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</TabPanel> |
|
|
|
</Content> |
|
|
|
</Tabs> |
|
|
|
</ModalBody> |
|
|
|
<ModalFooter> |
|
|
|
<Button Color="Color.Secondary" Clicked="CloseEditModalAsync">@L["Cancel"]</Button> |
|
|
|
<Button Color="Color.Primary" Clicked="UpdateEntityAsync">@L["Save"]</Button> |
|
|
|
</ModalFooter> |
|
|
|
</ModalContent> |
|
|
|
</Modal> |
|
|
|
</TabPanel> |
|
|
|
</Content> |
|
|
|
</Tabs> |
|
|
|
</ModalBody> |
|
|
|
<ModalFooter> |
|
|
|
<Button Color="Color.Secondary" Clicked="CloseEditModalAsync">@L["Cancel"]</Button> |
|
|
|
<Button Color="Color.Primary" Clicked="UpdateEntityAsync">@L["Save"]</Button> |
|
|
|
</ModalFooter> |
|
|
|
</ModalContent> |
|
|
|
</Modal> |
|
|
|
} |
|
|
|
|
|
|
|
<PermissionManagementModal @ref="PermissionManagementModal"/> |
|
|
|
|
|
|
|
@code |
|
|
|
{ |
|
|
|
bool canCreate; |
|
|
|
bool canEdit; |
|
|
|
bool canDelete; |
|
|
|
bool canEditPermissions; |
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() |
|
|
|
{ |
|
|
|
await base.OnInitializedAsync(); |
|
|
|
|
|
|
|
canCreate =await AuthorizationService.IsGrantedAsync(IdentityPermissions.Users.Create); |
|
|
|
canEdit = await AuthorizationService.IsGrantedAsync(IdentityPermissions.Users.Update); |
|
|
|
canDelete = await AuthorizationService.IsGrantedAsync(IdentityPermissions.Users.Delete); |
|
|
|
canEditPermissions = await AuthorizationService.IsGrantedAsync(IdentityPermissions.Users.ManagePermissions); |
|
|
|
} |
|
|
|
} |